Commit 74ddabd8 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into...

Merge remote-tracking branch 'remotes/origin/main' into 880-functions-renaming-after-nonbe_unified_decoding_paths
parents 9d4fa55b a99e7d89
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -881,15 +881,14 @@ void ivas_dec_get_md_map(
int16_t ivas_dec_get_num_tc_channels( 
int16_t ivas_dec_get_num_tc_channels( 
    Decoder_Struct *st_ivas                                     /* i  : IVAS decoder handle                                         */
    Decoder_Struct *st_ivas                                     /* i  : IVAS decoder handle                                         */
);
);

#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
void ivas_jbm_dec_copy_tc_no_tsm( 
void ivas_jbm_dec_copy_tc_no_tsm( 
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                                         */
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                                         */
    float *tc[],                                                /* i  : transport channels                                          */
    float *tc[],                                                /* i  : transport channels                                          */
    const int16_t output_frame                                  /* i  : output frame size                                           */
    const int16_t output_frame                                  /* i  : output frame size                                           */
);
);

#endif
#endif

void ivas_dec_get_md_map_even_spacing(
void ivas_dec_get_md_map_even_spacing(
    const int16_t len,                                          /* i  : length of the modefied frames in metadata slots             */
    const int16_t len,                                          /* i  : length of the modefied frames in metadata slots             */
    const int16_t subframe_len,                                 /* i  : default length of a subframe                                */
    const int16_t subframe_len,                                 /* i  : default length of a subframe                                */
@@ -1148,9 +1147,8 @@ void ivas_ism_param_dec_tc_gain_ajust(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    const uint16_t nSamples,                                    /* i  : number of samples to be compensate          */
    const uint16_t nSamples,                                    /* i  : number of samples to be compensate          */
    const uint16_t nFadeLength,                                 /* i  : length of the crossfade in samples          */
    const uint16_t nFadeLength,                                 /* i  : length of the crossfade in samples          */
    float *transport_channels_f[]                               /* i  : synthesized core-coder transport channels/DirAC output  */
    float *p_data_f[]                                           /* i  : synthesized core-coder transport channels/DirAC output  */
);
);

#endif
#endif
void ivas_param_ism_dec_render(
void ivas_param_ism_dec_render(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder handle                         */
+2 −2
Original line number Original line Diff line number Diff line
@@ -160,7 +160,7 @@


/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
/*#define FIX_I4_OL_PITCH*/                             /* fix open-loop pitch used for EVS core switching */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP               /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
#define UNIFIED_DECODING_PATHS_LEFTOVERS                /* VA: issue 880: remove leftovers ater NONBE_UNIFIED_DECODING_PATHS */
#define UNIFIED_DECODING_PATHS_LEFTOVERS                /* VA: issue 880: remove leftovers after NONBE_UNIFIED_DECODING_PATHS */




/* #################### End BE switches ################################## */
/* #################### End BE switches ################################## */
@@ -172,7 +172,7 @@


#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 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 NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */
#define NONBE_1122_KEEP_EVS_MODE_UNCHANGED              /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR.  */

#define NONBE_1300_TDREND_LARGE_ITD                     /* Eri: issue 1300: There was a bug feeding 1.25 ms frames to the TD renderer, causing out-of-buffer access. This was resolved. However, it is still possible that modeled HRTF with large ITDs could trigger out-of-buffer access. This adds a check to prevent this.*/


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


+57 −71
Original line number Original line Diff line number Diff line
@@ -53,7 +53,6 @@
static void ivas_ism_param_dec_tc_gain_adjust( Decoder_Struct *st_ivas, const int16_t nSamples, const int16_t nFadeLength, float *p_data_f[] );
static void ivas_ism_param_dec_tc_gain_adjust( Decoder_Struct *st_ivas, const int16_t nSamples, const int16_t nFadeLength, float *p_data_f[] );


#endif
#endif

/*-----------------------------------------------------------------------*
/*-----------------------------------------------------------------------*
 * Local function definitions
 * Local function definitions
 *-----------------------------------------------------------------------*/
 *-----------------------------------------------------------------------*/
@@ -572,16 +571,16 @@ ivas_error ivas_param_ism_dec_open(
            {
            {
                n_slots_to_alloc = CLDFB_SLOTS_PER_SUBFRAME * MAX_PARAM_SPATIAL_SUBFRAMES;
                n_slots_to_alloc = CLDFB_SLOTS_PER_SUBFRAME * MAX_PARAM_SPATIAL_SUBFRAMES;
            }
            }

            if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL )
            if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL )

            {
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM Rendering handle\n" ) );
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) );
            }
            }
            set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands );
            set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands );


            if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL )
            if ( ( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc = (float *) malloc( n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands * sizeof( float ) ) ) == NULL )
            {
            {
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for ParamISM Rendering handle\n" ) );
                return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Param ISM JBM Rendering handle\n" ) );
            }
            }
            set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands );
            set_zero( hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc, n_slots_to_alloc * nchan_transport * hSpatParamRendCom->num_freq_bands );
        }
        }
