Commit 63853c15 authored by Archit Tamarapu's avatar Archit Tamarapu
Browse files

Merge branch 'ivas-float-update' of...

Merge branch 'ivas-float-update' of ssh://forge.3gpp.org:29419/sa4/audio/ivas-basop into lc3plus-v161-update-ivas-float-update
parents ad2fff07 31073441
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -70,6 +70,10 @@
#define IVAS_MAX16B_FLT 32767.0f
#define IVAS_MIN16B_FLT ( -32768.0f )

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
#define OMASA_TDREND_MATCHING_GAIN_DB ( -2.0f )
#endif

#if !defined( DEBUGGING ) && !defined( WMOPS )
static
#endif
@@ -1170,20 +1174,39 @@ int main(
        }
    }

#ifndef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
    /* Set the total number of objects */
#endif
    if ( args.inConfig.numAudioObjects > 0 )
    {
#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
        /* Set the total number of objects */
#endif
        if ( ( error = IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }

#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS
        /* Set the metadata delay for objects */
#endif
        if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK )
        {
            fprintf( stderr, "\nError in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) );
            goto cleanup;
        }
#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS

        /* For OMASA input and BINAURAL output, apply a gain to objects to match the loudness with MASA part */
        if ( args.inConfig.numMasaBuses > 0 && args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL )
        {
            for ( i = 0; i < args.inConfig.numAudioObjects; ++i )
            {
                args.inConfig.audioObjects[i].gain_dB += OMASA_TDREND_MATCHING_GAIN_DB;
            }
        }
#endif
    }

    IVAS_REND_LfePanMtx lfePanMatrix;
+4 −0
Original line number Diff line number Diff line
@@ -185,9 +185,13 @@
#define FIX_NCHAN_BUFFERS                               /* VA: issue 1322: Correct the number of float buffers (channels) at the decoder */
#define FIX_RENDERER_STACK                              /* VA: issue 1322: reduction of renderers' buffers size */
#define JBM_MEMORY_OPT                                  /* VA: issue 916: optimization of RAM in the JBM decoder */
/*#define NONBE_1324_TC_BUFFER_MEMOERY_KEEP*/           /* VA: issue 1324: do not reset TSM memory in JBM bitrate switching */
#define FIX_1370_EXTERNAL_ORIENTATION_CHECK             /* Nokia: add sanity check for Euler angles for external orientations */
#define FIX_1413_IGF_INIT_PRINTOUT                      /* FhG: use correct variable for IGF initiliazation */
#define CODE_IMPROVEMENTS
#define NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Nokia: issue 1339: Apply scaling to the object-part of OMASA for binaural rendering in IVAS_rend. */
#define NONBE_1362_FIX_OMASA_TO_MASA1_RENDERING         /* Nokia: Fix OMASA to MASA1 rendering in IVAS_rend */
#define FIX_1383_HEAD_TRACK_SANITIZER                   /* Nok: issue 1383: Fix head tracking struc values reading in renderer */


// object-editing feature porting
+32 −1
Original line number Diff line number Diff line
@@ -2422,7 +2422,10 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    const int16_t n_samples_granularity     /* i  : new granularity of the renderer/buffer  */
)
{

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    int16_t ch_idx, num_tc_buffer_mem, n_samples_still_available;
    float tc_buffer_mem[MAX_INTERN_CHANNELS][L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES - 1];
#endif
#ifdef JBM_MEMORY_OPT
    ivas_error error;
#else
@@ -2433,6 +2436,26 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(

    hTcBuffer = st_ivas->hTcBuffer;

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    num_tc_buffer_mem = 0;
    n_samples_still_available = 0;

    if ( st_ivas->hDecoderConfig->Opt_tsm )
    {
        /* save samples of the TC buffer from the previous frame */
        num_tc_buffer_mem = min( hTcBuffer->nchan_transport_internal, nchan_transport_internal );
        n_samples_still_available = hTcBuffer->n_samples_buffered - hTcBuffer->n_samples_rendered;

        /* what is remaining from last frame needs always be smaller than the new granularity */
        assert( n_samples_still_available < n_samples_granularity );

        for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ )
        {
            mvr2r( hTcBuffer->tc_buffer_old[ch_idx] + hTcBuffer->n_samples_flushed, tc_buffer_mem[ch_idx], n_samples_still_available );
        }
    }

#endif
    /* if granularity changes, adapt subframe_nb_slots */
    if ( n_samples_granularity != hTcBuffer->n_samples_granularity )
    {
@@ -2550,6 +2573,14 @@ ivas_error ivas_jbm_dec_tc_buffer_reconfigure(
    }
#endif

#ifdef NONBE_1324_TC_BUFFER_MEMOERY_KEEP
    /* propagate samples of the TC buffer from the previous frame */
    for ( ch_idx = 0; ch_idx < num_tc_buffer_mem; ch_idx++ )
    {
        mvr2r( tc_buffer_mem[ch_idx], hTcBuffer->tc_buffer_old[ch_idx], n_samples_still_available );
    }

#endif
    return IVAS_ERR_OK;
}

+29 −0
Original line number Diff line number Diff line
@@ -489,6 +489,13 @@ static void ivas_omasa_dmx(
    }

    for ( i = 0; i < nchan_ism; i++ )
    {
#ifdef NONBE_1362_FIX_OMASA_TO_MASA1_RENDERING
        if ( nchan_transport == 1 )
        {
            v_add( data_out_f[0], data_in_f[i], data_out_f[0], input_frame );
        }
        else
        {
            azimuth = ism_azimuth[i];
            elevation = ism_elevation[i];
@@ -510,6 +517,28 @@ static void ivas_omasa_dmx(
                prev_gains[i][j] = gains[j];
            }
        }
#else
        azimuth = ism_azimuth[i];
        elevation = ism_elevation[i];

        ivas_ism_get_stereo_gains( azimuth, elevation, &gains[0], &gains[1] );

        /* Downmix using the panning gains */
        for ( j = 0; j < nchan_transport; j++ )
        {
            if ( fabsf( gains[j] ) > 0.0 || fabsf( prev_gains[i][j] ) > 0.0f )
            {
                for ( k = 0; k < input_frame; k++ )
                {
                    g1 = interpolator[k];
                    g2 = 1.0f - g1;
                    data_out_f[j][k] += ( g1 * gains[j] + g2 * prev_gains[i][j] ) * data_in_f[i][k];
                }
            }
            prev_gains[i][j] = gains[j];
        }
#endif
    }

    for ( i = 0; i < nchan_transport; i++ )
    {
+7 −0
Original line number Diff line number Diff line
@@ -906,6 +906,12 @@ ivas_error combine_external_and_head_orientations_rend(
    int16_t i;

    sr_pose_pred_axis = DEFAULT_AXIS;
#ifdef FIX_1383_HEAD_TRACK_SANITIZER
    if ( hHeadTrackData->headRotEnabled )
    {
        headRotQuaternions = hHeadTrackData->headPositions;
        listenerPos = hHeadTrackData->Pos;
#else
    if ( hHeadTrackData != NULL )
    {
        if ( hHeadTrackData->headRotEnabled )
@@ -913,6 +919,7 @@ ivas_error combine_external_and_head_orientations_rend(
            headRotQuaternions = hHeadTrackData->headPositions;
            listenerPos = hHeadTrackData->Pos;
        }
#endif
        sr_pose_pred_axis = hHeadTrackData->sr_pose_pred_axis;
    }
    else if ( hExtOrientationData != NULL )