Commit 21b862b5 authored by vaclav's avatar vaclav
Browse files

Merge remote-tracking branch 'remotes/origin/main' into...

Merge remote-tracking branch 'remotes/origin/main' into VoiceAge/contribution-omasa-combined-format_updt
parents 611ec212 ad1223e5
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ void masa_sample_rate_band_correction(
    int16_t *band_mapping,            /* i/o: Band mapping used and modified        */
    IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification  */
    const int32_t sampling_rate       /* i  : Sampling rate                         */
#ifdef FIX_373_MASA_DELAY_COMP
#ifdef FIX_350_MASA_DELAY_COMP
    ,
    MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */
#endif
@@ -430,7 +430,7 @@ void masa_sample_rate_band_correction(
            hQMetaData->twoDirBands[band] = 0;
        }
    }
#ifdef FIX_373_MASA_DELAY_COMP
#ifdef FIX_350_MASA_DELAY_COMP
    if ( hExtOutMeta != NULL )
    {
        /* in decoder, zero the EXT out MASA meta buffer */

lib_com/ivas_prot.h

100644 → 100755
+10 −1
Original line number Diff line number Diff line
@@ -1227,6 +1227,9 @@ void stereo_dft_dec(
    float *input_mem,                                           /* i/o: mem of buffer DFT analysis          */
    STEREO_CNG_DEC_HANDLE hStereoCng,                           /* i/o: Stereo CNG data structure           */
    const int16_t sba_dirac_stereo_flag,                        /* i  : signal stereo output for SBA DirAC  */
#ifdef SBA2MONO
    const int16_t sba_mono_flag,                                /* i  : signal mono output for SBA DirAC    */
#endif
    ivas_spar_md_dec_state_t *hMdDec,                           /* i/o: SPAR MD handle for upmixing         */
    const int16_t cross_fade_start_offset,                      /* i  : SPAR mixer delay compensation       */
    const int32_t output_Fs,                                    /* i  : Fs for delay calculation            */
@@ -3323,6 +3326,12 @@ void ivas_sba_dirac_stereo_config(
    STEREO_DFT_CONFIG_DATA_HANDLE hConfig                       /* o  : DFT stereo configuration                */
);

#ifdef SBA2MONO
int16_t ivas_get_sba_dirac_stereo_flag(
    Decoder_Struct *st_ivas                                     /* i/o: IVAS decoder structure                  */
);
#endif

void ivas_sba_dirac_stereo_smooth_parameters(
    STEREO_DFT_DEC_DATA_HANDLE hStereoDft,                      /* i/o: encoder DFT stereo handle               */
    ivas_spar_md_dec_state_t *hMdDec,                           /* i/o: SPAR MD handle for upmixing             */
@@ -4738,7 +4747,7 @@ void masa_sample_rate_band_correction(
    int16_t *band_mapping,                                      /* i/o: Band mapping used and modified                  */
    IVAS_QMETADATA_HANDLE hQMetaData,                           /* i/o: QMetadata structure for modification            */
    const int32_t sampling_rate                                 /* i  : sampling rate                                   */
#ifdef FIX_373_MASA_DELAY_COMP
#ifdef FIX_350_MASA_DELAY_COMP
    , MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta             /* i/o: MASA decoder metadata ext out buffer             */
#endif
);
+2 −0
Original line number Diff line number Diff line
@@ -151,6 +151,8 @@

#define FIX_382_MASA_META_FRAMING_ASYNC                 /* Nokia: Issue 382: detect potential MASA metadata framing offset */

#define SBA2MONO                                        /* FhG: Issue 365: Adapt processing of SBA mono output to be in line with stereo output (less delay, lower complexity) */

#define MASA_AND_OBJECTS                                /* Nokia: Combination of MASA and objects */
#ifdef MASA_AND_OBJECTS
#define MASAISM_EDIT_OBJECTS                            /* Nokia: Temporary command line editing of object directions in the decoder */
+52 −0
Original line number Diff line number Diff line
@@ -87,8 +87,13 @@ ivas_error ivas_corecoder_dec_reconfig(
     *-----------------------------------------------------------------*/

    /* remove dummy CPE element for DFT stereo-like upmix */
#ifdef SBA2MONO
    if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && nchan_transport_old == 1 && ( !st_ivas->sba_dirac_stereo_flag || st_ivas->nchan_transport > 1 ) ) ||
         ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && nchan_transport_old == 1 && ( !st_ivas->sba_dirac_stereo_flag || st_ivas->nchan_transport > 1 ) ) )
#else
    if ( ( st_ivas->ivas_format == SBA_FORMAT && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) ||
         ( st_ivas->ivas_format == MC_FORMAT && last_mc_mode == MC_MODE_MCMASA && sba_dirac_stereo_flag_old && !st_ivas->sba_dirac_stereo_flag ) )
#endif
    {
        st_ivas->hCPE[0]->hCoreCoder[0] = NULL;
        st_ivas->hCPE[0]->hCoreCoder[1] = NULL;
@@ -146,6 +151,23 @@ ivas_error ivas_corecoder_dec_reconfig(

        for ( cpe_id = st_ivas->nCPE; cpe_id < nCPE_old; cpe_id++ )
        {
#ifdef SBA2MONO
            /* don't deallocate first CPE in case of mono/stereo output of 1 TC SBA, only deallocate core coder */
            if ( cpe_id == 0 && st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old )
            {
                for ( n = 0; n < CPE_CHANNELS; n++ )
                {
                    if ( st_ivas->hCPE[cpe_id]->hCoreCoder[n] != NULL )
                    {
                        destroy_core_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] );

                        free( st_ivas->hCPE[cpe_id]->hCoreCoder[n] );
                        st_ivas->hCPE[cpe_id]->hCoreCoder[n] = NULL;
                    }
                }
                continue;
            }
#endif
            destroy_cpe_dec( st_ivas->hCPE[cpe_id] );
            st_ivas->hCPE[cpe_id] = NULL;
        }
@@ -185,6 +207,13 @@ ivas_error ivas_corecoder_dec_reconfig(
                return error;
            }
        }