@@ -715,6 +714,7 @@ void ivas_ism_dec_digest_tc(
        int16_t azimuth, elevation;
        int16_t azimuth, elevation;


        /* we have a full frame interpolator, adapt it */
        /* we have a full frame interpolator, adapt it */
        /* for BE testing */
        if ( ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) == st_ivas->hTcBuffer->n_samples_available )
        if ( ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ) == st_ivas->hTcBuffer->n_samples_available )
        {
        {
            int16_t interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
            int16_t interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC );
@@ -798,59 +798,34 @@ void ivas_ism_dec_digest_tc(
 *
 *
 *-------------------------------------------------------------------------*/
 *-------------------------------------------------------------------------*/


#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
void ivas_param_ism_dec_digest_tc(
void ivas_param_ism_dec_digest_tc(
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder handle                                       */
    Decoder_Struct *st_ivas,    /* i/o: IVAS decoder handle                                       */
    const uint16_t nCldfbSlots, /* i  : number of CLDFB slots in transport channels               */
    const uint16_t nCldfbSlots, /* i  : number of CLDFB slots in transport channels               */
    float *p_data_f[]           /* i/o: synthesized core-coder transport channels/DirAC output    */
    float *p_data_f[]           /* i/o: synthesized core-coder transport channels/DirAC output    */
)
)
{
{
    int16_t ch, num_freq_bands, slot_idx, cldfb_ch, n_ch_cldfb;
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    int16_t ch, slot_idx, output_frame;
    int16_t num_freq_bands, cldfb_ch, n_ch_cldfb;
    float *cldfb_real_buffer, *cldfb_imag_buffer;
#else
    int16_t ch, nchan_transport;
    int16_t slot_idx;
    int16_t output_frame;
    int16_t output_frame;
    float *cldfb_real_buffer;
    PARAM_ISM_DEC_HANDLE hParamIsmDec;
    float *cldfb_imag_buffer;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
    int16_t fade_len;
#endif


    /* Initialization */
    /* Initialization */
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands;
    num_freq_bands = st_ivas->hSpatParamRendCom->num_freq_bands;
    output_frame = nCldfbSlots * num_freq_bands;
    output_frame = nCldfbSlots * num_freq_bands;
    n_ch_cldfb = st_ivas->hTcBuffer->nchan_transport_rend - st_ivas->hTcBuffer->nchan_buffer_full;
    n_ch_cldfb = st_ivas->hTcBuffer->nchan_transport_rend - st_ivas->hTcBuffer->nchan_buffer_full;


    cldfb_real_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc;
    cldfb_real_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc;
    cldfb_imag_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc;
    cldfb_imag_buffer = st_ivas->hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc;

    /* Adjust TCs energy */
    ivas_ism_param_dec_tc_gain_adjust( st_ivas, output_frame, output_frame / 2, p_data_f );

    /* CLDFB Analysis */
    for ( ch = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch++ )
    {
        for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ )
        {
            cldfbAnalysis_ts( &( p_data_f[ch][num_freq_bands * slot_idx] ),
                              &cldfb_real_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands],
                              &cldfb_imag_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands],
                              num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] );
        }
    }

    return;
}
#else
#else
void ivas_param_ism_dec_digest_tc(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder handle                                       */
    const uint16_t nCldfbSlots,   /* i  : number of CLDFB slots in transport channels               */
    float *transport_channels_f[] /* i/o: synthesized core-coder transport channels/DirAC output    */
)
{

    int16_t ch, nchan_transport;
    int16_t slot_idx;
    int16_t output_frame;
    PARAM_ISM_DEC_HANDLE hParamIsmDec;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
    int16_t fade_len;

    /* Initialization */
    hParamIsmDec = st_ivas->hParamIsmDec;
    hParamIsmDec = st_ivas->hParamIsmDec;
    assert( hParamIsmDec );
    assert( hParamIsmDec );
    hSpatParamRendCom = st_ivas->hSpatParamRendCom;
    hSpatParamRendCom = st_ivas->hSpatParamRendCom;
@@ -859,15 +834,31 @@ void ivas_param_ism_dec_digest_tc(
    fade_len = output_frame / 2;
    fade_len = output_frame / 2;


    nchan_transport = st_ivas->nchan_transport;
    nchan_transport = st_ivas->nchan_transport;
#endif


    push_wmops( "ivas_param_ism_dec_digest_tc" );
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS

    ivas_ism_param_dec_tc_gain_adjust( st_ivas, output_frame, output_frame / 2, p_data_f );
#else
    if ( st_ivas->hDecoderConfig->Opt_tsm )
    if ( st_ivas->hDecoderConfig->Opt_tsm )
    {
    {
        /*TODO : FhG to check*/
        /*TODO : FhG to check*/
        ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, fade_len, transport_channels_f );
        ivas_ism_param_dec_tc_gain_ajust( st_ivas, output_frame, fade_len, p_data_f );
    }
    }
#endif


#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    /* CLDFB Analysis */
    for ( ch = 0, cldfb_ch = 0; cldfb_ch < n_ch_cldfb; cldfb_ch++, ch++ )
    {
        for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ )
        {
            cldfbAnalysis_ts( &( p_data_f[ch][num_freq_bands * slot_idx] ),
                              &cldfb_real_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands],
                              &cldfb_imag_buffer[slot_idx * num_freq_bands * n_ch_cldfb + cldfb_ch * num_freq_bands],
                              num_freq_bands, st_ivas->cldfbAnaDec[cldfb_ch] );
        }
    }
