Unverified Commit 039552f6 authored by norvell's avatar norvell
Browse files

Change to adaptive precision for listener position

parent 28dc2fc0
Loading
Loading
Loading
Loading
+2 −2
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 */
+2 −4
Original line number Diff line number Diff line
@@ -264,11 +264,8 @@ 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
#ifndef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
            /* 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 ) );
@@ -276,6 +273,7 @@ ivas_error ivas_td_binaural_renderer_sf_fx(
            tmp_vector_fx->z_fx = L_shr( tmp_vector_fx->z_fx, sub( tmp_vector_fx->q_fact, pos_q ) );
            tmp_vector_fx->q_fact = pos_q;
            move16();
#endif
        }
        ELSE
        {
+0 −6
Original line number Diff line number Diff line
@@ -2109,15 +2109,9 @@ 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();
+6 −21
Original line number Diff line number Diff line
@@ -82,11 +82,7 @@ ivas_error ivas_td_binaural_open_unwrap_fx(
    TDREND_PosType_t PosType;
    Word16 nS;
    const Word32 *ls_azimuth_fx, *ls_elevation_fx;
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
    Word32 Pos_fx[3]; // Q22
#else
    Word32 Pos_fx[3]; // Q25
#endif
    Word32 Dir_fx[3]; // Q30
    TDREND_DirAtten_t *DirAtten_p;
    TDREND_DistAtten_t DistAtten;
@@ -189,9 +185,6 @@ ivas_error ivas_td_binaural_open_unwrap_fx(
        {
            /* Set source positions according to loudspeaker layout */
            angles_to_vec_fx( ONE_IN_Q9, ls_azimuth_fx[nS], ls_elevation_fx[nS], Pos_fx );
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
            Scale_sig32( Pos_fx, 3, -3 ); /* Q25 -> Q22 */
#endif

            Dir_fx[0] = ONE_IN_Q30;
            move32();
@@ -654,11 +647,7 @@ ivas_error TDREND_Update_object_positions_fx(
)
{
    Word16 nS;
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
    Word32 Pos_fx[3]; // Q22
#else
    Word32 Pos_fx[3]; // Q25
#endif
    Word32 Dir_fx[3]; // Q30
    ivas_error error;

@@ -671,12 +660,7 @@ ivas_error TDREND_Update_object_positions_fx(
        {
            /* Update the source positions */
            /* Source position and direction */
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
            angles_to_vec_fx( hIsmMetaData[nS]->radius_fx /*Q9*/, hIsmMetaData[nS]->azimuth_fx, hIsmMetaData[nS]->elevation_fx, Pos_fx );
            Scale_sig32( Pos_fx, 3, -3 ); /* Q25 -> Q22 */
#else
            angles_to_vec_fx( hIsmMetaData[nS]->radius_fx /*Q9*/, hIsmMetaData[nS]->azimuth_fx, hIsmMetaData[nS]->elevation_fx, Pos_fx );
#endif
            angles_to_vec_fx( ONE_IN_Q14, hIsmMetaData[nS]->yaw_fx, hIsmMetaData[nS]->pitch_fx, Dir_fx );

            // DirAtten_p->ConeInnerAngle_fx = DEG_360_IN_Q22;
@@ -699,11 +683,7 @@ ivas_error TDREND_Update_object_positions_fx(
            {
                Pos_fx[0] = 0;
                /* Pos[1] = hIsmMetaData[nS]->azimuth / 90.f; */
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
                Pos_fx[1] = L_shl( Mpy_32_32_r( hIsmMetaData[nS]->azimuth_fx, 23860929 /* 1 / 90.f in Q31 */ ), 0 ); /* Q22 */
#else
                Pos_fx[1] = L_shl( Mpy_32_32_r( hIsmMetaData[nS]->azimuth_fx, 23860929 /* 1 / 90.f in Q31 */ ), Q3 ); /* Q25 */
#endif
                move32();
                Pos_fx[2] = 0;
                move32();
@@ -1013,7 +993,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx(
        Word16 idx = subframe_idx;
        move16();
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
        Word16 pos_q = Q22;
        Word16 pos_q = Q31;
#else
        Word16 pos_q = Q25;
#endif
@@ -1022,6 +1002,10 @@ ivas_error ivas_td_binaural_renderer_ext_fx(
        test();
        IF( *hCombinedOrientationData != NULL && ( *hCombinedOrientationData )->listenerPos != NULL )
        {
#ifdef FIX_BASOP_2023_TDREND_DISTATT_PRECISION
            pos_q = ( *hCombinedOrientationData )->listenerPos[idx].q_fact;
            move16();
#else
            ( *hCombinedOrientationData )->listenerPos[idx].x_fx = L_shr( ( *hCombinedOrientationData )->listenerPos[idx].x_fx, sub( ( *hCombinedOrientationData )->listenerPos[idx].q_fact, pos_q ) );
            move32();
            ( *hCombinedOrientationData )->listenerPos[idx].y_fx = L_shr( ( *hCombinedOrientationData )->listenerPos[idx].y_fx, sub( ( *hCombinedOrientationData )->listenerPos[idx].q_fact, pos_q ) );
@@ -1030,6 +1014,7 @@ ivas_error ivas_td_binaural_renderer_ext_fx(
            move32();
            ( *hCombinedOrientationData )->listenerPos[idx].q_fact = pos_q;
            move16();
#endif
        }
        FOR( Word16 i = 0; i < 3; i++ )
        {
+2 −0
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@ ivas_error TDREND_REND_RenderSourceHRFilt_fx(
    Word16 left_filter_e;
    Word16 right_filter_e;

    dbgwrite( &Src_p->Gain_fx, sizeof( int ), 1, 1, "Gain_fx.int" );

    TDREND_Apply_ITD_fx( Src_p->InputFrame_p_fx, LeftOutputFrame_fx, RightOutputFrame_fx,
                         &Src_p->previtd, Src_p->itd, Src_p->mem_itd_fx, subframe_length );

Loading