Commit 89538fd9 authored by Jouni Paulus's avatar Jouni Paulus
Browse files

update output signal energy correctly in MASA pre-renderer merge. switch:...

update output signal energy correctly in MASA pre-renderer merge. switch: NONBE_FIX_869_MASA_PREREND_MERGE
parent 2c21b46c
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@
#define NONBE_FIX_855_JBM_FLUSH_OFFSET                        /* FhG: issue #855: add missing switch here for the code in JBM flushing                 */
#define NONBE_FIX_926_OSBA_DECODER_CRASH_PLANAR_SBA           /* FhG: issue 926: crash in OSBA decoding with planar FOA */
#define NONBE_FIX_908_OSBA_BR_SWITCHING_CRASH                 /* FhG: issue 908: fix crash in OSBA BR switching with long test vectors */
#define NONBE_FIX_869_MASA_PREREND_MERGE                      /* Nokia: issue: #869: MASA pre-rend not updating energy */

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

+19 −0
Original line number Diff line number Diff line
@@ -126,7 +126,11 @@ void copy_masa_descriptive_meta(
void diffuse_meta_merge_1x1(
    MASA_DECODER_EXT_OUT_META_HANDLE outMeta,                         /* o  : Merged metadata output      */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta,                          /* i  : Input metadata 1            */
#ifdef NONBE_FIX_869_MASA_PREREND_MERGE
    float inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],   /* i/o: TF-energy of input 1. energy after merge */
#else
    float inEne[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS],   /* i  : TF-energy of input 1        */
#endif
    MASA_DECODER_EXT_OUT_META_HANDLE inMetaISM,                       /* i  : Input metadata 2            */
    float inEneISM[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] /* i  : TF-energy of input 2        */
)
@@ -282,14 +286,29 @@ void ivas_prerend_merge_masa_metadata(
    float inEne1[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], /* i/o: TF-energy of input 1. after merge, contains the energy of the merged signal   */
    MASA_DECODER_EXT_OUT_META_HANDLE inMeta2,                        /* i  : Input metadata 2                                                              */
    IVAS_REND_AudioConfigType inType2,                               /* i  : Type of input 2                                                               */
#ifdef NONBE_FIX_869_MASA_PREREND_MERGE
    float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]  /* i  : TF-energy of input 2. may be altered                                          */
#else
    float inEne2[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]  /* i  : TF-energy of input 2                                                          */
#endif
)
{
    /* mixing ISMs with non-ISM use different merge */
    if ( inType1 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED && inType2 != IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED && ( inMeta1->descriptiveMeta.numberOfDirections == 0u && inMeta2->descriptiveMeta.numberOfDirections == 0u ) )
    {
        /* meta_1 is ISM and both are 1dir */
#ifdef NONBE_FIX_869_MASA_PREREND_MERGE
        int8_t sf;

        diffuse_meta_merge_1x1( outMeta, inMeta2, inEne2, inMeta1, inEne1 );  /* post-merge energy is now in inEne2 and needs to be copied to inEne1 */

        for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ )
        {
            mvr2r( inEne2[sf], inEne1[sf], MASA_FREQUENCY_BANDS );
        }
#else
        diffuse_meta_merge_1x1( outMeta, inMeta2, inEne2, inMeta1, inEne1 );
#endif
    }
    else if ( inType2 == IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED && inType1 != IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED && ( inMeta1->descriptiveMeta.numberOfDirections == 0u && inMeta2->descriptiveMeta.numberOfDirections == 0u ) )
    {