Commit 64a2ab86 authored by multrus's avatar multrus
Browse files

Merge branch 'main' into...

Merge branch 'main' into basop-2537-harmonization-transient-detection-gettcxmaxenergychange-gettcxavgtemporalflatnessmeasure
parents dfd3a882 06072653
Loading
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@
#define NONBE_FIX_ISSUE_2206_TD_CHANNEL_EXTRAPOLATION   /* FhG: Use different scale to avoid saturation of LPC coefficient in TD Stereo signal extrapolation. */
#define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_SWB_fenv_fx2 /* FhG: Avoid overflow of SWB_fenv_fx in SWB_BWE_encoding_fx because of very small energies. */
#define NONBE_FIX_ISSUE_2206_AVOID_OVERFLOW_MSVQ_Interpol_Tran_fx /* FhG: Fix saturation crash in MSVQ_Interpol_Tran_fx() */
#define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527    /* Fix crash from issue #2527 */
#define FIX_2452_HQ_CORE_PEAQ_AVR_RATIO_HARM            /* Eri: Basop issue 2453: Fix alignment of peak_avrg_ratio_fx */
#define FIX_FLOAT_1539_G192_FORMAT_SWITCH               /* VA/Nokia: reintroduce format switching for g192 bitstreams */
#define FIX_1527_CMR_BITRATE_IDX                        /* Fix for incorrect bitrate idx packed in rtp CMR E-byte */
@@ -115,6 +116,7 @@
#define FIX_BASOP_2513_EXTRA_RETURN_REND_OPEN           /* Nokia: BASOP issue 2513: Removes extra return block */
#define FIX_BASOP_2514_EFAP_PORTING_ERROR               /* Nokia: BASOP issue 2514: Fix wrongly ported line */
#define FIX_BASOP_2516_REND_CUSTOM_LAYOUT_PORT_BUG      /* Nokia: BASOP issue 2516: Fix porting bug in setting planar state for custom layout in renderer */
#define USE_RTPDUMP                                     /* FhG: RTPDUMP format (rtptools standard) instead of custom format */
#define FIX_FLOAT_1569_REND_RENDER_CONFIG_CHECKS        /* Nokia: float issue 1569: fix render config checks in renderer */
#define FIX_BASOP_2526_SPAR_MASA_PARAM_MAP_Q_BUG        /* Nokia: BASOP issue 2526: Fix wrong Q variable in SPAR to MASA param mapping */
#define FIX_BASOP_2524_MASA_REDUCE_META_BUG             /* Nokia: BASOP issue 2524: Fix wrong reset of W_tmp in reduce_metadata_further_fx */
@@ -124,7 +126,10 @@
#define FIX_BASOP_2522_MAP_PARAMS_DIRAC_STEREO          /* FhG: BASOP issue 2522: Fix copy and paste error for side_gain calculation in map_params_dirac_to_stereo() */
#define FIX_2505_IVAS_DEC_SEGFAULT                      /* FhG: BASOP #2505: Add headroom to input of ivas_rend_crendProcessSubframe_fx() for ivas_mdft_fx() calculation */
#define HARMONIZE_DoRTFTn                               /* VA: harmonize functions DoRTFTn_fx() and DoRTFTn_fx_ivas() */

#define FIX_1574_EFAP_CODE_LINT                         /* FhG: float issue 1574: Code quality fixes in ivas_efap.c */
#define FIX_BASOP_2529_MASA_RATIO_SCALINGS              /* Nokia: BASOP issue 2529: Fix MASA ratio scalings and verifications */
#define FIX_BASOP_2531_MCT_CP_BITRATE                   /* FhG: BASOP issue 2531: Fix MCT cp_bitrate calculation; affects bitrate switching only */
#define FIX_BASOP_2541_OMASA_ENC_FIXES                  /* Nokia: BASOP issue 2541: Fix function ivas_encode_masaism_metadata_fx */

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

+37 −1
Original line number Diff line number Diff line
@@ -2303,9 +2303,17 @@ static void compensate_energy_ratios_fx(
            move32();
            FOR( dir = 0; dir < numDirs; dir++ )
            {
#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS
                ratioSum = L_add( ratioSum, L_shr( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], 1 ) ); // accumulate in Q29
#else
                ratioSum = L_add( ratioSum, hMeta->directional_meta[dir].energy_ratio_fx[sf][band] ); // Q30
#endif
            }