#else
    for ( ch = 0; ch < nchan_transport; ch++ )
    for ( ch = 0; ch < nchan_transport; ch++ )
    {
    {
        /* CLDFB Analysis */
        /* CLDFB Analysis */
@@ -878,18 +869,16 @@ void ivas_param_ism_dec_digest_tc(
                float RealBuffer[CLDFB_NO_CHANNELS_MAX];
                float RealBuffer[CLDFB_NO_CHANNELS_MAX];
                float ImagBuffer[CLDFB_NO_CHANNELS_MAX];
                float ImagBuffer[CLDFB_NO_CHANNELS_MAX];


                cldfbAnalysis_ts( &( transport_channels_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] );
                cldfbAnalysis_ts( &( p_data_f[ch][hSpatParamRendCom->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hSpatParamRendCom->num_freq_bands, st_ivas->cldfbAnaDec[ch] );
                mvr2r( RealBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands );
                mvr2r( RealBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_RealBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands );
                mvr2r( ImagBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands );
                mvr2r( ImagBuffer, &hParamIsmDec->hParamIsmRendering->Cldfb_ImagBuffer_tc[slot_idx * hSpatParamRendCom->num_freq_bands * nchan_transport + ch * hSpatParamRendCom->num_freq_bands], hSpatParamRendCom->num_freq_bands );
            }
            }
        }
        }
    }
    }

#endif
    pop_wmops();


    return;
    return;
}
}
#endif




