Commit c514e4f1 authored by multrus's avatar multrus
Browse files

Merge branch 'main' into...

Merge branch 'main' into basop-2555-ivas_mdct_core_tns_ns_fx-calculation-of-subframe-length-overly-complex
parents 3e985497 525fb9bc
Loading
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
@@ -1174,7 +1174,53 @@ int main(
        fprintf( stderr, "\nError in Renderer Config Init: %s\n", ivas_error_to_string( error ) );
        goto cleanup;
    }
#ifdef FIX_1452_DEFAULT_REVERB

    if ( args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
    {
        /* Set reverb room size if specified or select based automatically based on default per input formats */
        IVAS_ROOM_SIZE_T selectedReverbRoomSize = args.reverbRoomSize;
        if ( selectedReverbRoomSize == IVAS_ROOM_SIZE_AUTO )
        {
            bool combinedFormat = false;
            selectedReverbRoomSize = IVAS_ROOM_SIZE_MEDIUM;

            /* ISM present with MASA/SBA inputs; treat as combined format */
            if ( args.inConfig.numAudioObjects > 0 && ( args.inConfig.numMasaBuses > 0 || args.inConfig.numAmbisonicsBuses > 0 ) )
            {
                combinedFormat = true;
            }

            if ( combinedFormat )
            {
                selectedReverbRoomSize = IVAS_ROOM_SIZE_MEDIUM;
            }
            else
            {
                /* Only set large if ISM is present alone, MASA and Ambisonic have been checked above */
                if ( args.inConfig.numAudioObjects > 0 && args.inConfig.numMultiChannelBuses == 0 )
                {
                    selectedReverbRoomSize = IVAS_ROOM_SIZE_LARGE;
                }
                /* if only MC is present, set medium; Will not be overridden by the subsequent block */
                else if ( args.inConfig.numMultiChannelBuses > 0 )
                {
                    selectedReverbRoomSize = IVAS_ROOM_SIZE_MEDIUM;
                }
                else if ( args.inConfig.numMasaBuses > 0 || args.inConfig.numAmbisonicsBuses > 0 )
                {
                    selectedReverbRoomSize = IVAS_ROOM_SIZE_SMALL;
                }
            }
        }

        if ( ( error = IVAS_REND_SetReverbRoomSize( hIvasRend, selectedReverbRoomSize ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError setting reverb room size\n" );
            goto cleanup;
        }
    }
#endif

    if ( args.renderConfigFilePath[0] != '\0' )
    {
+11 −0
Original line number Diff line number Diff line
@@ -1640,6 +1640,17 @@ typedef enum
#define IVAS_REVERB_DEFAULT_M_N_BANDS           31
#define IVAS_REVERB_DEFAULT_S_N_BANDS           60

#ifdef FIX_1452_DEFAULT_REVERB
#define IVAS_REVERB_DEFAULT_S_ACOUSTIC_PRE_DELAY_FX    2013266  /* 0.015f in Q27 */
#define IVAS_REVERB_DEFAULT_S_INPUT_PRE_DELAY_FX       2684355  /* 0.02f in Q27 */

#define IVAS_REVERB_DEFAULT_M_ACOUSTIC_PRE_DELAY_FX    2013266  /* 0.015f in Q27 */
#define IVAS_REVERB_DEFAULT_M_INPUT_PRE_DELAY_FX       2684355  /* 0.02f in Q27 */

#define IVAS_REVERB_DEFAULT_L_ACOUSTIC_PRE_DELAY_FX    2181038  /* 0.01625f in Q27 */
#define IVAS_REVERB_DEFAULT_L_INPUT_PRE_DELAY_FX       13421773 /* 0.1f in Q27 */
#endif

#define LR_IAC_LENGTH_NR_FC                     ( RV_LENGTH_NR_FC )
#define LR_IAC_LENGTH_NR_FC_16KHZ               ( RV_LENGTH_NR_FC_16KHZ )

+5 −1
Original line number Diff line number Diff line
@@ -129,6 +129,10 @@
#define FIX_BASOP_2545_FIX_LTV_REGRESSION_2529          /* Nokia: BASOP issue 2545: Fix LTV regression caused by issue 2529 fix */
#define FIX_FLOAT_1573_POSITION_UPDATE                  /* Eri: Float issue 1573: For static orientation and listener movement, the PoseUpdated flag is cleared and prevents 5 ms update rate. */
#define FIX_BASOP_2521_DIRAC_STEREO_STEFFI_NRGS         /* FhG: BASOP issue 2521: Fix wrong porting for determination of first subframe length in ivas_sba_dirac_stereo_compute_td_stefi_nrgs() */
#define FIX_1452_DEFAULT_REVERB                         /* Nokia/Philips/FhG: Fix default room presets and their usage in renderer */
#define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC        /* VA : Basop issue 2547: Align conditions in core sw dec */
#define FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC_EVS    /* VA : Basop issue 2547: Align conditions in core sw dec, condition that could affect EVS as well, but adapted to keep EVS BE */


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

+38 −3
Original line number Diff line number Diff line
@@ -183,8 +183,13 @@ void bw_switching_pre_proc_fx(
    {
        st_fx->prev_ener_shb_fx = 0;
        move16();
#ifdef FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC
        IF( st_fx->hBWE_FD != NULL )
#endif
        {
            set16_fx( st_fx->hBWE_FD->prev_SWB_fenv_fx, 0, SWB_FENV );
        }
    }
    ELSE IF( ( ( st_fx->core == ACELP_CORE && ( EQ_16( st_fx->last_core, HQ_CORE ) || EQ_16( st_fx->last_core, TCX_10_CORE ) || EQ_16( st_fx->last_core, TCX_20_CORE ) ) ) || ( EQ_16( st_fx->core, st_fx->last_core ) && NE_16( st_fx->extl, st_fx->last_extl ) ) ) && GE_16( st_fx->last_bwidth, SWB ) )
    {
        st_fx->attenu_fx = 3277; /* Q15 */
@@ -567,7 +572,11 @@ ivas_error core_switching_post_dec_fx(
                hBWE_TD->bwe_non_lin_prev_scale_fx = L_deposit_l( 0 );
                move32();
            }
#ifndef FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC
            IF( st_fx->hHQ_core != NULL && !( EQ_16( inner_frame_tbl[st_fx->bwidth], L_FRAME16k ) && EQ_32( st_fx->core_brate, HQ_32k ) ) )
#else
            IF( st_fx->hHQ_core != NULL && !( EQ_16( inner_frame_tbl[st_fx->bwidth], L_FRAME16k ) && LE_32( st_fx->core_brate, HQ_32k ) ) )
#endif
            {
                set32_fx( hHQ_core->prev_env_fx, 0, SFM_N_WB );
                set32_fx( hHQ_core->prev_normq_fx, 0, SFM_N_WB );
@@ -725,9 +734,31 @@ ivas_error core_switching_post_dec_fx(
    test();
    test();
    test();
    IF( ( st_fx->hBWE_FD != NULL ) && ( ( NE_16( st_fx->last_extl, SWB_BWE ) && EQ_16( st_fx->extl, SWB_BWE ) ) || ( NE_16( st_fx->last_extl, FB_BWE ) && EQ_16( st_fx->extl, FB_BWE ) ) ||
                                        ( ( EQ_16( st_fx->last_core, HQ_CORE ) || EQ_16( st_fx->last_extl, SWB_TBE ) ) && st_fx->extl < 0 && NE_16( st_fx->core, HQ_CORE ) ) || ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) && ( ( NE_16( st_fx->prev_coder_type, INACTIVE ) && EQ_16( st_fx->coder_type, INACTIVE ) ) || ( NE_16( st_fx->prev_coder_type, AUDIO ) && EQ_16( st_fx->coder_type, AUDIO ) ) ) && st_fx->bws_cnt > 0 ) ) )
#ifndef FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC_EVS
    IF( ( st_fx->hBWE_FD != NULL ) &&
        ( ( NE_16( st_fx->last_extl, SWB_BWE ) && EQ_16( st_fx->extl, SWB_BWE ) ) || ( NE_16( st_fx->last_extl, FB_BWE ) && EQ_16( st_fx->extl, FB_BWE ) ) || ( ( EQ_16( st_fx->last_core, HQ_CORE ) || EQ_16( st_fx->last_extl, SWB_TBE ) ) && st_fx->extl < 0 && NE_16( st_fx->core, HQ_CORE ) ) || ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) && ( ( NE_16( st_fx->prev_coder_type, INACTIVE ) && EQ_16( st_fx->coder_type, INACTIVE ) ) || ( NE_16( st_fx->prev_coder_type, AUDIO ) && EQ_16( st_fx->coder_type, AUDIO ) ) ) && st_fx->bws_cnt > 0 ) ) )
#else
    IF( st_fx->hBWE_FD != NULL &&
        ( ( NE_16( st_fx->last_extl, SWB_BWE ) && EQ_16( st_fx->extl, SWB_BWE ) ) ||
          ( NE_16( st_fx->last_extl, FB_BWE ) && EQ_16( st_fx->extl, FB_BWE ) ) ||
          ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) &&
            ( NE_16( st_fx->prev_coder_type, AUDIO ) && EQ_16( st_fx->coder_type, AUDIO ) ) &&
            st_fx->bws_cnt > 0 ) ||
          ( st_fx->element_mode == EVS_MONO &&
            ( ( ( EQ_16( st_fx->last_core, HQ_CORE ) || EQ_16( st_fx->last_extl, SWB_TBE ) ) &&
                st_fx->extl < 0 && NE_16( st_fx->core, HQ_CORE ) ) ||
              ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) &&
                NE_16( st_fx->prev_coder_type, INACTIVE ) && EQ_16( st_fx->coder_type, INACTIVE ) &&
                st_fx->bws_cnt > 0 ) ) ) ||
          ( st_fx->element_mode != EVS_MONO &&
            ( ( ( EQ_16( st_fx->last_core, HQ_CORE ) || EQ_16( st_fx->last_core, TCX_20_CORE ) || EQ_16( st_fx->last_core, TCX_10_CORE ) || EQ_16( st_fx->last_extl, SWB_TBE ) ) &&
                st_fx->extl < 0 && EQ_16( st_fx->core, ACELP_CORE ) ) ||
              ( EQ_16( st_fx->last_core, ACELP_CORE ) && EQ_16( st_fx->core, ACELP_CORE ) &&
                NE_16( st_fx->prev_coder_type, INACTIVE ) && NE_16( st_fx->coder_type, INACTIVE ) &&
                st_fx->bws_cnt > 0 ) ) ) ) )
