Commit 8e5e43d3 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files
Merge branch 'main' of ssh://forge.3gpp.org:29419/ivas-codec-pc/ivas-codec into float-1521-sba-binaural-loudness
parents d9f51f44 1e1c2fbf
Loading
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -3078,7 +3078,11 @@ static void IsmPositionProvider_getNextFrame(
            objectMetadataBuffer->positions[objIdx].non_diegetic_flag = 0;
        }

#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
        /* Wrap azimuth to lie within [0, 360) range */
#else
        /* Wrap azimuth to lie within (-180, 180] range */
#endif
        while ( objectMetadataBuffer->positions[objIdx].azimuth < 0.0f )
        {
            objectMetadataBuffer->positions[objIdx].azimuth += 360.0f;
@@ -3088,6 +3092,15 @@ static void IsmPositionProvider_getNextFrame(
            objectMetadataBuffer->positions[objIdx].azimuth -= 360.0f;
        }

#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
        if ( objectMetadataBuffer->positions[objIdx].non_diegetic_flag && objectMetadataBuffer->positions[objIdx].azimuth >= 180.0f )
        {
            /* Wrap azimuth to lie within [-180, 180) range for non-diegetic panning */
            objectMetadataBuffer->positions[objIdx].azimuth -= 360.0f;
        }
#endif


        /* Clamp elevation to lie within [-90, 90] range (can't be wrapped easily) */
        objectMetadataBuffer->positions[objIdx].elevation = min( max( objectMetadataBuffer->positions[objIdx].elevation, -90 ), 90 );
        /* Wrap yaw to lie within (-180, 180] range */
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@
#define FIX_1452_DEFAULT_REVERB                         /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */
#define FIX_FMSW_DEC                                    /* float issue 1542: fix JBM issue in format switching */
#define FIX_FMSW_DEC_2                                  /* float issue 1575: fix crash for format switching when bitsream starts with EVS */
#define FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW     /* Orange: float issue 1548: Harmonize non diegetic panning law in ISM and renderers */
#define FIX_FLOAT_1578_OMASA_REND_SPIKES                /* Nokia: Float issue 1578: Fix spikes and collapsed perception in OMASA/MASA rendering to FOA/HOA */

/* ##################### End NON-BE switches ########################### */
+9 −0
Original line number Diff line number Diff line
@@ -315,6 +315,9 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
    float hrf_right[SFX_SPAT_BIN_MAX_FILTER_LENGTH];
    float azim_delta;
    float elev_delta;
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
    float pan;
#endif

    /* Evaluate the HR filters from the source and listener positions and orientations */
    Listener_p = hBinRendererTd->Listener_p;
@@ -388,8 +391,14 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams(
        *Gain = 1.0f;
        set_f( hrf_left, 0.0f, *filterlength );
        set_f( hrf_right, 0.0f, *filterlength );
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
        pan = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f;
        hrf_left[0] = sinf( pan * EVS_PI * 0.5f );
        hrf_right[0] = cosf( pan * EVS_PI * 0.5f );
#else
        hrf_left[0] = ( SrcSpatial_p->Pos_p[1] + 1.f ) * 0.5f;
        hrf_right[0] = 1.f - hrf_left[0];
#endif
        *intp_count = MAX_INTERPOLATION_STEPS;
        Src_p->elev_prev = 0;
        Src_p->azim_prev = 360.0f; /* Dummy angle -- sets max interpolation if switching to TDREND_POSTYPE_ABSOLUTE */
+28 −0
Original line number Diff line number Diff line
@@ -2211,6 +2211,9 @@ static ivas_error updateMcPanGainsForMcOut(
    const AUDIO_CONFIG outConfig )
{
    ivas_error error;
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
    float pan;
#endif

    /* "if" conditions below realize the following mapping:

@@ -2234,8 +2237,14 @@ static ivas_error updateMcPanGainsForMcOut(
    {
        if ( ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) )
        {
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
            pan = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f;
            inputMc->panGains[0][0] = sinf( pan * EVS_PI * 0.5f );
            inputMc->panGains[0][1] = cosf( pan * EVS_PI * 0.5f );
#else
            inputMc->panGains[0][0] = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f;
            inputMc->panGains[0][1] = 1.f - inputMc->panGains[0][0];
#endif
            error = IVAS_ERR_OK;
        }
        else
@@ -2366,11 +2375,21 @@ static ivas_error updateMcPanGainsForAmbiOut(
static ivas_error updateMcPanGainsForBinauralOut(
    input_mc *inputMc )
{
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
    float pan;
#endif

    setZeroPanMatrix( inputMc->panGains );
    if ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO )
    {
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
        pan = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f;
        inputMc->panGains[0][0] = sinf( pan * EVS_PI * 0.5f );
        inputMc->panGains[0][1] = cosf( pan * EVS_PI * 0.5f );
#else
        inputMc->panGains[0][0] = ( inputMc->nonDiegeticPanGain + 1.f ) * 0.5f;
        inputMc->panGains[0][1] = 1.f - inputMc->panGains[0][0];
#endif
    }
    else
    {
@@ -6001,6 +6020,9 @@ static ivas_error renderIsmToMc(
    int8_t position_changed;
    pan_vector currentPanGains;
    ivas_error error;
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
    float pan;
#endif

    push_wmops( "renderIsmToMc" );

@@ -6009,8 +6031,14 @@ static ivas_error renderIsmToMc(
    {
        if ( ismInput->nonDiegeticPan )
        {
#ifdef FIX_1548_HARMONIZE_NON_DIEGETIC_PANNING_LAW
            pan = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f;
            ismInput->prev_pan_gains[0] = currentPanGains[0] = sinf( pan * EVS_PI * 0.5f );
            ismInput->prev_pan_gains[1] = currentPanGains[1] = cosf( pan * EVS_PI * 0.5f );
#else
            ismInput->prev_pan_gains[0] = currentPanGains[0] = ( ismInput->nonDiegeticPanGain + 1.f ) * 0.5f;
            ismInput->prev_pan_gains[1] = currentPanGains[1] = 1.f - currentPanGains[0];
#endif
        }
        else
        {