/*-------------------------------------------------------------------------*
/*-------------------------------------------------------------------------*
@@ -958,8 +947,6 @@ void ivas_param_ism_dec_prepare_renderer(
        nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
        nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
    }
    }


    push_wmops( "ivas_param_ism_dec_digest_tc" );

    /* general setup */
    /* general setup */
    ivas_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hParamIsmDec->hParamIsmRendering->interpolator );
    ivas_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, nCldfbSlots, hParamIsmDec->hParamIsmRendering->interpolator );


@@ -1040,8 +1027,6 @@ void ivas_param_ism_dec_prepare_renderer(
    /* Compute mixing matrix */
    /* Compute mixing matrix */
    ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, hParamIsmDec->hParamIsmRendering->mixing_matrix_lin );
    ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hParamIsmDec, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, hParamIsmDec->hParamIsmRendering->mixing_matrix_lin );


    pop_wmops();

    return;
    return;
}
}


@@ -1049,24 +1034,25 @@ void ivas_param_ism_dec_prepare_renderer(
/*-------------------------------------------------------------------------*
/*-------------------------------------------------------------------------*
 * ivas_ism_param_dec_tc_gain_adjust()
 * ivas_ism_param_dec_tc_gain_adjust()
 *
 *
 * Adjust TCs energy
 *
 *-------------------------------------------------------------------------*/
 *-------------------------------------------------------------------------*/


#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
static void ivas_ism_param_dec_tc_gain_adjust(
static void ivas_ism_param_dec_tc_gain_adjust(
    Decoder_Struct *st_ivas,      /* i/o: IVAS decoder handle                                   */
    const int16_t nSamples,       /* i  : number of samples to be compensated                   */
    const int16_t nFadeLength,    /* i  : length of the crossfade in samples                    */
    float *transport_channels_f[] /* i  : synthesized core-coder transport channels/DirAC output*/
)
#else
#else
void ivas_ism_param_dec_tc_gain_ajust(
void ivas_ism_param_dec_tc_gain_ajust(
#endif
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle                                   */
    Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle                                   */
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
    const int16_t nSamples,    /* i  : number of samples to be compensate                    */
    const int16_t nFadeLength, /* i  : length of the crossfade in samples                    */
#else
    const uint16_t nSamples,    /* i  : number of samples to be compensate                    */
    const uint16_t nSamples,    /* i  : number of samples to be compensate                    */
    const uint16_t nFadeLength, /* i  : length of the crossfade in samples                    */
    const uint16_t nFadeLength, /* i  : length of the crossfade in samples                    */
    float *transport_channels_f[] /* i  : synthesized core-coder transport channels/DirAC output*/
)
#endif
#endif
    float *p_data_f[] /* i  : synthesized core-coder transport channels/DirAC output*/
)

{
{
    int16_t i;
    int16_t i;
    float gain, ene_tc, ene_sum, grad;
    float gain, ene_tc, ene_sum, grad;
@@ -1078,8 +1064,8 @@ void ivas_ism_param_dec_tc_gain_ajust(


    for ( i = 0; i < nSamples; i++ )
    for ( i = 0; i < nSamples; i++ )
    {
    {
        ene_tc += transport_channels_f[0][i] * transport_channels_f[0][i] + transport_channels_f[1][i] * transport_channels_f[1][i];          /* L*L + R*R */
        ene_tc += p_data_f[0][i] * p_data_f[0][i] + p_data_f[1][i] * p_data_f[1][i];          /* L*L + R*R */
        ene_sum += ( transport_channels_f[0][i] + transport_channels_f[1][i] ) * ( transport_channels_f[0][i] + transport_channels_f[1][i] ); /* (L+R)*(L+R) */
        ene_sum += ( p_data_f[0][i] + p_data_f[1][i] ) * ( p_data_f[0][i] + p_data_f[1][i] ); /* (L+R)*(L+R) */
    }
    }
    gain = sqrtf( ene_tc / ( ene_sum + EPSILON ) );
    gain = sqrtf( ene_tc / ( ene_sum + EPSILON ) );
    if ( st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame > 1 )
    if ( st_ivas->hSCE[0]->hCoreCoder[0]->ini_frame > 1 )
@@ -1090,21 +1076,21 @@ void ivas_ism_param_dec_tc_gain_ajust(
        grad = ( gain - last_gain ) / (float) nFadeLength; /* slope between two consecutive gains, 480 samples length */
        grad = ( gain - last_gain ) / (float) nFadeLength; /* slope between two consecutive gains, 480 samples length */
        for ( i = 0; i < ( nFadeLength ); i++ )
        for ( i = 0; i < ( nFadeLength ); i++ )
        {
        {
            transport_channels_f[0][i] *= ( last_gain + i * grad );
            p_data_f[0][i] *= ( last_gain + i * grad );
            transport_channels_f[1][i] *= ( last_gain + i * grad );
            p_data_f[1][i] *= ( last_gain + i * grad );
        }
        }
        for ( ; i < nSamples; i++ )
        for ( ; i < nSamples; i++ )
        {
        {
            transport_channels_f[0][i] *= gain;
            p_data_f[0][i] *= gain;
            transport_channels_f[1][i] *= gain;
            p_data_f[1][i] *= gain;
        }
        }
    }
    }
    else
    else
    {
    {
        for ( i = 0; i < nSamples; i++ )
        for ( i = 0; i < nSamples; i++ )
        {
        {
            transport_channels_f[0][i] *= gain;
            p_data_f[0][i] *= gain;
            transport_channels_f[1][i] *= gain;
            p_data_f[1][i] *= gain;
        }
        }
    }
    }


+46 −15
Original line number Original line Diff line number Diff line
@@ -52,8 +52,8 @@


#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *data, float *tc_digest_f[] );
static void ivas_jbm_dec_copy_tc( Decoder_Struct *st_ivas, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *data, float *tc_digest_f[] );

#endif
#endif

static void ivas_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, uint16_t *nSamplesRendered, float *output[] );
static void ivas_dec_tc_buffer_playout( Decoder_Struct *st_ivas, const uint16_t nSamplesAsked, uint16_t *nSamplesRendered, float *output[] );


static void ivas_jbm_dec_copy_masa_meta_to_buffer( Decoder_Struct *st_ivas );
static void ivas_jbm_dec_copy_masa_meta_to_buffer( Decoder_Struct *st_ivas );
@@ -95,6 +95,7 @@ ivas_error ivas_dec(


    output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC );
    output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC );


    /* set pointers to transport channels audio */
    for ( n = 0; n < MAX_TRANSPORT_CHANNELS; n++ )
    for ( n = 0; n < MAX_TRANSPORT_CHANNELS; n++ )
    {
    {
        p_output[n] = st_ivas->p_output_f[n];
        p_output[n] = st_ivas->p_output_f[n];
@@ -210,7 +211,6 @@ ivas_error ivas_dec(
                return error;
                return error;
            }
            }
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS

            if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hDecoderConfig->Opt_tsm )
            if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hDecoderConfig->Opt_tsm )
            {
            {
                ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas );
                ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas );
@@ -311,7 +311,7 @@ ivas_error ivas_dec(
            ivas_masa_prerender( st_ivas, p_output, output_frame, nchan_remapped );
            ivas_masa_prerender( st_ivas, p_output, output_frame, nchan_remapped );


            /* external output */
            /* external output */
            if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hMasa->config.input_ivas_format == MASA_ISM_FORMAT )
            if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL && st_ivas->hMasa->config.input_ivas_format == MASA_ISM_FORMAT )
            {
            {
                for ( n = 0; n < st_ivas->nchan_ism; n++ )
                for ( n = 0; n < st_ivas->nchan_ism; n++ )
                {
                {
@@ -411,7 +411,6 @@ ivas_error ivas_dec(
                ivas_omasa_render_objects_from_mix( st_ivas, p_output, st_ivas->nchan_ism, output_frame );
                ivas_omasa_render_objects_from_mix( st_ivas, p_output, st_ivas->nchan_ism, output_frame );
            }
            }
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS

            if ( st_ivas->hDecoderConfig->Opt_tsm )
            if ( st_ivas->hDecoderConfig->Opt_tsm )
            {
            {
                ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas );
                ivas_jbm_dec_copy_masa_meta_to_buffer( st_ivas );
@@ -774,8 +773,8 @@ ivas_error ivas_dec(
    return IVAS_ERR_OK;
    return IVAS_ERR_OK;
}
}



#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS

/*--------------------------------------------------------------------------*
/*--------------------------------------------------------------------------*
 * ivas_dec_feed_tc_to_renderer()
 * ivas_dec_feed_tc_to_renderer()
 *
 *
@@ -877,7 +876,9 @@ void ivas_dec_feed_tc_to_renderer(


    return;
    return;
}
}

#else
#else

/*--------------------------------------------------------------------------*
/*--------------------------------------------------------------------------*
 * ivas_dec_feed_tc_to_renderer()
 * ivas_dec_feed_tc_to_renderer()
 *
 *
@@ -895,7 +896,7 @@ void ivas_dec_feed_tc_to_renderer(
    float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS];
    float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS];
    int16_t n, n_render_timeslots;
    int16_t n, n_render_timeslots;


    push_wmops( "ivas_jbm_dec_feed_tc_to_renderer" );
    push_wmops( "ivas_dec_feed_tc_to_renderer" );
    for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ )
    for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ )
    {
    {
        p_data_f[n] = &data_f[n][0];
        p_data_f[n] = &data_f[n][0];
@@ -941,8 +942,8 @@ void ivas_dec_feed_tc_to_renderer(
    pop_wmops();
    pop_wmops();
    return;
    return;
}
}
#endif


#endif


/*--------------------------------------------------------------------------*
/*--------------------------------------------------------------------------*
 * ivas_dec_render()
 * ivas_dec_render()
@@ -968,7 +969,9 @@ ivas_error ivas_dec_render(
    ivas_error error;
    ivas_error error;
    float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS];
    float *p_output[MAX_OUTPUT_CHANNELS + MAX_NUM_OBJECTS];
    float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS];
    float *p_tc[MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS];
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
    SPAT_PARAM_REND_COMMON_DATA_HANDLE hSpatParamRendCom;
#endif
    int16_t nchan_out_syn_output;
    int16_t nchan_out_syn_output;


    push_wmops( "ivas_dec_render" );
    push_wmops( "ivas_dec_render" );
@@ -976,7 +979,9 @@ ivas_error ivas_dec_render(
     * Initialization of local vars after struct has been set
     * Initialization of local vars after struct has been set
     *----------------------------------------------------------------*/
     *----------------------------------------------------------------*/


#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
    hSpatParamRendCom = st_ivas->hSpatParamRendCom;
    hSpatParamRendCom = st_ivas->hSpatParamRendCom;
#endif
    output_Fs = st_ivas->hDecoderConfig->output_Fs;
    output_Fs = st_ivas->hDecoderConfig->output_Fs;
    nchan_out = st_ivas->hDecoderConfig->nchan_out;
    nchan_out = st_ivas->hDecoderConfig->nchan_out;
    nchan_transport_rend = st_ivas->hTcBuffer->nchan_transport_rend;
    nchan_transport_rend = st_ivas->hTcBuffer->nchan_transport_rend;
@@ -990,23 +995,30 @@ ivas_error ivas_dec_render(


    if ( !st_ivas->hDecoderConfig->Opt_tsm )
    if ( !st_ivas->hDecoderConfig->Opt_tsm )
    {
    {
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
        for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ )
        for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ )
        {
        {
            p_tc[n] = &p_output[n][st_ivas->hTcBuffer->n_samples_rendered];
            p_tc[n] = &p_output[n][st_ivas->hTcBuffer->n_samples_rendered];
        }
        }


#endif
        for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ )
        for ( n = 0; n < MAX_TRANSPORT_CHANNELS + MAX_NUM_OBJECTS; n++ )
        {
        {
            st_ivas->hTcBuffer->tc[n] = p_output[n];
            st_ivas->hTcBuffer->tc[n] = p_output[n];
        }
        }
    }
    }
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
    else
    else
    {
    {
#endif

        for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ )
        for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ )
        {
        {
            p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered];
            p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered];
        }
        }
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
    }
    }
