Commit 93f9e087 authored by emerit's avatar emerit
Browse files

update panning law for non diegetic bobjetc and renderer, add saturation after evs decoding

parent 9e3acc86
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -170,7 +170,10 @@
/* any switch which is non-be wrt. TS 26.258 V3.0 */
#define FIX_BASOP_2436_REUSED_CLDFB_IN_OMASA_SR         /* FhG: basop issue 2436 (related to basop 2283): fix garbage output for >1 object OMASA with extrend as ISAR prerenderer */
#define FIX_FLOAT_1528_5MS_REND_ISM_META_DELAY_COMPENSATION  /* Nokia: float issue 1528: Fixes incorrect compensation for ISM metadata delay in 5ms TD rendering */

#define FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION /* Orange: float issue 2482: Non-diegetic panning: Limitation/Saturation for BASOP */
#ifdef FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION
//#define FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION_SIMPLE /* Orange: simpliest way to fix the issue */
#endif 
/* ##################### End NON-BE switches ########################### */

/* ################## End MAINTENANCE switches ######################### */
+31 −5
Original line number Diff line number Diff line
@@ -241,6 +241,27 @@ ivas_error ivas_dec_render(
        }
        else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX )
        {
#ifdef FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION_SIMPLE
#ifndef DISABLE_LIMITER
            ivas_limiter_dec( st_ivas->hLimiter, p_tc, 1, *nSamplesRendered, st_ivas->BER_detect );
#endif
            for ( int i = 0; i < n; i++ )
            {
                float temp = p_tc[0][i];
                temp = (float) floor( temp + 0.5f );

                if ( temp > MAX16B_FLT )
                {
                    temp = MAX16B_FLT;
                }
                else if ( temp < MIN16B_FLT )
                {
                    temp = MIN16B_FLT;
                }

                p_tc[0][i] = temp;
            }
#endif
            ivas_apply_non_diegetic_panning( p_tc[0], p_output, st_ivas->hDecoderConfig->non_diegetic_pan_gain, *nSamplesRendered );
        }
        else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC )
@@ -639,7 +660,10 @@ ivas_error ivas_dec_render(
    {
        nchan_out_syn_output = nchan_out;
    }

#ifdef FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION_SIMPLE
    if ( st_ivas->renderer_type != RENDERER_NON_DIEGETIC_DOWNMIX || st_ivas->ivas_format != MONO_FORMAT )
    {
#endif
        if ( is_split_rendering_enabled( st_ivas->hDecoderConfig, st_ivas->hRenderConfig ) == 0 )
        {
            if ( st_ivas->ivas_format != MONO_FORMAT )
@@ -649,7 +673,9 @@ ivas_error ivas_dec_render(
#endif
            }
        }

#ifdef FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION_SIMPLE
    }
#endif
    switch ( pcm_resolution )
    {
        case PCM_INT16:
+6 −0
Original line number Diff line number Diff line
@@ -390,8 +390,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_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION
        float 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 */
+18 −0
Original line number Diff line number Diff line
@@ -2237,8 +2237,14 @@ static ivas_error updateMcPanGainsForMcOut(
    {
        if ( ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO ) && ( inputMc->nonDiegeticPan ) )
        {
#ifdef FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION
            float 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
@@ -2372,8 +2378,14 @@ static ivas_error updateMcPanGainsForBinauralOut(
    setZeroPanMatrix( inputMc->panGains );
    if ( inputMc->base.inConfig == IVAS_AUDIO_CONFIG_MONO )
    {
#ifdef FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION
        float 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
    {
@@ -5995,8 +6007,14 @@ static ivas_error renderIsmToMc(
    {
        if ( ismInput->nonDiegeticPan )
        {
#ifdef FIX_2482_NON_DIEGETIC_PANNING_LIMITATION_SATURATION
            float 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
        {