#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS
            ratioSum = L_add( ratioSum, L_shr( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], 1 ) ); // accumulate in  Q29
#else
            ratioSum = L_add( ratioSum, hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] ); // Q30
#endif

            IF( ratioSum == 0 )
            {
@@ -2317,8 +2325,12 @@ static void compensate_energy_ratios_fx(
                hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = ONE_IN_Q30; // Q30
                move32();
            }
#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS
            ELSE IF( GT_32( L_abs( L_sub( ratioSum, ONE_IN_Q29 ) ), 1 ) ) // else if ( ratioSum != 1.0f ) from float with minor rounding tolerance
#else
            // ELSE IF( NE_32( ratioSum, ONE_IN_Q30 ) )
            ELSE /* Removing the check against 1 works well!!! */
#endif
            {
                Word16 exp_diff;
                FOR( dir = 0; dir < numDirs; dir++ )
@@ -2326,13 +2338,21 @@ static void compensate_energy_ratios_fx(
                    hMeta->directional_meta[dir].energy_ratio_fx[sf][band] =
                        BASOP_Util_Divide3232_Scale_newton( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], ratioSum, &exp_diff );
                    move32();
#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS
                    hMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], sub( exp_diff, Q2 ) ); // back to Q30
#else
                    hMeta->directional_meta[dir].energy_ratio_fx[sf][band] = L_shl( hMeta->directional_meta[dir].energy_ratio_fx[sf][band], sub( exp_diff, Q1 ) ); // Q30
#endif
                    move32();
                }
                hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] =
                    BASOP_Util_Divide3232_Scale_newton( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], ratioSum, &exp_diff );
                move32();
#ifdef FIX_BASOP_2529_MASA_RATIO_SCALINGS
                hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], sub( exp_diff, Q2 ) ); // back to Q30
#else
                hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band] = L_shl( hMeta->common_meta.diffuse_to_total_ratio_fx[sf][band], sub( exp_diff, Q1 ) ); // Q30
#endif
                move32();
            }
        }
@@ -3990,7 +4010,11 @@ void ivas_merge_masa_metadata_fx(
                    direct_scaler_e = 0;
                    move16();
                    hMeta->directional_meta[0].energy_ratio_fx[sf][band] = Mpy_32_32( direct_scaler_fx, hMeta->directional_meta[0].energy_ratio_fx[sf][band] ); /*q30*/
#ifdef FIX_BASOP_2525_MASA_MERGE_WRONG_ASSIGN
                    hMeta->directional_meta[1].energy_ratio_fx[sf][band] = Mpy_32_32( direct_scaler_fx, hMeta->directional_meta[1].energy_ratio_fx[sf][band] ); /*q30*/
#else
                    hMeta->directional_meta[1].energy_ratio_fx[sf][band] = Mpy_32_32( direct_scaler_fx, hMeta->directional_meta[0].energy_ratio_fx[sf][band] ); /*q30*/
#endif
                    move32();
                    move32();
                }
