Commit 1ed5efc7 authored by Manuel Jander's avatar Manuel Jander
Browse files

Merge remote-tracking branch 'origin' into...

Merge remote-tracking branch 'origin' into 1737-high-band-difference-in-external-renderer-masa2-to-mono-5-1
parents f5ab4abf 77c8f31b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -557,7 +557,7 @@ void con_acelp_fx(
    tmp_32 = Mpy_32_16_1( st->Mode2_lp_gainc /*Q16*/, alpha /*Q14*/ ); /*Q31-16 = Q15*/
    s_32 = norm_l( tmp_32 );
    tmp_32 = L_shl( tmp_32, s_32 );
    tmp_16 = round_fx( tmp_32 );
    tmp_16 = round_fx_sat( tmp_32 );
    s_16 = negate( s_32 );
    s_16 = sub( s_16, -1 - 15 ); /*->Q15*/

+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@

*******************************************************************************************************/

#define MERGE_REQUEST_1564_SPEEDUP_ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot_fx_NONBE

#include <stdint.h>
#include <string.h>
+2 −2
Original line number Diff line number Diff line
@@ -729,8 +729,8 @@ static void ivas_param_mc_param_est_enc_fx(
#ifdef MERGE_REQUEST_1378_SPEEDUP_ivas_mc_param_enc_fx_NONBE
            set64_fx( Cy_sum_imag_64[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS );
#else
            set32_fx( Cy_sum_fx[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS );
            set16_fx( Cy_sum_e[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS );
            set32_fx( Cy_sum_imag_fx[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS );
            set16_fx( Cy_sum_imag_e[cur_param_band][ch_idx1], 0, MAX_CICP_CHANNELS );
#endif
        }

+36 −71
Original line number Diff line number Diff line
@@ -46,9 +46,25 @@

static void copy_masa_meta_tile_fx( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, const UWord8 sf, const UWord8 band );

static void full_stream_merge_fx( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta1, Word32 inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne1_e, MASA_DECODER_EXT_OUT_META_HANDLE inMeta2, Word32 inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne2_e );
static void full_stream_merge_fx(
    MASA_DECODER_EXT_OUT_META_HANDLE outMeta,                            /* o  : Merged metadata output                                                      */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta1,                            /* i  : Input metadata 1                                                            */
    Word32 inEne1_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */
    Word16 inEne1_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],  /* i/o: TF-energy of input 1 Exponent                                               */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta2,                            /* i  : Input metadata 2                                                            */
    Word32 inEne2_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i  : TF-energy of input 2                                                        */
    Word16 inEne2_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]   /* i  : TF-energy of input 2 Exponent                                               */
);

static void diffuse_meta_merge_1x1_fx( MASA_DECODER_EXT_OUT_META_HANDLE outMeta, MASA_DECODER_EXT_OUT_META_HANDLE inMeta, Word32 inEne_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEne_e, MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM, Word32 inEneISM_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], Word16 *inEneISM_e );
static void diffuse_meta_merge_1x1_fx(
    MASA_DECODER_EXT_OUT_META_HANDLE outMeta,                              /* o  : Merged metadata output        */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta,                               /* i  : Input metadata 1              */
    Word32 inEne_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],    /* i  : TF-energy of input 1          */
    Word16 inEne_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],     /* i  : TF-energy of input 1 Exponent */
    MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM,                            /* i  : Input metadata 2              */
    Word32 inEneISM_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i  : TF-energy of input 2          */
    Word16 inEneISM_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]   /* i  : TF-energy of input 2 Exponent */
);