#endif
    {

        set16_fx( hBWE_FD->L_old_wtda_swb_fx, 0, output_frame );
        hBWE_FD->old_wtda_swb_fx_exp = 0;
        move16();
@@ -852,7 +883,11 @@ ivas_error core_switching_post_dec_fx(

        /* reset WB TBE buffers */
        test();
#ifndef FIX_2547_ALIGN_CONDITIONS_IN_CORE_SW_DEC
        IF( NE_16( st_fx->last_extl, WB_TBE ) && EQ_16( st_fx->extl, WB_TBE ) )
#else
        IF( NE_16( st_fx->last_extl, WB_TBE ) && EQ_16( st_fx->extl, WB_TBE ) && NE_16( st_fx->last_core, TCX_20_CORE ) && NE_16( st_fx->last_core, TCX_10_CORE ) )
#endif
        {
            wb_tbe_extras_reset_fx( hBWE_TD->mem_genSHBexc_filt_down_wb2_fx, hBWE_TD->mem_genSHBexc_filt_down_wb3_fx );
            wb_tbe_extras_reset_synth_fx( hBWE_TD->state_lsyn_filt_shb_fx, hBWE_TD->state_lsyn_filt_dwn_shb_fx, hBWE_TD->state_32and48k_WB_upsample_fx, hBWE_TD->mem_resamp_HB_fx );
+39 −0
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@
#include "prot_fx.h"
#include "ivas_prot_rend_fx.h"
#include "ivas_rom_rend.h"
#ifdef FIX_1452_DEFAULT_REVERB
#include "ivas_cnst.h"
#endif
#include "ivas_rom_TdBinauralRenderer.h"
#include "wmc_auto.h"

@@ -42,6 +45,7 @@
 * Local constants
 *-----------------------------------------------------------------------*/

#ifndef FIX_1452_DEFAULT_REVERB
#define IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX   2147484  // 0.016
#define IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX 13421773 // 0.1

@@ -50,6 +54,7 @@

#define IVAS_REVERB_DEFAULT_M_PRE_DELAY_FX   1677722 //   0.0125f
#define IVAS_REVERB_DEFAULT_M_INPUT_DELAY_FX 0       // 0.0f
#endif

#define IVAS_REVERB_DEFAULT_USE_ER 0

@@ -117,10 +122,17 @@ ivas_error ivas_render_config_init_from_rom_fx(
    move16();
    ( *hRenderConfig )->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_L_N_BANDS;
    move16();
#ifdef FIX_1452_DEFAULT_REVERB
    ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_ACOUSTIC_PRE_DELAY_FX;
    move32();
    ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_PRE_DELAY_FX;
    move32();
#else
    ( *hRenderConfig )->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX;
    move32();
    ( *hRenderConfig )->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX;
    move32();
#endif
    ( *hRenderConfig )->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER;
    move16();
    set32_fx( &( *hRenderConfig )->roomAcoustics.pFc_input_fx[0], 0, CLDFB_NO_CHANNELS_MAX );
@@ -191,17 +203,30 @@ ivas_error ivas_render_config_change_defaults(
    IVAS_DefaultReverbSize defaultReverbSize /* i:   Reverb default size    */
)
{
#ifdef FIX_1452_DEFAULT_REVERB
    hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER;
    move16();

#endif

    SWITCH( defaultReverbSize )
    {
        case DEFAULT_REVERB_SMALL:
            hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_S_N_BANDS;
            move16();
#ifdef FIX_1452_DEFAULT_REVERB
            hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_S_ACOUSTIC_PRE_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_S_INPUT_PRE_DELAY_FX;
            move32();
#else
            hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_S_PRE_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_S_INPUT_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER;
            move16();
#endif
            set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX );
            set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX );
            set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX );
@@ -213,12 +238,19 @@ ivas_error ivas_render_config_change_defaults(
        case DEFAULT_REVERB_MEDIUM:
            hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_M_N_BANDS;
            move16();
#ifdef FIX_1452_DEFAULT_REVERB
            hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_M_ACOUSTIC_PRE_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_M_INPUT_PRE_DELAY_FX;
            move32();
#else
            hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_M_PRE_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_M_INPUT_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER;
            move16();
#endif
            set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX );
            set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX );
            set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX );
@@ -230,12 +262,19 @@ ivas_error ivas_render_config_change_defaults(
        case DEFAULT_REVERB_LARGE:
            hRenderConfig->roomAcoustics.nBands = IVAS_REVERB_DEFAULT_L_N_BANDS;
            move16();
#ifdef FIX_1452_DEFAULT_REVERB
            hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_ACOUSTIC_PRE_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_PRE_DELAY_FX;
            move32();
#else
            hRenderConfig->roomAcoustics.acousticPreDelay_fx = IVAS_REVERB_DEFAULT_L_PRE_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.inputPreDelay_fx = IVAS_REVERB_DEFAULT_L_INPUT_DELAY_FX;
            move32();
            hRenderConfig->roomAcoustics.use_er = IVAS_REVERB_DEFAULT_USE_ER;
            move16();
#endif
            set_zero_fx( &hRenderConfig->roomAcoustics.pFc_input_fx[0], CLDFB_NO_CHANNELS_MAX );
            set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_rt60_fx[0], CLDFB_NO_CHANNELS_MAX );
            set_zero_fx( &hRenderConfig->roomAcoustics.pAcoustic_dsr_fx[0], CLDFB_NO_CHANNELS_MAX );
Loading