#endif


    /*----------------------------------------------------------------*
    /*----------------------------------------------------------------*
     * Update combined orientation access index
     * Update combined orientation access index
@@ -1082,7 +1094,11 @@ ivas_error ivas_dec_render(
#endif
#endif
            {
            {
                /* Convert to Ambisonics */
                /* Convert to Ambisonics */
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
                ivas_ism2sba_sf( p_tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order );
#else
                ivas_ism2sba_sf( st_ivas->hTcBuffer->tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order );
                ivas_ism2sba_sf( st_ivas->hTcBuffer->tc, p_output, st_ivas->hIsmRendererData, st_ivas->nchan_transport, *nSamplesRendered, st_ivas->hTcBuffer->n_samples_rendered, st_ivas->hIntSetup.ambisonics_order );
#endif
            }
            }


            /* Binaural rendering */
            /* Binaural rendering */
@@ -1211,7 +1227,7 @@ ivas_error ivas_dec_render(
                    return error;
                    return error;
                }
                }
            }
            }
            else if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/
            else if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL ) /*EXT output = individual objects + HOA3*/
            {
            {
                if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output[st_ivas->nchan_ism] ) ) != IVAS_ERR_OK )
                if ( ( error = ivas_sba_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, &p_output[st_ivas->nchan_ism] ) ) != IVAS_ERR_OK )
                {
                {
@@ -1220,7 +1236,11 @@ ivas_error ivas_dec_render(


                for ( n = 0; n < st_ivas->nchan_ism; n++ )
                for ( n = 0; n < st_ivas->nchan_ism; n++ )
                {
                {
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
                    mvr2r( p_tc[n], p_output[n], *nSamplesRendered );
#else
                    mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered );
                    mvr2r( st_ivas->hTcBuffer->tc[n] + st_ivas->hTcBuffer->n_samples_rendered, p_output[n], *nSamplesRendered );
#endif
                }
                }
            }
            }
            else
            else
