Commit 5765cafd authored by emerit's avatar emerit
Browse files

Merge branch 'main' into orange/ivas-codec-sym-hrir

parents d28f9190 607235da
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -645,7 +645,9 @@ int main(
                fprintf( stderr, "Sampling rate must be specified on command line when using raw PCM input\n" );
                exit( -1 );
            }
#ifndef FIX_389_EXT_REND_PCM_SR
            args.sampleRate = inFileSampleRate;
#endif
            break;
        default:
            fprintf( stderr, "Error: %s\n", ivas_error_to_string( error ) );
+2 −2
Original line number Diff line number Diff line
@@ -314,7 +314,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
@@ -390,7 +390,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
@@ -1205,6 +1205,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            */
@@ -3301,6 +3304,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             */
@@ -4619,7 +4628,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
);
+9 −0
Original line number Diff line number Diff line
@@ -154,6 +154,15 @@
#define FIX_CREND_BRIR_REVERB
#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 NOKIA_PARAMBIN_REQULARIZATION                   /* Nokia: Contribution - Configured reqularization factor for parametric binauralizer. */
#define NOKIA_ADAPTIVE_BINAURAL_PROTOS                  /* Nokia: Contribution 28: Adaptive binaural prototypes */
#define NOKIA_ADAPTIVE_BINAURAL_PROTOS_OPT              /* Nokia: enable adaptive binaural prototype complexity optimizations */

#define FIX_389_EXT_REND_PCM_SR                         /* Nokia: Issue 389: Fix assignment of sample rate with PCM input. */
#define FIX_390_EXT_REND_MASA_META_COPY                 /* Nokia: Issue 390: Fixes MASA metadata copying to renderer. */

/* ################## End DEVELOPMENT switches ######################### */
/* clang-format on */
#endif
+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 );
    }
Loading