Commit 770aec77 authored by Fabian Bauer's avatar Fabian Bauer
Browse files

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into...

Merge branch 'main' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into 1867-replace-overflow-basop-operators-by-overflow-free-variants-in-lib_enc
parents 22b17f18 6835cac6
Loading
Loading
Loading
Loading
Loading
+47 −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;
@@ -385,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;
@@ -407,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 )
@@ -488,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;
@@ -972,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;
@@ -1244,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 );
@@ -1400,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 )
@@ -1480,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();
@@ -1497,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;
        }
+3 −1
Original line number Diff line number Diff line
@@ -123,6 +123,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 */
@@ -147,6 +148,7 @@
#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 */

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

+12 −1
Original line number Diff line number Diff line
@@ -2688,7 +2688,7 @@ ivas_error ivas_jbm_dec_render_fx(
}

/*--------------------------------------------------------------------------*
 * ivas_jbm_dec_dec_flush_renderer()
 * ivas_jbm_dec_flush_renderer()
 *
 * Flush samples if renderer granularity changes on a bitrate change
 *--------------------------------------------------------------------------*/
@@ -2887,7 +2887,11 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
        {
            IF( EQ_16( ism_mode_old, ISM_MASA_MODE_DISC ) )
            {
#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
                Word32 *tc_local_fx[MAX_NUM_OBJECTS];
#else
                Word32 *tc_local_fx[MAX_TRANSPORT_CHANNELS];
#endif

                move16();
                FOR( ch_idx = 0; ch_idx < st_ivas->nchan_ism; ch_idx++ )
@@ -2896,6 +2900,12 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                    Copy32( st_ivas->hMasaIsmData->delayBuffer_fx[ch_idx], tc_local_fx[ch_idx], st_ivas->hMasaIsmData->delayBuffer_size ); /*Q11*/
                }

#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
                IF( NE_32( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, hTcBuffer->n_samples_granularity ) ), IVAS_ERR_OK ) )
                {
                    return error;
                }
#else
                IF( st_ivas->nchan_ism > 0 )
                {
                    IF( NE_32( ( error = ivas_td_binaural_renderer_sf_fx( st_ivas, p_output_fx, hTcBuffer->n_samples_granularity ) ), IVAS_ERR_OK ) )
@@ -2914,6 +2924,7 @@ ivas_error ivas_jbm_dec_flush_renderer_fx(
                    move16();
                    move16();
                }
#endif
            }
        }
        ELSE IF( EQ_16( st_ivas->ivas_format, SBA_ISM_FORMAT ) )
+6 −0
Original line number Diff line number Diff line
@@ -100,7 +100,13 @@ ivas_error ivas_td_binaural_renderer_sf_fx(
    Word16 enableCombinedOrientation;

    /* Set the number of ISMs */
#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
    test();
    test();
    IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) || ( EQ_32( st_ivas->ivas_format, MASA_FORMAT ) && GT_16( st_ivas->nchan_ism, 0 ) ) )
#else
    IF( EQ_32( st_ivas->ivas_format, MASA_ISM_FORMAT ) )
#endif
    {
        nchan_ism_internal = st_ivas->nchan_ism;
        move16();
+11 −2
Original line number Diff line number Diff line
@@ -1233,17 +1233,24 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx(
)
{
    Word16 n;
    move16();
    ivas_error error;
#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
    Word32 *p_sepobj_fx[BINAURAL_CHANNELS]; // Q11
    Word32 data_separated_objects_fx[BINAURAL_CHANNELS][L_FRAME48k];
#else
    Word32 *p_sepobj_fx[MAX_NUM_OBJECTS]; // Q11
    Word32 data_separated_objects_fx[MAX_NUM_OBJECTS][L_FRAME48k];
    move16();
#endif
    Word16 slot_idx_start;

    slot_idx_start = st_ivas->hSpatParamRendCom->slots_rendered;
    move16();

#ifdef NONBE_1220_OMASA_JBM_BRATE_SW_FLUSH
    FOR( n = 0; n < BINAURAL_CHANNELS; n++ )
#else
    FOR( n = 0; n < MAX_NUM_OBJECTS; n++ )
#endif
    {
        p_sepobj_fx[n] = &data_separated_objects_fx[n][0];
    }
@@ -1281,6 +1288,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx(
        {
            return error;
        }

        st_ivas->nchan_transport = nchan_transport_orig;
        move16();
        cldfb_slots = *nSamplesRendered / num_cldfb_bands;
@@ -1321,6 +1329,7 @@ ivas_error ivas_omasa_dirac_td_binaural_jbm_fx(
    return IVAS_ERR_OK;
}


/*--------------------------------------------------------------------------*
 * ivas_omasa_rearrange_channels()
 *
Loading