Commit b88eae79 authored by Tapani Pihlajakuja's avatar Tapani Pihlajakuja
Browse files

Adds missing pieces of port 408 for BASOP main.

parent 34259621
Loading
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -4598,6 +4598,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();
+24 −24
Original line number Diff line number Diff line
@@ -5383,7 +5383,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
        }

        /* MASA gaining */
        FOR( ch = 0; ch < 2; ch++ )
        FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            IF( masaGainEdited )
            {
@@ -5420,7 +5420,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
        move16();

        /* Use diagonal mixing matrix as the instant mixing matrix, to slowly fade away the editing during dtx */
        FOR( ch = 0; ch < 2; ch++ )
        FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
        {
            ismPreprocMtxNew[ch][ch] = ONE_IN_Q28;
            move32();
@@ -5462,7 +5462,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            move16();
            FOR( slot = 0; slot < nSlots; slot++ )
            {
                FOR( ch = 0; ch < 2; ch++ )
                FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
                {
                    FOR( bin = bin_lo; bin < bin_hi; bin++ )
                    {
@@ -5481,9 +5481,9 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            }

            /* Get increment value for temporal interpolation */
            FOR( inCh = 0; inCh < 2; inCh++ )
            FOR( inCh = 0; inCh < BINAURAL_CHANNELS; inCh++ )
            {
                FOR( outCh = 0; outCh < 2; outCh++ )
                FOR( outCh = 0; outCh < BINAURAL_CHANNELS; outCh++ )
                {
                    temp = L_sub( ismPreprocMtxNew[outCh][inCh], hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx] ); // Q28
                    ismPreprocMtxIncrement[outCh][inCh] = L_shr( temp, 2 );                                                  // Divide by 4
@@ -5501,11 +5501,11 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            hMasaIsmData->preprocEneTarget_fx[band_idx] = BASOP_Util_Add_Mant32Exp( hMasaIsmData->preprocEneTarget_fx[band_idx], hMasaIsmData->preprocEneTarget_e[band_idx], totalTargetEne, totalTargetEne_e, &hMasaIsmData->preprocEneTarget_e[band_idx] ); // Q = 31-preprocEneTarget_e
            move32();

            FOR( outCh = 0; outCh < 2; outCh++ )
            FOR( outCh = 0; outCh < BINAURAL_CHANNELS; outCh++ )
            {
                FOR( slot = 0; slot < nSlots; slot++ )
                {
                    FOR( inCh = 0; inCh < 2; inCh++ )
                    FOR( inCh = 0; inCh < BINAURAL_CHANNELS; inCh++ )
                    {
                        hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx] = L_add( hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx], ismPreprocMtxIncrement[outCh][inCh] ); // Q28

@@ -5564,7 +5564,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
                move32();
            }

            FOR( ch = 0; ch < 2; ch++ )
            FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                FOR( slot = 0; slot < nSlots; slot++ )
                {
@@ -5666,7 +5666,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            ELSE
            {
                /* When not edited, input and output pan gains are the same */
                FOR( ch = 0; ch < 2; ch++ )
                FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
                {
                    panGainsOut[ismDirIndex][ch] = panGainsIn[ismDirIndex][ch];
                    move16();
@@ -5674,7 +5674,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            }

            /* Determine pan enes */
            FOR( ch = 0; ch < 2; ch++ )
            FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                panEnesOut[ismDirIndex][ch] = mult( panGainsOut[ismDirIndex][ch], panGainsOut[ismDirIndex][ch] ); // Q15
                move16();
@@ -5704,14 +5704,14 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
        }

        /* Init out array */
        FOR( Word16 k = 0; k < nSlots; k++ )
        FOR( slot = 0; slot < nSlots; slot++ )
        {
            FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                set_zero_fx( outSlotRe[ch][k], CLDFB_NO_CHANNELS_MAX );
                set_zero_fx( outSlotIm[ch][k], CLDFB_NO_CHANNELS_MAX );
                set_zero_fx( outSlotRe[ch][slot], CLDFB_NO_CHANNELS_MAX );
                set_zero_fx( outSlotIm[ch][slot], CLDFB_NO_CHANNELS_MAX );

                norm = s_min( L_norm_arr( inRe_fx[ch][k], nBins ), L_norm_arr( inIm_fx[ch][k], nBins ) );
                norm = s_min( L_norm_arr( inRe_fx[ch][slot], nBins ), L_norm_arr( inIm_fx[ch][slot], nBins ) );
                shift = s_min( norm, shift );
            }
        }
@@ -5762,7 +5762,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            move16();

            /* Determine transport normalized energies and subframe energy */
            FOR( ch = 0; ch < 2; ch++ )
            FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                FOR( slot = 0; slot < nSlots; slot++ )
                {
@@ -5985,7 +5985,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(


                    /* Calculate MASA target energies and add to total target energy estimation */
                    FOR( ch = 0; ch < 2; ch++ )
                    FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
                    {
                        /* MASA original energy per channel */
                        masaEneThisCh[ch] = L_max( masaEneThisCh[ch], 0 ); // Q5
@@ -6167,7 +6167,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
                    }
                }

                FOR( ch = 0; ch < 2; ch++ )
                FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
                {
                    eneMoveThis = s_max( 0, sub( panEnesIn[ismDirIndex][ch], panEnesOut[ismDirIndex][ch] ) ); // Q15
                    move16();
@@ -6197,7 +6197,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            remainderNormEne = L_max( 0, temp ); // Q25

            /* Normalize */
            FOR( ch = 0; ch < 2; ch++ )
            FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                temp = L_shr( remainderNormEne, 1 );                                      // Division by 2, Q25
                temp = L_add( normEnes[ch], temp );                                       // Q25
@@ -6233,7 +6233,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(

            /* Temporally average energy moving and preserving, and generate the transport signal preprocessing matrix for
             * gaining objects and moving objects between left and right */
            FOR( ch = 0; ch < 2; ch++ )
            FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                hMasaIsmData->eneMoveIIR_fx[ch][band_idx] = Mpy_32_16_1( hMasaIsmData->eneMoveIIR_fx[ch][band_idx], STEREO_PREPROCESS_IIR_FACTOR_Q15 ); // Q = Enemove_Q + 15 + 1 -16 = Enemove_Q
                move32();
@@ -6320,9 +6320,9 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            }

            /* Get increment value for temporal interpolation */
            FOR( inCh = 0; inCh < 2; inCh++ )
            FOR( inCh = 0; inCh < BINAURAL_CHANNELS; inCh++ )
            {
                FOR( outCh = 0; outCh < 2; outCh++ )
                FOR( outCh = 0; outCh < BINAURAL_CHANNELS; outCh++ )
                {
                    temp = L_sub( ismPreprocMtxNew[outCh][inCh], hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx] ); // Q28
                    ismPreprocMtxIncrement[outCh][inCh] = L_shr( temp, 2 );                                                  // Divide by 4
@@ -6340,11 +6340,11 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
            hMasaIsmData->preprocEneTarget_fx[band_idx] = BASOP_Util_Add_Mant32Exp( hMasaIsmData->preprocEneTarget_fx[band_idx], hMasaIsmData->preprocEneTarget_e[band_idx], totalTargetEne, sub( Q31, subQ ), &hMasaIsmData->preprocEneTarget_e[band_idx] ); // Q = 31-preprocEneTarget_e
            move32();

            FOR( outCh = 0; outCh < 2; outCh++ )
            FOR( outCh = 0; outCh < BINAURAL_CHANNELS; outCh++ )
            {
                FOR( slot = 0; slot < nSlots; slot++ )
                {
                    FOR( inCh = 0; inCh < 2; inCh++ )
                    FOR( inCh = 0; inCh < BINAURAL_CHANNELS; inCh++ )
                    {
                        hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx] = L_add( hMasaIsmData->ismPreprocMatrix_fx[outCh][inCh][band_idx], ismPreprocMtxIncrement[outCh][inCh] ); // Q28
                        move32();
@@ -6403,7 +6403,7 @@ void ivas_omasa_preProcessStereoTransportsForEditedObjects_fx(
                move32();
            }

            FOR( ch = 0; ch < 2; ch++ )
            FOR( ch = 0; ch < BINAURAL_CHANNELS; ch++ )
            {
                FOR( slot = 0; slot < nSlots; slot++ )
                {