@@ -1242,7 +1262,7 @@ ivas_error ivas_dec_render(
                return error;
                return error;
            }
            }


            if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            if ( output_config == IVAS_AUDIO_CONFIG_EXTERNAL )
            {
            {
#ifdef DEBUGGING
#ifdef DEBUGGING
                assert( st_ivas->ism_mode == ISM_MODE_NONE );
                assert( st_ivas->ism_mode == ISM_MODE_NONE );
@@ -1260,10 +1280,12 @@ ivas_error ivas_dec_render(
    }
    }
    else if ( st_ivas->ivas_format == MC_FORMAT )
    else if ( st_ivas->ivas_format == MC_FORMAT )
    {
    {
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
        for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ )
        for ( n = 0; n < st_ivas->hTcBuffer->nchan_buffer_full; n++ )
        {
        {
            p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered];
            p_tc[n] = &st_ivas->hTcBuffer->tc[n][st_ivas->hTcBuffer->n_samples_rendered];
        }
        }
#endif
        if ( st_ivas->mc_mode == MC_MODE_MCT )
        if ( st_ivas->mc_mode == MC_MODE_MCT )
        {
        {
            int16_t crendInPlaceRotation = FALSE;
            int16_t crendInPlaceRotation = FALSE;
@@ -1292,7 +1314,6 @@ ivas_error ivas_dec_render(
                {
                {
                    if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
                    if ( ( error = ivas_rend_crendProcessSubframe( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hCombinedOrientationData,
                                                                   &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : p_tc, p_output, *nSamplesRendered, output_Fs, 0 ) ) != IVAS_ERR_OK )
                                                                   &st_ivas->hIntSetup, st_ivas->hEFAPdata, st_ivas->hTcBuffer, crendInPlaceRotation ? p_output : p_tc, p_output, *nSamplesRendered, output_Fs, 0 ) ) != IVAS_ERR_OK )

                    {
                    {
                        return error;
                        return error;
                    }
                    }
@@ -1357,8 +1378,9 @@ ivas_error ivas_dec_render(
        }
        }
        else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
        else if ( st_ivas->mc_mode == MC_MODE_MCMASA )
        {
        {
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
            int16_t offset = hSpatParamRendCom->slots_rendered * hSpatParamRendCom->slot_size;
            int16_t offset = hSpatParamRendCom->slots_rendered * hSpatParamRendCom->slot_size;

#endif
            nchan_remapped = st_ivas->nchan_transport;
            nchan_remapped = st_ivas->nchan_transport;


            if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
            if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC )
@@ -1374,7 +1396,11 @@ ivas_error ivas_dec_render(
                    /* we still need to copy the separate channel if available  */
                    /* we still need to copy the separate channel if available  */
                    if ( st_ivas->hOutSetup.separateChannelEnabled )
                    if ( st_ivas->hOutSetup.separateChannelEnabled )
                    {
                    {
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
                        mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
#else
                        mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
                        mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
#endif
                    }
                    }


                    ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f );
                    ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, *nSamplesRendered, st_ivas->hOutSetup.ambisonics_order, 0.f );
@@ -1395,13 +1421,22 @@ ivas_error ivas_dec_render(
                     output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 ||
                     output_config == IVAS_AUDIO_CONFIG_5_1_4 || output_config == IVAS_AUDIO_CONFIG_7_1_4 ||
                     output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) )
                     output_config == IVAS_AUDIO_CONFIG_5_1_2 || ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe > 0 ) )
                {
                {
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
                    mvr2r( p_tc[LFE_CHANNEL], p_output[LFE_CHANNEL], *nSamplesRendered );
                    mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
#else
                    mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, p_output[LFE_CHANNEL], *nSamplesRendered );
                    mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL] + offset, p_output[LFE_CHANNEL], *nSamplesRendered );
                    mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
                    mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
