Commit 3b2049c9 authored by Lauros Pajunen's avatar Lauros Pajunen
Browse files

Fix object editing issues 1399 and 1400

parent 91d6421f
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,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_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_1328_FIX_NON_LINEARITY                    /* VA: Fix possible issue when computing bwe_exc_extended and previous frame were almost 0  */

#define NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES             /* Nokia: Fix for issues 1399: obj edit broken with MC/SBA output in VOIP, and 1400: negative energy estimate used for gaining. */

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

+14 −0
Original line number Diff line number Diff line
@@ -2907,6 +2907,20 @@ void ivas_dec_prepare_renderer(
                    nchan_transport_ism = st_ivas->nchan_ism;
                }

#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES
                if ( st_ivas->hDecoderConfig->Opt_tsm && st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_DIRAC)
                {
                    /* Gain MASA part, if edited */
                    if ( st_ivas->hMasaIsmData->masa_gain_is_edited )
                    {
                        for ( int16_t ch = 0; ch < 2; ch++ )
                        {
                            v_multc( st_ivas->hTcBuffer->tc[ch], st_ivas->hMasaIsmData->gain_masa_edited, st_ivas->hTcBuffer->tc[ch], st_ivas->hTcBuffer->n_samples_available );
                        }
                    }
                }
#endif

                for ( n = 0; n < nchan_transport_ism; n++ )
                {
                    if ( st_ivas->ism_mode == ISM_MASA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC )
+9 −1
Original line number Diff line number Diff line
@@ -680,7 +680,11 @@ void ivas_omasa_dirac_rend_jbm(
    {
        mvr2r( &output_f[CPE_CHANNELS][st_ivas->hTcBuffer->n_samples_rendered], data_separated_objects[0], *nSamplesRendered );

#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES
        if ( st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
#else
        if ( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
#endif
        {
            /* Gain separated object, if edited */
            for ( n = 0; n < st_ivas->nchan_ism; n++ )
@@ -699,13 +703,17 @@ void ivas_omasa_dirac_rend_jbm(
            mvr2r( &output_f[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
            if ( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->ism_gain_is_edited[n] )
#endif
            {
                v_multc( data_separated_objects[n], st_ivas->hMasaIsmData->gain_ism_edited[n], data_separated_objects[n], *nSamplesRendered );
            }
        }

        /* Gain MASA part, if edited */
        /* Gain MASA part, if edited in G192. MASA gaining with VOIP is done in ivas_dec_prepare_renderer() */
        if ( !st_ivas->hDecoderConfig->Opt_tsm && st_ivas->hMasaIsmData->masa_gain_is_edited )
        {
            for ( int16_t ch = 0; ch < 2; ch++ )
+7 −0
Original line number Diff line number Diff line
@@ -3112,6 +3112,13 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects(
            }

            /* Limit target energies to non-negative values */
#ifdef NONBE_1399_1400_FIX_OBJ_EDIT_ISSUES
            for ( ch = 0; ch < 2; ch++ )
            {
                totalTargetEneCh[ch] = max( totalTargetEneCh[ch], 0.0f );
            }
#endif

            /* due to rounding, the sum may exceed 1.0f ever so slightly, so clip it */
            ratioAccOrig = min( ratioAccOrig, 1.0f );
            if ( masaGainEdited )