/*---------------------------------------------------------------------*
@@ -144,14 +160,13 @@ void diffuse_meta_merge_1x1_fx(
    MASA_DECODER_EXT_OUT_META_HANDLE outMeta,                              /* o  : Merged metadata output        */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta,                               /* i  : Input metadata 1              */
    Word32 inEne_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],    /* i  : TF-energy of input 1          */
    Word16 *inEne_e,                                                       /* i  : TF-energy of input 1 Exponent */
    Word16 inEne_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],     /* i  : TF-energy of input 1 Exponent */
    MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM,                            /* i  : Input metadata 2              */
    Word32 inEneISM_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i  : TF-energy of input 2          */
    Word16 *inEneISM_e                                                     /* i  : TF-energy of input 2 Exponent */
    Word16 inEneISM_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]   /* i  : TF-energy of input 2 Exponent */
)
{
    Word8 sf, band;
    Word16 max_e, in1_e[MASA_FREQUENCY_BANDS], i;
    FOR( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
    {
        FOR( band = 0; band < MASA_FREQUENCY_BANDS; band++ )
@@ -164,22 +179,13 @@ void diffuse_meta_merge_1x1_fx(

            tmp = BASOP_Util_Divide1616_Scale( inMeta->directToTotalRatio[0][sf][band], UINT8_MAX, &scale );
            energyTimesRatio_fx = Mpy_32_16_r( inEne_fx[sf][band], tmp ); /* Q( 31 - ( nEne_e[sf] + scale ) ) */
            energyTimesRatio_e = add( inEne_e[sf], scale );
            energyTimesRatio_e = add( inEne_e[sf][band], scale );
            total_nrg_fx = BASOP_Util_Add_Mant32Exp( inEne_fx[sf][band], inEne_e[sf][band], inEneISM_fx[sf][band], inEneISM_e[sf][band], &total_nrg_e );

            IF( GT_16( inEne_e[sf], inEneISM_e[sf] ) )
            {
                total_nrg_fx = L_add( L_shr( inEne_fx[sf][band], 1 ), L_shr( inEneISM_fx[sf][band], add( sub( inEne_e[sf], inEneISM_e[sf] ), 1 ) ) ); /* Q(30 - inEne_e[sf]) */
                total_nrg_e = add( inEne_e[sf], 1 );
            }
            ELSE
            {
                total_nrg_fx = L_add( L_shr( inEneISM_fx[sf][band], 1 ), L_shr( inEne_fx[sf][band], add( sub( inEneISM_e[sf], inEne_e[sf] ), 1 ) ) ); /* Q(30 - inEneISM_e[sf]) */
                total_nrg_e = add( inEneISM_e[sf], 1 );
            }
            /* target is original MASA diffuseness */
            tmp = BASOP_Util_Divide1616_Scale( inMeta->diffuseToTotalRatio[sf][band], UINT8_MAX, &scale );
            total_diff_nrg_fx = Mpy_32_16_r( inEne_fx[sf][band], tmp ); /* Q( 31 - ( nEne_e[sf] + scale ) ) */
            total_diff_nrg_e = add( inEne_e[sf], scale );
            total_diff_nrg_e = add( inEne_e[sf][band], scale );

            /* criterion is mean of ISM ratio and new ratio */
            dir_ratio_ism_fx = L_deposit_h( BASOP_Util_Divide1616_Scale( inMetaISM->directToTotalRatio[0][sf][band], UINT8_MAX, &dir_ratio_ism_e ) );
@@ -191,7 +197,7 @@ void diffuse_meta_merge_1x1_fx(
            L_tmp1 = BASOP_Util_Add_Mant32Exp( dir_ratio_ism_fx, dir_ratio_ism_e, L_tmp2, scale, &tmp );
            L_tmp1 = L_shr( L_tmp1, 1 );
            energyTimesRatioISM_fx = Mpy_32_32( L_tmp1, inEneISM_fx[sf][band] ); /* Q( 31 - ( tmp + inEneISM_e[sf] ) ) */
            energyTimesRatioISM_e = add( tmp, inEneISM_e[sf] );
            energyTimesRatioISM_e = add( tmp, inEneISM_e[sf][band] );

            IF( ( BASOP_Util_Cmp_Mant32Exp( energyTimesRatioISM_fx, energyTimesRatioISM_e, energyTimesRatio_fx, energyTimesRatio_e ) > 0 ) )
            {
@@ -264,29 +270,9 @@ void diffuse_meta_merge_1x1_fx(
            outMeta->spreadCoherence[1][sf][band] = 0u;
            move16();

            inEne_fx[sf][band] = BASOP_Util_Add_Mant32Exp( inEne_fx[sf][band], inEne_e[sf], inEneISM_fx[sf][band], inEneISM_e[sf], &in1_e[band] ); /* Update energy for subsequent mergings */
            move16();
        }

        max_e = in1_e[0];
        move16();
        FOR( i = 1; i < MASA_FREQUENCY_BANDS; i++ )
        {
            if ( LT_16( max_e, in1_e[i] ) )
            {
                max_e = in1_e[i];
                move16();
            }
        }

        FOR( i = 0; i < MASA_FREQUENCY_BANDS; i++ )
        {
            inEne_fx[sf][i] = L_shr( inEne_fx[sf][i], sub( max_e, in1_e[i] ) ); /* Q(31 - max_e) */
            inEne_fx[sf][band] = BASOP_Util_Add_Mant32Exp( inEne_fx[sf][band], inEne_e[sf][band], inEneISM_fx[sf][band], inEneISM_e[sf][band], &inEne_e[sf][band] ); /* Update energy for subsequent mergings */
            move32();
        }

        inEne_e[sf] = max_e;
        move16();
    }

    /* Set descriptive meta for mixed format */
@@ -318,16 +304,15 @@ void full_stream_merge_fx(
    MASA_DECODER_EXT_OUT_META_HANDLE outMeta,                            /* o  : Merged metadata output                                                      */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta1,                            /* i  : Input metadata 1                                                            */
    Word32 inEne1_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */
    Word16 *inEne1_e,                                                    /* i/o: TF-energy of input 1 Exponent                                               */
    Word16 inEne1_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],  /* i/o: TF-energy of input 1 Exponent                                               */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta2,                            /* i  : Input metadata 2                                                            */
    Word32 inEne2_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i  : TF-energy of input 2                                                        */
    Word16 *inEne2_e                                                     /* i  : TF-energy of input 2 Exponent                                               */
    Word16 inEne2_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]   /* i  : TF-energy of input 2 Exponent                                               */
)
{
    UWord8 n_dirs_1, n_dirs_2;
    UWord8 sf, band;
    Word16 scale, tmp, dir_nrg_1_e, dir_nrg_2_e, max_e, i;
    Word16 in1_e[MASA_FREQUENCY_BANDS];
    Word16 scale, tmp, dir_nrg_1_e, dir_nrg_2_e;
    Word32 dir_nrg_1_fx, dir_nrg_2_fx, L_tmp;

    /* full stream select based on total direct energy */
@@ -340,17 +325,17 @@ void full_stream_merge_fx(
        {
            tmp = BASOP_Util_Divide1616_Scale( inMeta1->directToTotalRatio[0][sf][band], UINT8_MAX, &scale );
            dir_nrg_1_fx = Mpy_32_32( L_deposit_h( tmp ), inEne1_fx[sf][band] ); /* Q( 31 - ( scale + inEne1_e[sf] ) ) */
            dir_nrg_1_e = add( scale, inEne1_e[sf] );
            dir_nrg_1_e = add( scale, inEne1_e[sf][band] );

            tmp = BASOP_Util_Divide1616_Scale( inMeta1->directToTotalRatio[0][sf][band], UINT8_MAX, &scale );
            tmp = BASOP_Util_Divide1616_Scale( inMeta2->directToTotalRatio[0][sf][band], UINT8_MAX, &scale );
            dir_nrg_2_fx = Mpy_32_32( L_deposit_h( tmp ), inEne2_fx[sf][band] ); /* Q( 31 - ( scale + inEne2_e[sf] ) ) */
            dir_nrg_2_e = add( scale, inEne2_e[sf] );
            dir_nrg_2_e = add( scale, inEne2_e[sf][band] );

            IF( EQ_16( n_dirs_1, 2 ) )
            {
                tmp = BASOP_Util_Divide1616_Scale( inMeta1->directToTotalRatio[1][sf][band], UINT8_MAX, &scale );
                L_tmp = Mpy_32_32( L_deposit_h( tmp ), inEne1_fx[sf][band] ); /* Q( 31 - ( scale + inEne1_e[sf] ) ) */
                scale = add( scale, inEne1_e[sf] );
                scale = add( scale, inEne1_e[sf][band] );
                dir_nrg_1_fx = BASOP_Util_Add_Mant32Exp( L_tmp, scale, dir_nrg_1_fx, dir_nrg_1_e, &dir_nrg_1_e );
            }

@@ -358,7 +343,7 @@ void full_stream_merge_fx(
            {
                tmp = BASOP_Util_Divide1616_Scale( inMeta2->directToTotalRatio[1][sf][band], UINT8_MAX, &scale );
                L_tmp = Mpy_32_32( L_deposit_h( tmp ), inEne2_fx[sf][band] ); /* Q( 31 - ( scale + inEne2_e[sf] ) ) */
                scale = add( scale, inEne2_e[sf] );
                scale = add( scale, inEne2_e[sf][band] );
                dir_nrg_2_fx = BASOP_Util_Add_Mant32Exp( L_tmp, scale, dir_nrg_2_fx, dir_nrg_2_e, &dir_nrg_2_e );
            }

@@ -371,29 +356,9 @@ void full_stream_merge_fx(
                copy_masa_meta_tile_fx( outMeta, inMeta2, sf, band );
            }

            inEne1_fx[sf][band] = BASOP_Util_Add_Mant32Exp( inEne1_fx[sf][band], inEne1_e[sf], inEne2_fx[sf][band], inEne2_e[sf], &in1_e[band] );
            inEne1_fx[sf][band] = BASOP_Util_Add_Mant32Exp( inEne1_fx[sf][band], inEne1_e[sf][band], inEne2_fx[sf][band], inEne2_e[sf][band], &inEne1_e[sf][band] );
            move32();
        }

        max_e = in1_e[0];
        move16();
        FOR( i = 1; i < MASA_FREQUENCY_BANDS; i++ )
        {
            if ( LT_16( max_e, in1_e[i] ) )
            {
                max_e = in1_e[i];
                move16();
            }
        }

        FOR( i = 0; i < MASA_FREQUENCY_BANDS; i++ )
        {
            inEne1_fx[sf][i] = L_shr( inEne1_fx[sf][i], sub( max_e, in1_e[i] ) ); /* Q( 31 - max_e ) */
            move32();
        }

        inEne1_e[sf] = max_e;
        move16();
    }

    /* Set descriptive meta for mixed format */
@@ -436,11 +401,11 @@ void ivas_prerend_merge_masa_metadata_fx(
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta1,                            /* i  : Input metadata 1                                                            */
    IVAS_REND_AudioConfigType inType1,                                   /* i  : Type of input 1                                                             */
    Word32 inEne1_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */
    Word16 *inEne1_e,                                                    /* i/o: TF-energy of input 1 Exponent                                               */
    Word16 inEne1_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],  /* i/o: TF-energy of input 1 Exponent                                               */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta2,                            /* i  : Input metadata 2                                                            */
    IVAS_REND_AudioConfigType inType2,                                   /* i  : Type of input 2                                                             */
    Word32 inEne2_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i  : TF-energy of input 2                                                        */
    Word16 *inEne2_e                                                     /* i  : TF-energy of input 2 Exponent                                               */
    Word16 inEne2_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]   /* i  : TF-energy of input 2 Exponent                                               */
)
{
    /* mixing ISMs with non-ISM use different merge */
+2 −2
Original line number Diff line number Diff line
@@ -1478,11 +1478,11 @@ void ivas_prerend_merge_masa_metadata_fx(
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta1,                            /* i  : Input metadata 1                                                            */
    IVAS_REND_AudioConfigType inType1,                                   /* i  : Type of input 1                                                             */
    Word32 inEne1_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal */
    Word16 *inEne1_e,                                                    /* i/o: TF-energy of input 1 Exponent                                               */
    Word16 inEne1_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],  /* i/o: TF-energy of input 1 Exponent                                               */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta2,                            /* i  : Input metadata 2                                                            */
    IVAS_REND_AudioConfigType inType2,                                   /* i  : Type of input 2                                                             */
    Word32 inEne2_fx[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i  : TF-energy of input 2                                                        */
    Word16 *inEne2_e                                                     /* i  : TF-energy of input 2 Exponent                                               */
    Word16 inEne2_e[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]   /* i  : TF-energy of input 2 Exponent                                               */
);

ivas_error masaPrerendOpen_fx(
Loading