@@ -4818,8 +4842,13 @@ static void ivas_encode_masaism_metadata_fx(
                eneBand32 = W_extract_h( W_shl( eneBand, shift ) );
                eneBand_exp = sub( 63, add( add( hMasa->data.q_energy, 1 ), shift ) );

#ifdef FIX_BASOP_2541_OMASA_ENC_FIXES
                energy_ism = L_tmp; // Copy existing value
                energy_ism_e = L_tmp_e;
#else
                energy_ism = 0;
                energy_ism_e = 0;
#endif
                move32();
                move16();
                FOR( obj = 0; obj < nchan_ism; obj++ )
@@ -4832,13 +4861,20 @@ static void ivas_encode_masaism_metadata_fx(

                FOR( band = 0; band < omasa_nbands; band++ )
                {
#ifndef FIX_BASOP_2541_OMASA_ENC_FIXES
                    energy_ism = BASOP_Util_Add_Mant32Exp( energy_ism, energy_ism_e, hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ism_fx_e[sf][band], &energy_ism_e );

#endif
                    FOR( obj = 0; obj < nchan_ism; obj++ )
                    {
#ifdef FIX_BASOP_2541_OMASA_ENC_FIXES
                        L_tmp = Mpy_32_32( hOmasaEnergy->energy_ism_fx[sf][band], hOmasaEnergy->energy_ratio_ism_fx[sf][band][obj] ); // Q = (31 - hOmasaEnergy->energy_ism_fx_e[sf][band]) + Q30 - 31
                        L_tmp_e = add( 1, hOmasaEnergy->energy_ism_fx_e[sf][band] );
                        energy_ism_ind[obj] = BASOP_Util_Add_Mant32Exp( energy_ism_ind[obj], energy_ism_ind_e[obj], L_tmp, L_tmp_e, &energy_ism_ind_e[obj] );
#else

                        hOmasaData->masa_to_total_energy_ratio_fx[sf][0] = ONE_IN_Q30; // 1.0f in Q30
                        move32();
#endif
                    }
                }

+11 −0
Original line number Diff line number Diff line
@@ -234,13 +234,24 @@ ivas_error ivas_mct_enc_fx(
    IF( NE_32( ivas_total_brate, st_ivas->hEncoderConfig->last_ivas_total_brate ) )
    {
        Word32 cp_bitrate;
#ifdef FIX_BASOP_2531_MCT_CP_BITRATE
        Word32 L_tmp;
#endif
        // cp_bitrate = ivas_total_brate / hMCT->nchan_out_woLFE * CPE_CHANNELS;
#ifdef FIX_BASOP_2531_MCT_CP_BITRATE
        iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), hMCT->nchan_out_woLFE, &cp_bitrate, &L_tmp, 0 );
#else
        cp_bitrate = L_shl( L_deposit_l( div_l( ivas_total_brate, hMCT->nchan_out_woLFE ) ), 2 ); // a/b => div_l(a, b/2) or (2 * div_l(a, b))
#endif

        IF( EQ_32( st_ivas->ism_mode, ISM_SBA_MODE_DISC ) )
        {
            // cp_bitrate = ivas_total_brate / st_ivas->nchan_transport * CPE_CHANNELS;
#ifdef FIX_BASOP_2531_MCT_CP_BITRATE
            iDiv_and_mod_32( L_shl( ivas_total_brate, 1 ), st_ivas->nchan_transport, &cp_bitrate, &L_tmp, 0 );
#else
            cp_bitrate = L_shl( L_deposit_l( div_l( ivas_total_brate, st_ivas->nchan_transport ) ), 2 ); // a/b => div_l(a, b/2) or (2 * div_l(a, b))
#endif
        }

        IF( st_ivas->hCPE[0]->hCoreCoder[0]->igf )
+4 −0
Original line number Diff line number Diff line
@@ -4895,7 +4895,11 @@ static void gainFrSmooth_En_fx(
        IF( NE_32( st_fx->total_brate, ACELP_24k40 ) )
        {
#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT
#ifdef NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527
            Scale_sig( hBWE_TD->shb_inv_filt_mem_fx, LPC_SHB_ORDER, sub( shb_frame_q, hBWE_TD->shb_inv_filt_mem_q ) );
#else
            scale_sig( hBWE_TD->shb_inv_filt_mem_fx, LPC_SHB_ORDER, sub( shb_frame_q, hBWE_TD->shb_inv_filt_mem_q ) );
#endif
            hBWE_TD->shb_inv_filt_mem_q = shb_frame_q;
            move16();
#endif
+6 −0
Original line number Diff line number Diff line
@@ -110,6 +110,12 @@ ivas_error ivas_sba_get_hoa_dec_matrix_fx(
    ELSE IF( hOutSetup.is_loudspeaker_setup )
    {
        /* init EFIP */

#ifdef FIX_1574_EFAP_CODE_LINT
        /* ensure the handle is NULL before passing, otherwise efap_init_data will think this is allocated memory and return an error */
        hEFAP = NULL;
#endif

        IF( NE_16( ( error = efap_init_data_fx( &( hEFAP ), hOutSetup.ls_azimuth_fx, hOutSetup.ls_elevation_fx, num_spk, EFAP_MODE_EFIP ) ), IVAS_ERR_OK ) )
        {
            return error;
Loading