Commit 2252d49c authored by multrus's avatar multrus
Browse files

merge from main

parents 984afbe5 ad827404
Loading
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
@@ -122,7 +122,11 @@ typedef struct
    bool customLsOutputEnabled;
    char *customLsSetupFilename;
    int16_t orientation_tracking;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    bool non_diegetic_pan_enabled;
#else
    int16_t Opt_non_diegetic_pan;
#endif
    float non_diegetic_pan_gain;
    Word16 non_diegetic_pan_gain_fx; /* Q15 */
    bool renderConfigEnabled;
@@ -136,7 +140,11 @@ typedef struct
#else
    uint16_t acousticEnvironmentId;
#endif
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    bool dpidEnabled;
#else
    int16_t Opt_dpid_on;
#endif
    uint16_t directivityPatternId[IVAS_MAX_NUM_OBJECTS];

} DecArguments;
@@ -258,7 +266,11 @@ int main(
    if ( arg.hrtfReaderEnabled )
    {
        /* sanity check */
#ifdef NONBE_1293_SR_HRTF
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
#else
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
#endif
        {
            arg.hrtfReaderEnabled = false;
            fprintf( stderr, "\nError: HRTF binary file cannot be used in this output configuration.\n\n" );
@@ -381,8 +393,12 @@ int main(
    if ( arg.renderConfigEnabled )
    {
        /* sanity check */
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM && arg.non_diegetic_pan_enabled == false )
#else
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
             arg.Opt_non_diegetic_pan == 0 )
#endif
        {
            fprintf( stderr, "\nError: Renderer configuration file cannot be used in this output configuration.\n\n" );
            goto cleanup;
@@ -403,8 +419,13 @@ int main(
    asked_frame_size = arg.renderFramesize;
#ifdef FIX_1053_REVERB_RECONFIGURATION
    uint16_t aeID = arg.aeSequence.count > 0 ? arg.aeSequence.pID[0] : 65535;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.non_diegetic_pan_enabled, arg.non_diegetic_pan_gain_fx,
                                       arg.dpidEnabled, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx,
                                       arg.Opt_dpid_on, aeID, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
#endif
#else
    if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputConfig, arg.tsmEnabled, arg.renderFramesize, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.enableExternalOrientation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain_fx,
                                       arg.Opt_dpid_on, arg.acousticEnvironmentId, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK )
@@ -484,7 +505,11 @@ int main(
        /* sanity check */
        if ( arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB &&
             arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED && arg.outputConfig != IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM &&
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
             arg.non_diegetic_pan_enabled == false )
#else
             arg.Opt_non_diegetic_pan == 0 )
#endif
        {
            fprintf( stderr, "\nExternal Renderer Config is supported only when binaural output configurations is used as output OR when Split rendering mode is enabled. Exiting. \n" );
            goto cleanup;
@@ -968,12 +993,20 @@ static bool parseCmdlIVAS_dec(

    arg->renderConfigEnabled = false;
    arg->renderConfigFilename = NULL;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    arg->dpidEnabled = false;
#else
    arg->Opt_dpid_on = 0;
#endif

    arg->outputMdFilename = NULL;

    arg->inputFormat = IVAS_DEC_INPUT_FORMAT_G192;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
    arg->non_diegetic_pan_enabled = false;
#else
    arg->Opt_non_diegetic_pan = 0;
#endif
    arg->non_diegetic_pan_gain = 0.f;
    arg->tsmEnabled = false;
    arg->renderFramesize = IVAS_RENDER_FRAMESIZE_20MS;
@@ -1240,7 +1273,11 @@ static bool parseCmdlIVAS_dec(
        else if ( strcmp( argv_to_upper, "-NON_DIEGETIC_PAN" ) == 0 )
        {
            i++;
#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
            arg->non_diegetic_pan_enabled = true;
#else
            arg->Opt_non_diegetic_pan = 1;
#endif
            strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 );
            argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0';
            to_upper( argv_to_upper );
@@ -1396,7 +1433,11 @@ static bool parseCmdlIVAS_dec(
        {
            int16_t id, tmp;

#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
            arg->dpidEnabled = true;
#else
            arg->Opt_dpid_on = 1;
#endif
            ++i;
            tmp = 0;
            while ( is_number( argv[i + tmp] ) && tmp < IVAS_MAX_NUM_OBJECTS )
@@ -1476,7 +1517,12 @@ static bool parseCmdlIVAS_dec(
            arg->customLsSetupFilename = argv[i];
        }
        i++;

#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
        if ( arg->non_diegetic_pan_enabled && arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO )
#else
        if ( ( arg->Opt_non_diegetic_pan ) && ( arg->outputConfig != IVAS_AUDIO_CONFIG_STEREO ) )
#endif
        {
            fprintf( stderr, "Error: non-diegetic panning is supported in stereo only\n\n" );
            usage_dec();
@@ -1493,7 +1539,12 @@ static bool parseCmdlIVAS_dec(
    {
        arg->outputConfig = IVAS_AUDIO_CONFIG_MONO;
        arg->decMode = IVAS_DEC_MODE_EVS;

#ifdef FIX_745_FIX_DATA_TYPE_CONVERSION
        if ( arg->non_diegetic_pan_enabled )
#else
        if ( ( arg->Opt_non_diegetic_pan ) )
#endif
        {
            arg->outputConfig = IVAS_AUDIO_CONFIG_STEREO;
        }
+48 −49
Original line number Diff line number Diff line
@@ -6198,7 +6198,7 @@ ivas_error ivas_core_enc_fx(
    const Word16 n_CoreChannels,                                /* i  : number of core channels to be coded     Q0*/
    Word16 old_inp_12k8_fx[][L_INP_12k8],                       /* i  : buffer of old input signal              Q_new-1*/
    Word16 old_inp_16k_fx[][L_INP],                             /* i  : buffer of old input signal              Q_new-1*/
    Word16 Q_new[],
    Word16 Q_new[],                                             /* i  : Q factor of speech buffers              */
    Word32 ener_fx[],                                           /* i  : residual energy from Levinson-Durbin	epsP_fx_q*/
    Word16 A_fx[][NB_SUBFR16k * ( M + 1 )],                     /* i  : A(z) unquantized for the 4 subframes    Q12*/
    Word16 Aw_fx[][NB_SUBFR16k * ( M + 1 )],                    /* i  : weighted A(z) unquantized for subframes Q12*/
@@ -6210,9 +6210,9 @@ ivas_error ivas_core_enc_fx(
    Word16 attack_flag[],                                       /* i  : attack flag (GSC or TC)                 Q0*/
    Word32 realBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: real buffer                        q_re_im_buf*/
    Word32 imagBuffer_fx[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* i/o: imag buffer                        q_re_im_buf*/
    Word16 *q_re_im_buf,
    Word16 *q_re_im_buf,                                        /* i  : Q factor of re/in CLDFB buffers         */
    Word16 old_wsp_fx[][L_WSP],                                 /* i  : weighted input signal buffer            e_old_wsp*/
    Word16 e_old_wsp[],
    Word16 e_old_wsp[],                                         /* i  : Q factor of old_wsp buffer              */
    const Word16 loc_harm[],                                    /* i  : harmonicity flag						Q0*/
    const Word16 cor_map_sum_fx[],                              /* i  : speech/music clasif. parameter			Q8*/
    const Word16 vad_flag_dtx[],                                /* i  : HE-SAD flag with additional DTX HO		Q0*/
@@ -6308,12 +6308,11 @@ ivas_error ivas_ism_metadata_enc_create_fx(
    Word32 element_brate_tmp[]                                  /* o  : element bitrate per object                  */
);


/*----------------------------------------------------------------------------------*
 * Parametric ISM prototypes
 *----------------------------------------------------------------------------------*/

/*! r: ISM format mode */

ivas_error ivas_param_ism_enc_open_fx(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                      */
);
@@ -6328,11 +6327,11 @@ void ivas_ism_metadata_close(
    const Word16 first_idx                                      /* i  : index of first handle to deallocate         */
);


ivas_error ivas_ism_enc_config(
    Encoder_Struct *st_ivas                                     /* i/o: IVAS encoder structure                      */
);


/*----------------------------------------------------------------------------------*
 * ISM DTX prototypes
 *----------------------------------------------------------------------------------*/
+26 −2
Original line number Diff line number Diff line
@@ -90,6 +90,24 @@

#define FIX_1931_BIN_COHR_CROSS_MIX                    /* FhG: correct binauralCoherenceCrossmixGains_fx calculation */
#define FIX_1939_REVERB_DMX_OUT_Q                       /*Dlb: output correct q factor for the reverb dmx function*/

#define EVS_BE_REUSAGE
#ifdef EVS_BE_REUSAGE
#define REUSE_EVS_BE_ACELP_LP_FILT
#define REUSE_EVS_BE_ACELP_4T64
#define REUSE_EVS_BE_ACELP_2t32
#define REUSE_EVS_BE_ACELP_1t64
#define REUSE_EVS_BE_ACELP_AVQ
#define REUSE_EVS_BE_GAUSS          
#define REUSE_EVS_BE_GAINQ          
#define REUSE_EVS_BE_ACELP_PITCH
#define REUSE_EVS_BE_ACELP_PITCH_PIT_Q
#define REUSE_EVS_BE_GAINQ_LBR   // BE by adding one condition, but could be harmonized in a non-BE way. There is a small difference in how Etot is computed

#endif
#define FIX_ISSUE_1817_REPLACE_CARRY_OVERFLOW  /* FhG: bit-exact, replace carry and overflow operations by 64-bit operations, MR 1931 */
#define FIX_1844_MISSING_FREE                                /* FhG: add missing free in ivas_binRenderer_convModuleClose_fx() */

/* #################### Start BASOP porting switches ############################ */

#define FIX_1372_ISAR_POST_REND
@@ -122,6 +140,7 @@
#define NONBE_FIX_1128_OSBA_EXT_OUTPUT_ORDER            /* FhG: issue 1128: set output ambisonics order to input order for EXT output  */
#define FIX_1138_SBA_EXT_ERROR_PRINTOUT                 /* VA: issue 1138: Fix SBA EXT output call of audioCfg2channels() */
#define NONBE_1244_FIX_SWB_BWE_MEMORY                   /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */
#define FIX_745_FIX_DATA_TYPE_CONVERSION                /* VA: issue 745: implicit data type conversion when calling IVAS_DEC_Configure() */
#define NONBE_FIX_981_PARAMBIN_DEFAULT_EARLY_PART       /* Nokia: Set default early part energy correction to unity for BINAURAL_ROOM_REVERB */
#define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR            /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */
#define FIX_587_DEFAULT_REVERB                          /* Philips: issue 587: inconsistent default reverb parameters across renderers */
@@ -138,13 +157,18 @@
#define NONBE_1229_FIX_ISM1_DPID                        /* Eri: issue 1229: fix bug causing ISM 1 to use default -dpid instead of the specified one */
#define FIX_1135_EXT_RENDERER_HANDLES                   /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */
#define FIX_1209_SID_SIGNALING                          /* VA: issue 1209: remove dead code in IVAS SID signaling */
#define NONBE_1250_MCMASA_LS_OUTPUT                     /* VA: issue 1250: fix crash in McMASA to custom LS output decoding */
#define NONBE_FIX_1176_OSBA_REVERB_JBM_ASAN_ERROR       /* Ericsson: Issue 1176, fix in TDREND_firfilt for subframes shorter than the filter length */
#define NONBE_1131_ACELP_OOB                            /* VA: issue 1131: fix division-by-zero in acelp gain decoding caused by wrong length of buffer update when switching from HQ core to ACELP core */
#define NONBE_1240_FIX_CORE_SELECTION_ISM_SW            /* VA: issue 1240: Remove the forcing of the TCX core in ISM when switching from a high bitarte to a low one */
#define FIX_1101_CLEANING_JBM_CALL                      /* VA: issue 1101: remove obsolete call of ivas_jbm_dec_tc_buffer_open() */
#define FIX_VOIP_FUNCTIONS                              /* VA: fix data type mismatch in IVAS_DEC_VoIP_SetScale() + add sanity checks to API functions */
#define FIX_1298_MEMORY_OPT_IVAS_CORE_ENC               /* VA: issue 1298: Memory saving in ivas_core_enc() */
#define NONBE_FIX_1337_MISSING_DIRECTIVITY_DISTATT_EXTREND /* Eri: issue 1337: Missing directivity setting and distance attenuation in external renderer IVAS_rend */
#define NONBE_1214_PLC_LSF_MEMORY                       /* VA: issue 1224: reset ACELP PLC FEC memory in case of switching from MDCT stereo to TD/DFT stereo */
#define NONBE_1293_SR_HRTF                              /* VA: issue 1293: add support of external HRTFs in split rendering */
#define NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH             /* VA: issue 1220: fix bug in renderer flush in OMASA 1ISM JBM bitrate switching */
#define FIX_1139_REV_COLORATION_SHORT_T60               /* Nokia,FhG: Fix issue 1139, prevent sound coloration artefacts at very low reverberation times */

/* #################### End BASOP porting switches ############################ */

+4 −0
Original line number Diff line number Diff line
@@ -1380,7 +1380,11 @@ ivas_error ivas_binRenderer_open_fx(
        {
            pRoomAcoustics = &( st_ivas->hRenderConfig->roomAcoustics );
        }
#ifdef FIX_1139_REV_COLORATION_SHORT_T60
        IF( NE_32( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, pRoomAcoustics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx, NULL ) ), IVAS_ERR_OK ) )
#else
        IF( NE_32( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, pRoomAcoustics, st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) )
#endif
#else
        IF( NE_32( ( error = ivas_binaural_reverb_init( &( hBinRenderer->hReverb ), st_ivas->hHrtfStatistics, hBinRenderer->conv_band, hBinRenderer->timeSlots, &( st_ivas->hRenderConfig->roomAcoustics ), st_ivas->hDecoderConfig->output_Fs, st_ivas->hHrtfFastConv->fastconvReverberationTimes_fx, st_ivas->hHrtfFastConv->fastconvReverberationEneCorrections_fx ) ), IVAS_ERR_OK ) )
#endif
+8 −0
Original line number Diff line number Diff line
@@ -4006,7 +4006,15 @@ void ivas_dirac_dec_render_sf_fx(

            /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */
            Copy32( &( output_buf_fx[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated_fx, num_samples_subframe );
#ifdef NONBE_1250_MCMASA_LS_OUTPUT
            if ( hDirACRend->hOutSetup.num_lfe > 0 )
            {
                Copy32( &( output_buf_fx[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe_fx, num_samples_subframe );
            }
#else
            Copy32( &( output_buf_fx[LFE_CHANNEL][subframe_start_sample] ), tmp_lfe_fx, num_samples_subframe );
#endif

            FOR( ch = 0; ch < outchannels; ch++ )
            {

Loading