Loading lib_com/ivas_prot.h 100644 → 100755 +9 −0 Original line number Diff line number Diff line Loading @@ -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 */ Loading Loading @@ -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 */ Loading lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -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) */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif lib_dec/ivas_corecoder_dec_reconfig.c +52 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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++ ) { Loading Loading @@ -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 ) ); Loading Loading @@ -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 lib_dec/ivas_cpe_dec.c 100644 → 100755 +4 −0 Original line number Diff line number Diff line Loading @@ -405,7 +405,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 lib_dec/ivas_dec.c +17 −0 Original line number Diff line number Diff line Loading @@ -339,10 +339,23 @@ ivas_error ivas_dec( nchan_remapped = st_ivas->nchan_transport; if ( st_ivas->sba_dirac_stereo_flag ) { #ifdef SBA2MONO nchan_remapped = nchan_out; #else nchan_remapped = CPE_CHANNELS; #endif if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { #ifdef SBA2MONO ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); if ( st_ivas->hSpar->hPCA != NULL ) { ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); } #endif ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi ); } Loading Loading @@ -416,7 +429,11 @@ ivas_error ivas_dec( ivas_dirac_dec( st_ivas, output, nchan_remapped, NULL, NULL, -1 ); } } #ifdef SBA2MONO else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) #else else if ( !st_ivas->sba_dirac_stereo_flag ) #endif { ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } Loading Loading
lib_com/ivas_prot.h 100644 → 100755 +9 −0 Original line number Diff line number Diff line Loading @@ -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 */ Loading Loading @@ -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 */ Loading
lib_com/options.h +2 −0 Original line number Diff line number Diff line Loading @@ -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) */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif
lib_dec/ivas_corecoder_dec_reconfig.c +52 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } Loading Loading @@ -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++ ) { Loading Loading @@ -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 ) ); Loading Loading @@ -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
lib_dec/ivas_cpe_dec.c 100644 → 100755 +4 −0 Original line number Diff line number Diff line Loading @@ -405,7 +405,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
lib_dec/ivas_dec.c +17 −0 Original line number Diff line number Diff line Loading @@ -339,10 +339,23 @@ ivas_error ivas_dec( nchan_remapped = st_ivas->nchan_transport; if ( st_ivas->sba_dirac_stereo_flag ) { #ifdef SBA2MONO nchan_remapped = nchan_out; #else nchan_remapped = CPE_CHANNELS; #endif if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { #ifdef SBA2MONO ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); if ( st_ivas->hSpar->hPCA != NULL ) { ivas_pca_dec( st_ivas->hSpar->hPCA, output_frame, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); } #endif ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi ); } Loading Loading @@ -416,7 +429,11 @@ ivas_error ivas_dec( ivas_dirac_dec( st_ivas, output, nchan_remapped, NULL, NULL, -1 ); } } #ifdef SBA2MONO else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) #else else if ( !st_ivas->sba_dirac_stereo_flag ) #endif { ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ } Loading