#ifdef SBA2MONO
        if ( st_ivas->sba_dirac_stereo_flag && sba_dirac_stereo_flag_old && st_ivas->nchan_transport == 1 && nSCE_old == 0 )
        {
            st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */
            st_ivas->hCPE[0]->hCoreCoder[1] = NULL;
        }
#endif

        for ( cpe_id = 0; cpe_id < nCPE_existing; cpe_id++ )
        {
@@ -264,10 +293,29 @@ ivas_error ivas_corecoder_dec_reconfig(
    if ( ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_dirac_stereo_flag && !sba_dirac_stereo_flag_old ) ||
         ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA && st_ivas->sba_dirac_stereo_flag && !sba_dirac_stereo_flag_old ) )
    {
#ifdef SBA2MONO
        /* if at least one CPE is already available, only allocate DFT Stereo struct */
        if ( st_ivas->nCPE > 0 )
        {
            if ( ( error = stereo_dft_dec_create( &( st_ivas->hCPE[0]->hStereoDft ), st_ivas->hCPE[0]->element_brate, st_ivas->hDecoderConfig->output_Fs, st_ivas->sba_dirac_stereo_flag, st_ivas->nchan_transport ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
        /* otherwise create extra dummy CPE */
        else
        {
            if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK )
            {
                return error;
            }
        }
#else
        if ( ( error = create_cpe_dec( st_ivas, 0, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK )
        {
            return error;
        }
#endif

        set_f( st_ivas->hCPE[0]->hStereoDft->buff_LBTCX_mem, 0, NS2SA( 16000, STEREO_DFT32MS_OVL_NS ) );

@@ -508,7 +556,11 @@ ivas_error ivas_cldfb_dec_reconfig(
    }

    /* CLDFB Interpolation weights */
#ifdef SBA2MONO
    if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) && numCldfbAnalyses != 0 && numCldfbSyntheses != 0 )
#else
    if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) )
#endif
    {
        ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig );
    }

lib_dec/ivas_cpe_dec.c

100644 → 100755
+4 −0
Original line number Diff line number Diff line
@@ -475,7 +475,11 @@ ivas_error ivas_cpe_dec(
        }
        else
        {
#ifdef SBA2MONO
            stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 );
#else
            stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0 );
#endif
        }

        /* synthesis iFFT */
Loading