diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 672b5a7441735223fbdc3befbf75c92c674bcefe..88ddd63edc3393693fd97e07dea2e8a6aa4e14cd 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -1322,6 +1322,10 @@ void stereo_dft_dec( const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ const int16_t nchan_transport /* i : number of transpor channels */ +#ifdef FIX_STEREO_474 + , + const int16_t num_md_sub_frames /* i: number of MD subframes */ +#endif ); void stereo_dft_res_ecu( @@ -3561,6 +3565,10 @@ void ivas_sba_dirac_stereo_smooth_parameters( 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 */ +#ifdef FIX_STEREO_474 + , + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ +#endif ); void ivas_sba2mc_cldfb( diff --git a/lib_com/options.h b/lib_com/options.h index de0967fc1a4eaf72aa4a75d8187157ffe645525e..2e144edc5ff8cf60031b59861bd483f6c82d3fb4 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -211,6 +211,8 @@ #define FIX_DTX_428 /* FhG: fix for issue 428, crash with DTX and bitrate switching */ +#define FIX_STEREO_474 /* FhG fix for issue 574, crash with SBA to stereo output at 512 kbps */ + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 186d1c4c7daade77a393d4542142f78836852a11..3717501c831a671f3a92a58a7938a7ca54974846 100755 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -405,7 +405,12 @@ ivas_error ivas_cpe_dec( } else { - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 ); + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 +#ifdef FIX_STEREO_474 + , + MAX_PARAM_SPATIAL_SUBFRAMES +#endif + ); } /* synthesis iFFT */ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 089492048021527ec3d025ab1d6d3b96e25383df..3ae546193244df0d048fa8579a0048aabf2ef25b 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -693,6 +693,10 @@ void ivas_sba_dirac_stereo_smooth_parameters( 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 */ +#ifdef FIX_STEREO_474 + , + const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ +#endif ) { int16_t i, j, k, i_sf; @@ -732,6 +736,9 @@ void ivas_sba_dirac_stereo_smooth_parameters( float xfade_start_ns; int16_t xfade_delay_subframes; int16_t i_hist; +#ifdef FIX_STEREO_474 + int16_t md_sf; +#endif xfade_start_ns = cross_fade_start_offset / (float) output_Fs * 1000000000.f - IVAS_FB_ENC_DELAY_NS; xfade_delay_subframes = (int16_t) ( xfade_start_ns / ( FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) ); @@ -742,6 +749,11 @@ void ivas_sba_dirac_stereo_smooth_parameters( { for ( i_sf = k * 2; i_sf < ( k + 1 ) * 2; i_sf++ ) { + +#ifdef FIX_STEREO_474 + md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? i_sf : 0; +#endif + if ( hStereoDft->first_frame ) { for ( i = 0; i < 2; i++ ) @@ -786,7 +798,11 @@ void ivas_sba_dirac_stereo_smooth_parameters( { for ( b = 0; b < hStereoDft->nbands; b++ ) { +#ifdef FIX_STEREO_474 + hMdDec->mixer_mat_prev[4][i][j][b] = hMdDec->mixer_mat[i][j][b + md_sf * IVAS_MAX_NUM_BANDS]; +#else hMdDec->mixer_mat_prev[4][i][j][b] = hMdDec->mixer_mat[i][j][b + i_sf * IVAS_MAX_NUM_BANDS]; +#endif } } } @@ -881,7 +897,12 @@ void ivas_sba_dirac_stereo_dec( stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, - st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport ); + st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport +#ifdef FIX_STEREO_474 + , + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) +#endif + ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 08ca989f3d4a4f4a82ae02805682b96132513da3..cf5542f1e0dd6e8aaccc22fddcfc2606cc709383 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1131,6 +1131,10 @@ void stereo_dft_dec( const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ const int16_t nchan_transport /* i : number of transpor channels */ +#ifdef FIX_STEREO_474 + , + const int16_t num_md_sub_frames /* i: number of MD subframes */ +#endif ) { int16_t i, k, b, N_div, stop; @@ -1208,7 +1212,12 @@ void stereo_dft_dec( ivas_sba_dirac_stereo_smooth_parameters( hStereoDft, hMdDec, cross_fade_start_offset, - output_Fs ); + output_Fs +#ifdef FIX_STEREO_474 + , + num_md_sub_frames +#endif + ); } else {