Loading apps/renderer.c +20 −4 Original line number Diff line number Diff line Loading @@ -2023,12 +2023,28 @@ int main( if ( audioWriter != NULL ) { #endif #ifdef API_5MS int16_t zerosPadded = 0; zeroPad *= outBuffer.config.numChannels; while ( zeroPad > 0 ) { zerosPadded = min( zeroPad, outBufferSize ); memset( outInt16Buffer, 0, zerosPadded * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zerosPadded ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); exit( -1 ); } zeroPad -= zerosPadded; } #else memset( outInt16Buffer, 0, zeroPad * outBuffer.config.numChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPad * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); exit( -1 ); } #endif #ifdef SPLIT_REND_WITH_HEAD_ROT } #endif Loading lib_com/ivas_prot.h +7 −0 Original line number Diff line number Diff line Loading @@ -1216,6 +1216,13 @@ void ivas_get_ism_sid_quan_bitbudget( int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); #ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE void ivas_ism_dtx_limit_noise_energy_for_near_silence( SCE_DEC_HANDLE hSCE[], /* i/o: SCE encoder structures */ const int16_t sce_id_dtx, /* i : SCE DTX ID */ const int16_t nchan_transport /* i : number of transport channels */ ); #endif /*----------------------------------------------------------------------------------* * DFT Stereo prototypes Loading lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ #define FIX_549_PARAM_ISM_BIN_GAIN /* FhG: Issue 549 : fix too quiet binaural output in ParamISM */ #define FIX_618_STEREO_SW_DIV_BY_ZERO /* VA: fix issue 618 - UBSAN: division-by-zero in stereo bitrate switching */ #define FIX_625_IDX_OOB /* FhG: Fix index out-of-bounds UBSAN error (issue 625) */ #define FIX_613_DIRAC_NULL_PTR_USAN /* Nokia: Issue #613: USAN in DirAC decoder setup */ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ Loading @@ -241,10 +242,10 @@ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ #define CR_FIX_585_MASA_2TC_DTX_EXT /* Nokia: issue 585: fixes transition artifacts in MASA 2TC DTX by applying correct condition */ #define CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* FhG: fix for cng in ISM DTX on sudden silence periods */ /* ##################### End NON-BE CR switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading lib_dec/ivas_dec.c +21 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,16 @@ ivas_error ivas_dec( { return error; } #ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* decode dominant object first so the noise energy of the other objects can be limited */ if ( ( error = ivas_sce_dec( st_ivas, st_ivas->hISMDTX.sce_id_dtx, &output[st_ivas->hISMDTX.sce_id_dtx], output_frame, nb_bits_metadata[st_ivas->hISMDTX.sce_id_dtx] ) ) != IVAS_ERR_OK ) { return error; } ivas_ism_dtx_limit_noise_energy_for_near_silence( st_ivas->hSCE, st_ivas->hISMDTX.sce_id_dtx, st_ivas->nchan_transport ); #endif } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { Loading @@ -215,10 +225,21 @@ ivas_error ivas_dec( for ( n = 0; n < st_ivas->nchan_transport; n++ ) { #ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* for DTX frames, dominant object has already been decoded before */ if ( !( ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) && n == st_ivas->hISMDTX.sce_id_dtx ) ) { if ( ( error = ivas_sce_dec( st_ivas, n, &output[n], output_frame, nb_bits_metadata[n] ) ) != IVAS_ERR_OK ) { return error; } } #else if ( ( error = ivas_sce_dec( st_ivas, n, &output[n], output_frame, nb_bits_metadata[n] ) ) != IVAS_ERR_OK ) { return error; } #endif /* HP filtering */ hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); Loading lib_dec/ivas_ism_dtx_dec.c +49 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ *******************************************************************************************************/ #include <stdint.h> #include <math.h> #include "options.h" #include "ivas_prot.h" #include "prot.h" Loading Loading @@ -156,3 +157,51 @@ ivas_error ivas_ism_dtx_dec( return IVAS_ERR_OK; } #ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /*-------------------------------------------------------------------* * ivs_ism_dtx_limit_noise_energy_for_near_silence() * * for DTX frames where the energy of the sent noise estimate of the dominant object * is near silence, limit the other objects CNG energies to the same level *-------------------------------------------------------------------*/ void ivas_ism_dtx_limit_noise_energy_for_near_silence( SCE_DEC_HANDLE hSCE[], /* i/o: SCE encoder structures */ const int16_t sce_id_dtx, /* i : SCE DTX ID */ const int16_t nchan_transport /* i : number of transport channels */ ) { float fac, cng_noise_nrg_obj, cng_noise_nrg_dominant; int16_t ch, cng_noise_level_len; HANDLE_FD_CNG_COM hFdCngCom; hFdCngCom = hSCE[sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = hFdCngCom->stopFFTbin - hFdCngCom->startBand; cng_noise_nrg_dominant = dotp( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); if ( cng_noise_nrg_dominant < 1.f ) { for ( ch = 0; ch < nchan_transport; ch++ ) { if ( ch == sce_id_dtx ) { continue; } hFdCngCom = hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = hFdCngCom->stopFFTbin - hFdCngCom->startBand; cng_noise_nrg_obj = dotp( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); if ( cng_noise_nrg_obj > cng_noise_nrg_dominant ) { fac = sqrtf( cng_noise_nrg_dominant / cng_noise_nrg_obj ); v_multc( hFdCngCom->cngNoiseLevel, fac, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); } } } return; } #endif Loading
apps/renderer.c +20 −4 Original line number Diff line number Diff line Loading @@ -2023,12 +2023,28 @@ int main( if ( audioWriter != NULL ) { #endif #ifdef API_5MS int16_t zerosPadded = 0; zeroPad *= outBuffer.config.numChannels; while ( zeroPad > 0 ) { zerosPadded = min( zeroPad, outBufferSize ); memset( outInt16Buffer, 0, zerosPadded * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zerosPadded ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); exit( -1 ); } zeroPad -= zerosPadded; } #else memset( outInt16Buffer, 0, zeroPad * outBuffer.config.numChannels * sizeof( int16_t ) ); if ( ( error = AudioFileWriter_write( audioWriter, outInt16Buffer, zeroPad * outBuffer.config.numChannels ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nOutput audio file writer error\n" ); exit( -1 ); } #endif #ifdef SPLIT_REND_WITH_HEAD_ROT } #endif Loading
lib_com/ivas_prot.h +7 −0 Original line number Diff line number Diff line Loading @@ -1216,6 +1216,13 @@ void ivas_get_ism_sid_quan_bitbudget( int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); #ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE void ivas_ism_dtx_limit_noise_energy_for_near_silence( SCE_DEC_HANDLE hSCE[], /* i/o: SCE encoder structures */ const int16_t sce_id_dtx, /* i : SCE DTX ID */ const int16_t nchan_transport /* i : number of transport channels */ ); #endif /*----------------------------------------------------------------------------------* * DFT Stereo prototypes Loading
lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -230,6 +230,7 @@ #define FIX_549_PARAM_ISM_BIN_GAIN /* FhG: Issue 549 : fix too quiet binaural output in ParamISM */ #define FIX_618_STEREO_SW_DIV_BY_ZERO /* VA: fix issue 618 - UBSAN: division-by-zero in stereo bitrate switching */ #define FIX_625_IDX_OOB /* FhG: Fix index out-of-bounds UBSAN error (issue 625) */ #define FIX_613_DIRAC_NULL_PTR_USAN /* Nokia: Issue #613: USAN in DirAC decoder setup */ #define MASA_AND_OBJECTS /* Nokia: Combination of MASA and objects */ Loading @@ -241,10 +242,10 @@ /* any switch which is non-be wrt operation points tested in selection */ /* all switches in this category should start with "CR_" */ #define CR_FIX_585_MASA_2TC_DTX_EXT /* Nokia: issue 585: fixes transition artifacts in MASA 2TC DTX by applying correct condition */ #define CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* FhG: fix for cng in ISM DTX on sudden silence periods */ /* ##################### End NON-BE CR switches ########################### */ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ Loading
lib_dec/ivas_dec.c +21 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,16 @@ ivas_error ivas_dec( { return error; } #ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* decode dominant object first so the noise energy of the other objects can be limited */ if ( ( error = ivas_sce_dec( st_ivas, st_ivas->hISMDTX.sce_id_dtx, &output[st_ivas->hISMDTX.sce_id_dtx], output_frame, nb_bits_metadata[st_ivas->hISMDTX.sce_id_dtx] ) ) != IVAS_ERR_OK ) { return error; } ivas_ism_dtx_limit_noise_energy_for_near_silence( st_ivas->hSCE, st_ivas->hISMDTX.sce_id_dtx, st_ivas->nchan_transport ); #endif } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { Loading @@ -215,10 +225,21 @@ ivas_error ivas_dec( for ( n = 0; n < st_ivas->nchan_transport; n++ ) { #ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /* for DTX frames, dominant object has already been decoded before */ if ( !( ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) && n == st_ivas->hISMDTX.sce_id_dtx ) ) { if ( ( error = ivas_sce_dec( st_ivas, n, &output[n], output_frame, nb_bits_metadata[n] ) ) != IVAS_ERR_OK ) { return error; } } #else if ( ( error = ivas_sce_dec( st_ivas, n, &output[n], output_frame, nb_bits_metadata[n] ) ) != IVAS_ERR_OK ) { return error; } #endif /* HP filtering */ hp20( output[n], output_frame, st_ivas->mem_hp20_out[n], output_Fs ); Loading
lib_dec/ivas_ism_dtx_dec.c +49 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ *******************************************************************************************************/ #include <stdint.h> #include <math.h> #include "options.h" #include "ivas_prot.h" #include "prot.h" Loading Loading @@ -156,3 +157,51 @@ ivas_error ivas_ism_dtx_dec( return IVAS_ERR_OK; } #ifdef CR_FIX_ISM_DTX_INFINITE_CNG_ON_TRAILING_SILENCE /*-------------------------------------------------------------------* * ivs_ism_dtx_limit_noise_energy_for_near_silence() * * for DTX frames where the energy of the sent noise estimate of the dominant object * is near silence, limit the other objects CNG energies to the same level *-------------------------------------------------------------------*/ void ivas_ism_dtx_limit_noise_energy_for_near_silence( SCE_DEC_HANDLE hSCE[], /* i/o: SCE encoder structures */ const int16_t sce_id_dtx, /* i : SCE DTX ID */ const int16_t nchan_transport /* i : number of transport channels */ ) { float fac, cng_noise_nrg_obj, cng_noise_nrg_dominant; int16_t ch, cng_noise_level_len; HANDLE_FD_CNG_COM hFdCngCom; hFdCngCom = hSCE[sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = hFdCngCom->stopFFTbin - hFdCngCom->startBand; cng_noise_nrg_dominant = dotp( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); if ( cng_noise_nrg_dominant < 1.f ) { for ( ch = 0; ch < nchan_transport; ch++ ) { if ( ch == sce_id_dtx ) { continue; } hFdCngCom = hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom; cng_noise_level_len = hFdCngCom->stopFFTbin - hFdCngCom->startBand; cng_noise_nrg_obj = dotp( hFdCngCom->cngNoiseLevel, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); if ( cng_noise_nrg_obj > cng_noise_nrg_dominant ) { fac = sqrtf( cng_noise_nrg_dominant / cng_noise_nrg_obj ); v_multc( hFdCngCom->cngNoiseLevel, fac, hFdCngCom->cngNoiseLevel, cng_noise_level_len ); } } } return; } #endif