Commit b3f36442 authored by vaclav's avatar vaclav
Browse files

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

Merge remote-tracking branch 'remotes/origin/main' into 2054-basop-mr2140-from-float-keep-tsm-memory-in-jbm-bitrate-switching-2
parents 9cc18d84 22fa8965
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -133,6 +133,8 @@
#define FIX_1330_JBM_MEMORY                             /* VA: issue 1330: memory savings in the JBM decoder */
#define FIX_1411_IGF_CRASH_BW_SWITCHING                 /* FhG: Fix for issue 1411: fixes crash that can happen for IGF with BW switching and DTX*/
#define NONBE_MDCT_ST_DTX_FIX_SUBOPT_SPATIAL_CNG       /* FhG: Fix MDCT-Stereo comfort noise for certain noise types */
#define NONBE_1344_REND_MASA_LOW_FS                     /* Nokia: Issue 1344: Fix sanitizer errors when using IVAS_rend to render MASA with lower sampling rates */
#define NONBE_1412_AVOID_ROUNDING_AZ_ELEV               /* FhG:  Avoid rounding when passing azimuth and elevation to efap_determine_gains() */

// object-editing feature porting
#define TMP_FIX_SPLIT_REND                              // temporary fix to split-rendering (it follows the later state of the framework but it is needed now because of current test-conditions)
+14 −0
Original line number Diff line number Diff line
@@ -942,7 +942,9 @@ void ivas_ism_dec_digest_tc_fx(
        ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_MIXER_CONV_ROOM ) && st_ivas->hDecoderConfig->Opt_Headrotation == 0 ) )
    {
        Word16 i;
#ifndef NONBE_1412_AVOID_ROUNDING_AZ_ELEV
        Word32 azimuth_fx, elevation_fx;
#endif

        /* we have a full frame interpolator, adapt it */
        /* for BE testing */
@@ -1011,9 +1013,11 @@ void ivas_ism_dec_digest_tc_fx(
            }
            ELSE
            {
#ifndef NONBE_1412_AVOID_ROUNDING_AZ_ELEV
                // TODO tmu review when #215 is resolved
                azimuth_fx = L_shr( L_add( st_ivas->hIsmMetaData[i]->edited_azimuth_fx, 2097152 ), Q22 );     // Q0 ,2097152 = .5f in Q22
                elevation_fx = L_shr( L_add( st_ivas->hIsmMetaData[i]->edited_elevation_fx, 2097152 ), Q22 ); // Q0 ,2097152 = .5f in Q22
#endif

                test();
                test();
@@ -1029,6 +1033,9 @@ void ivas_ism_dec_digest_tc_fx(
                      ( EQ_32( st_ivas->renderer_type, RENDERER_BINAURAL_FASTCONV_ROOM ) && EQ_32( st_ivas->ivas_format, SBA_ISM_FORMAT ) && EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) ) ) &&
                    st_ivas->hCombinedOrientationData == NULL )
                {
#ifdef NONBE_1412_AVOID_ROUNDING_AZ_ELEV
                    Word32 elevation_fx = st_ivas->hIsmMetaData[i]->edited_elevation_fx;
#endif
                    if ( st_ivas->hIntSetup.is_planar_setup )
                    {
                        /* If no elevation support in output format, then rendering should be done with zero elevation */
@@ -1038,10 +1045,17 @@ void ivas_ism_dec_digest_tc_fx(

                    IF( st_ivas->hEFAPdata != NULL )
                    {
#ifndef NONBE_1412_AVOID_ROUNDING_AZ_ELEV
                        azimuth_fx = L_shl( azimuth_fx, Q22 );     // Q22
                        elevation_fx = L_shl( elevation_fx, Q22 ); // Q22
#endif


#ifdef NONBE_1412_AVOID_ROUNDING_AZ_ELEV
                        efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], st_ivas->hIsmMetaData[i]->edited_azimuth_fx, elevation_fx, EFAP_MODE_EFAP );
#else
                        efap_determine_gains_fx( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains_fx[i], azimuth_fx, elevation_fx, EFAP_MODE_EFAP );
#endif
                        // TODO: align Q values properly
                        IF( NE_32( st_ivas->hIsmMetaData[i]->edited_gain_fx, ONE_IN_Q29 ) )
                        {
+17 −0
Original line number Diff line number Diff line
@@ -4602,6 +4602,23 @@ void ivas_dec_prepare_renderer_fx(
                move16();
            }

#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES
            test();
            test();
            IF( st_ivas->hDecoderConfig->Opt_tsm && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_DISC ) && EQ_32( st_ivas->renderer_type, RENDERER_DIRAC ) )
            {
                /* Gain MASA part, if edited */
                IF( st_ivas->hMasaIsmData->masa_gain_is_edited )
                {
                    FOR( n = 0; n < CPE_CHANNELS; n++ )
                    {
                        v_multc_fx_16( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hMasaIsmData->gain_masa_edited_fx, st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available );
                        Scale_sig32( st_ivas->hTcBuffer->tc_fx[n], st_ivas->hTcBuffer->n_samples_available, Q3 ); // Q8 -> Q11
                    }
                }
            }
#endif

            FOR( n = 0; n < nchan_transport_ism; n++ )
            {
                test();
+12 −4
Original line number Diff line number Diff line
@@ -1133,10 +1133,14 @@ void ivas_omasa_dirac_rend_jbm_fx(
        {
            Copy32( &output_fx[CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[0], *nSamplesRendered );

#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES
            IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
#else
#ifdef FIX_1330_JBM_MEMORY
        IF( !st_ivas->hDecoderConfig->Opt_tsm && EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
#else
        IF( EQ_32( st_ivas->ism_mode, ISM_MASA_MODE_PARAM_ONE_OBJ ) )
#endif
#endif
            {
                /* Gain separated object, if edited */
@@ -1158,10 +1162,14 @@ void ivas_omasa_dirac_rend_jbm_fx(
                Copy32( &output_fx[n + CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[n], *nSamplesRendered );

                /* Gain discrete objects, if edited */
#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES
                IF( st_ivas->hMasaIsmData->ism_gain_is_edited[n] )
#else
#ifdef FIX_1330_JBM_MEMORY
            IF( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->ism_gain_is_edited[n] )
#else
            IF( st_ivas->hMasaIsmData->ism_gain_is_edited[n] )
#endif
#endif
                {
                    v_multc_fx_16( data_separated_objects[n], st_ivas->hMasaIsmData->gain_ism_edited_fx[n], data_separated_objects[n], *nSamplesRendered ); // Q = 8
@@ -1169,14 +1177,14 @@ void ivas_omasa_dirac_rend_jbm_fx(
                }
            }

            /* Gain MASA part, if edited */
            /* Gain MASA part, if edited in G192. MASA gaining with VOIP is done in ivas_dec_prepare_renderer() */
#ifdef FIX_1330_JBM_MEMORY
            IF( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->masa_gain_is_edited )
#else
        IF( st_ivas->hMasaIsmData->masa_gain_is_edited )
#endif
            {
                FOR( n = 0; n < 2; n++ )
                FOR( n = 0; n < CPE_CHANNELS; n++ )
                {
                    v_multc_fx_16( output_fx[n], st_ivas->hMasaIsmData->gain_masa_edited_fx, output_fx[n], *nSamplesRendered ); // Q = 8
                    Scale_sig32( output_fx[n], *nSamplesRendered, Q3 );                                                         // Q = 11
+16 −8
Original line number Diff line number Diff line
@@ -250,16 +250,24 @@ void ivas_dirac_ana_fx(
    const Word16 nchan_transport, /* i  : Number of transport channels        */
    const Word16 data_q )
{
    Word32 elevation_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 azimuth_m_values[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 energyRatio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 spreadCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 surroundingCoherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 elevation_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 azimuth_m_values_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 energyRatio_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 spreadCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    Word32 surroundingCoherence_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
    /* Estimate MASA parameters from the SBA signals */
    ivas_dirac_param_est_ana_fx( hDirAC, data_fx, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, input_frame, data_q );
    /* Create MASA metadata buffer from the estimated values */
    ivas_dirac_param_est_ana_fx( hDirAC, data_fx, elevation_m_values_fx, azimuth_m_values_fx, energyRatio_fx, spreadCoherence_fx, surroundingCoherence_fx, input_frame, data_q );

    ivas_create_masa_out_meta_fx( hDirAC->hMasaOut, hDirAC->sph_grid16, nchan_transport, elevation_m_values, azimuth_m_values, energyRatio, spreadCoherence, surroundingCoherence, Q31, Q31, Q31 );
#ifdef NONBE_1344_REND_MASA_LOW_FS
    /* Add zeros to higher bands in case of lower sampling rates */
    IF( LT_16( hDirAC->nbands, MASA_FREQUENCY_BANDS ) )
    {
        ivas_masa_zero_high_bands_fx( hDirAC->nbands, elevation_m_values_fx, azimuth_m_values_fx, energyRatio_fx, spreadCoherence_fx, surroundingCoherence_fx );
    }
#endif

    /* Create MASA metadata buffer from the estimated values */
    ivas_create_masa_out_meta_fx( hDirAC->hMasaOut, hDirAC->sph_grid16, nchan_transport, elevation_m_values_fx, azimuth_m_values_fx, energyRatio_fx, spreadCoherence_fx, surroundingCoherence_fx, Q31, Q31, Q31 );

    /* Downmix */
    ivas_dirac_dmx_fx( data_fx, input_frame, nchan_transport ); // output Q of data_fx is same as that of input
Loading