#endif
                }
                }
                else if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 )
                else if ( output_config == IVAS_AUDIO_CONFIG_LS_CUSTOM && st_ivas->hOutSetup.num_lfe == 0 )
                {
                {
#ifdef UNIFIED_DECODING_PATHS_LEFTOVERS
                    mvr2r( p_tc[LFE_CHANNEL - 1], p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
#else
                    /* Delay the separated channel to sync with the DirAC rendering */
                    /* Delay the separated channel to sync with the DirAC rendering */
                    mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
                    mvr2r( st_ivas->hTcBuffer->tc[LFE_CHANNEL - 1] + offset, p_output[st_ivas->hOutSetup.separateChannelIndex], *nSamplesRendered );
#endif
                }
                }
            }
            }
        }
        }
@@ -2125,7 +2160,6 @@ int16_t ivas_dec_get_num_tc_channels(
}
}


#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS

/*--------------------------------------------------------------------------*
/*--------------------------------------------------------------------------*
 * ivas_jbm_dec_copy_tc()
 * ivas_jbm_dec_copy_tc()
 *
 *
@@ -2183,7 +2217,6 @@ static void ivas_jbm_dec_copy_tc(


    return;
    return;
}
}

#endif
#endif


/*--------------------------------------------------------------------------*
/*--------------------------------------------------------------------------*
@@ -2688,7 +2721,6 @@ TC_BUFFER_MODE ivas_dec_get_tc_buffer_mode(
}
}


#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS
#ifndef UNIFIED_DECODING_PATHS_LEFTOVERS

/*--------------------------------------------------------------------------*
/*--------------------------------------------------------------------------*
 * ivas_jbm_dec_copy_tc_no_tsm()
 * ivas_jbm_dec_copy_tc_no_tsm()
 *
 *
@@ -2761,7 +2793,6 @@ void ivas_jbm_dec_copy_tc_no_tsm(


    return;
    return;
}
}

#endif
#endif


/*--------------------------------------------------------------------------*
/*--------------------------------------------------------------------------*
+18 −27

File changed.

Preview size limit exceeded, changes collapsed.

Loading