From 0d8814817b957b1260adf9bea791658cd07d36f5 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 17 Feb 2023 12:47:38 +0100 Subject: [PATCH 01/45] - manual implementation of DISCRETE_ISM_DTX_CNG - all is BE, DiscISM DTX not tested yet --- lib_com/ivas_cnst.h | 11 +- lib_com/ivas_ism_config.c | 68 ++++++ lib_com/ivas_prot.h | 114 +++++++-- lib_com/ivas_stat_com.h | 8 + lib_com/options.h | 4 + lib_dec/ivas_dec.c | 8 + lib_dec/ivas_init_dec.c | 8 +- lib_dec/ivas_ism_dtx_dec.c | 72 ++++++ lib_dec/ivas_ism_metadata_dec.c | 411 +++++++++++++++++++++++++++++++- lib_dec/ivas_sce_dec.c | 24 ++ lib_dec/ivas_stat_dec.h | 3 + lib_enc/ivas_ism_dtx_enc.c | 194 +++++++++++++++ lib_enc/ivas_ism_enc.c | 50 +++- lib_enc/ivas_ism_metadata_enc.c | 213 +++++++++++++++++ lib_enc/ivas_stat_enc.h | 3 + 15 files changed, 1154 insertions(+), 37 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index d29a7d33fa..fab0fa0ab6 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -334,11 +334,20 @@ typedef enum #define PARAM_ISM_MAX_CHAN 16 #define PARAM_ISM_HYS_BUF_SIZE 10 +/* ISM DTX */ +#ifdef DISCRETE_ISM_DTX_CNG +#define ISM_DTX_COH_SCA_BITS 4 +#endif #ifdef PARAM_ISM_DTX_CNG -#define PARAM_ISM_DTX_COH_SCA_BITS 4 +#define PARAM_ISM_DTX_COH_SCA_BITS 4 // VE!!!!! to be removed #define PARAM_ISM_DTX_AZI_BITS 5 #define PARAM_ISM_DTX_ELE_BITS 4 #endif +#ifdef DISCRETE_ISM_DTX_CNG +#define ISM_DTX_ENER_BITS 4 +#define ISM_DTX_COH_SCA_BITS 4 +#endif + typedef enum { diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index b22d82a9da..3f4aa7ffd2 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -490,3 +490,71 @@ ISM_MODE ivas_ism_mode_select( return ism_mode; } + + +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------* + * update_last_metadata() + * + * Store last metadata values + *-------------------------------------------------------------------*/ + +void update_last_metadata( + const int16_t num_obj, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t updt_flag[] /* i : last metadata update flag */ +) +{ + int16_t ch; + + for ( ch = 0; ch < num_obj; ch++ ) + { + if ( updt_flag[ch] == 1 ) + { + hIsmMeta[ch]->last_azimuth = hIsmMeta[ch]->azimuth; + hIsmMeta[ch]->last_elevation = hIsmMeta[ch]->elevation; + } + } + + return; +} + + +/*----------------------------------------------------------------* + * ivas_get_ism_sid_quan_bitbudget() + * + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + +/*! r: low resolution flag */ +int16_t ivas_get_ism_sid_quan_bitbudget( + const int16_t num_obj, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + int16_t *nBits_ener, /* o : number of Q bits for energy */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +) +{ + int16_t low_res_q; + + low_res_q = 0; + *nBits_azimuth = ISM_AZIMUTH_NBITS; + *nBits_elevation = ISM_ELEVATION_NBITS; + *nBits_ener = ISM_DTX_ENER_BITS; + *nBits_coh = ISM_DTX_COH_SCA_BITS; + *nBits_sce_id = 1; + + if ( num_obj >= 3 ) + { + low_res_q = 1; + *nBits_azimuth = PARAM_ISM_DTX_AZI_BITS; + *nBits_elevation = PARAM_ISM_DTX_ELE_BITS; + *nBits_ener = ISM_DTX_ENER_BITS - 1; + *nBits_coh = ISM_DTX_COH_SCA_BITS - 1; + *nBits_sce_id = 2; + } + + return low_res_q; +} +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 8c46ce6f2e..74feb3b6b5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -834,9 +834,9 @@ float ism_dequant_meta( ); ivas_error set_ism_metadata( - ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ - float azimuth, /* i : azimuth */ - float elevation /* i : elevation */ + ISM_METADATA_HANDLE hIsmMeta, /* i/o: ISM metadata handle */ + float azimuth, /* i : azimuth */ + float elevation /* i : elevation */ ); ivas_error create_ism_metadata_enc( @@ -878,6 +878,9 @@ ivas_error ivas_ism_metadata_dec( const int16_t bfi, /* i : bfi flag */ int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ +#ifdef DISCRETE_ISM_DTX_CNG + int16_t *ism_dtx_hangover_cnt, /* i/o: DTX hangover counter */ +#endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ); @@ -951,48 +954,109 @@ void ivas_param_ism_params_to_masa_param_mapping( *----------------------------------------------------------------------------------*/ ivas_error ivas_ism_dtx_open( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ +); + +#ifdef DISCRETE_ISM_DTX_CNG +/*! r: indication of DTX frame */ +int16_t ivas_ism_dtx_enc_COMMON( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t md_diff_flag[], /* o : metadata differential flag */ + int16_t *sid_flag /* o : indication of SID frame */ +); +#endif +/*! r: indication of DTX frame */ +int16_t ivas_ism_dtx_enc( + Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ + int16_t *sid_flag /* o : indication of SID frame */ ); ivas_error ivas_ism_dtx_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - int16_t *nb_bits_metadata /* o : number of metadata bits */ + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + int16_t *nb_bits_metadata /* o : number of metadata bits */ ); +#ifdef DISCRETE_ISM_DTX_CNG +void ivas_ism_metadata_sid_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + const int16_t flag_noisy_speech, /* i : noisy speech flag */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t sid_flag, /* i : indication of SID frame */ + const int16_t md_diff_flag[], /* i : metadata differental flag */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +); +#endif // VE!!!!! + void ivas_param_ism_metadata_dtx_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ - ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ ); +#ifdef DISCRETE_ISM_DTX_CNG +ivas_error ivas_ism_metadata_sid_dec( + SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t bfi, /* i : bfi flag */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + int16_t *flag_noisy_speech, /* o : noisy speech flag */ + int16_t *sce_id_dtx, /* o : SCE DTX ID */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +); +#endif // VE!!!!! + void ivas_param_ism_metadata_dtx_dec( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); void ivas_ism_get_sce_id_dtx( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t input_frame /* i : input frame length per channel */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t input_frame /* i : input frame length per channel */ ); void ivas_param_ism_compute_noisy_speech_flag( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ + Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -/*! r: indication of DTX frame */ -int16_t ivas_ism_dtx_enc( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - int16_t *sid_flag /* o : indication of SID frame */ +void ivas_ism_coh_estim_dtx_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t input_frame /* i : input frame length */ ); -void ivas_ism_coh_estim_dtx_enc( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t input_frame /* i : input frame length */ +#ifdef DISCRETE_ISM_DTX_CNG +void update_last_metadata( + const int16_t num_obj, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t updt_flag[] /* i : last metadata update flag */ ); + +/*! r: low resolution flag */ +int16_t ivas_get_ism_sid_quan_bitbudget( + const int16_t num_obj, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + int16_t *nBits_ener, /* o : number of Q bits for energy */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +); +#endif #endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 5c9b60aceb..d9fab42ab6 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -58,6 +58,14 @@ typedef struct int16_t last_elevation_idx; /* last frame index of coded elevation */ int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ +#ifdef DISCRETE_ISM_DTX_CNG + float last_azimuth; /* last Q azimuth value */ + float last_elevation; /* last Q elevation value */ + + float last_true_azimuth; /* last true Q azimuth value */ + float last_true_elevation; /* last true Q elevation value */ +#endif + } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; diff --git a/lib_com/options.h b/lib_com/options.h index fe6c9fe2df..bccecd0420 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -177,6 +177,10 @@ #define SMOOTH_WITH_TRANS_DET #endif + +#define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index ec618917b7..2098e1f157 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -151,11 +151,19 @@ ivas_error ivas_dec( #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, &( st_ivas->ism_dtx_hangover_cnt ), st_ivas->hDirAC->hParamIsm ); +#else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); +#endif } else /* ISM_MODE_DISC */ { +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, &( st_ivas->ism_dtx_hangover_cnt ), NULL ); +#else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); +#endif } for ( n = 0; n < st_ivas->nchan_transport; n++ ) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 4e49799315..86fdf65309 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -245,6 +245,11 @@ ivas_error ivas_dec_setup( case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; break; +#ifdef DISCRETE_ISM_DTX + case SID_ISM: + st_ivas->element_mode_init = IVAS_SCE; + break; +#endif case SID_MASA_1TC: st_ivas->element_mode_init = IVAS_SCE; st_ivas->nchan_transport = 1; @@ -422,8 +427,8 @@ static ivas_error ivas_read_format( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; +#ifndef DISCRETE_ISM_DTX #ifdef PARAM_ISM_DTX_CNG - if ( st_ivas->ism_mode == ISM_MODE_DISC ) { ivas_ism_dec_config( st_ivas, 1 ); /* currently DTX supported for 1 ISM when ISM Mode is DISC_ISM */ @@ -435,6 +440,7 @@ static ivas_error ivas_read_format( } #else ivas_ism_dec_config( st_ivas, 1 ); /* currently DTX supported for 1ISM only */ +#endif #endif break; case SID_MULTICHANNEL: diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index bd15569f9e..b040b93ac8 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -99,6 +99,10 @@ ivas_error ivas_ism_dtx_dec( { int16_t ch, pos, num_obj, num_obj_prev; int32_t ivas_total_brate; +#ifdef DISCRETE_ISM_DTX_CNG + int16_t md_diff_flag[MAX_NUM_OBJECTS]; + int16_t flag_noisy_speech, sce_id; +#endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -153,7 +157,66 @@ ivas_error ivas_ism_dtx_dec( } /* Metadata decoding and dequantization */ +#ifdef DISCRETE_ISM_DTX_CNG +#if 1 + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + ivas_param_ism_metadata_dtx_dec( st_ivas ); + } + else +#endif + { + ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, + &flag_noisy_speech, &sce_id, st_ivas->hIsmMetaData, nb_bits_metadata ); + + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + { + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; + } + } + + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + { + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->hISMDTX.sce_id_dtx = sce_id; + } + else /* ism_mode == ISM_MODE_DISC */ + { + for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) + { + st_ivas->hSCE[ch]->hCoreCoder[0]->read_sid_info = 0; + } + st_ivas->hSCE[sce_id]->hCoreCoder[0]->read_sid_info = 1; + } + } + } +#else ivas_param_ism_metadata_dtx_dec( st_ivas ); +#endif + +#ifdef DISCRETE_ISM_DTX_CNG + set_s( md_diff_flag, 1, num_obj ); + //update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); // VE!!!!! + + st_ivas->ism_dtx_hangover_cnt = 0; + + if ( st_ivas->ism_mode != ISM_MODE_PARAM ) // VE!!!!! + { + /* set core_brate for all channels */ + for ( ch = 0; ch < num_obj; ch++ ) + { + st_ivas->hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; + } + + if ( ivas_total_brate == IVAS_SID_5k2 ) + { + st_ivas->hSCE[0]->hCoreCoder[0]->core_brate = SID_2k40; + } + } +#endif for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { @@ -167,6 +230,15 @@ ivas_error ivas_ism_dtx_dec( ivas_ism_preprocessing( st_ivas, ch ); } } +#ifdef DISCRETE_ISM_DTX_CNG + else + { + for ( ch = 1; ch < st_ivas->nchan_transport; ch++ ) + { + nb_bits_metadata[ch] = nb_bits_metadata[0]; + } + } +#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 94784e435c..814ccbffba 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -37,12 +37,95 @@ #include "ivas_rom_com.h" #include "prot.h" #include "ivas_stat_enc.h" +#ifdef DISCRETE_ISM_DTX_CNG +#include +#endif #ifdef DEBUGGING #include "debug.h" #endif #include "wmc_auto.h" +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------------* + * Local constants + *-------------------------------------------------------------------------*/ + +#define IVAS_ISM_DTX_HO_MAX 5 + +#define CNG_MD_MAX_DIFF_AZIMUTH 8 +#define CNG_MD_MAX_DIFF_ELEVATION 8 + + +/*-------------------------------------------------------------------* + * ism_metadata_smooth() + * + * Smooth the metadata evolution + *-------------------------------------------------------------------*/ + +static void ism_metadata_smooth( + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t num_obj /* i : number of objects */ +) +{ + ISM_METADATA_HANDLE hIsmMetaData; + int16_t ch; + float diff; + + for ( ch = 0; ch < num_obj; ch++ ) + { + hIsmMetaData = hIsmMeta[ch]; + + /* smooth azimuth */ + diff = hIsmMetaData->last_true_azimuth - hIsmMetaData->last_azimuth; + + if ( diff > ISM_AZIMUTH_MAX ) + { + diff -= ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + hIsmMetaData->last_azimuth += ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + else if ( diff < ISM_AZIMUTH_MIN ) + { + diff += ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + + if ( ism_total_brate > IVAS_SID_5k2 && fabsf( diff ) > IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_AZIMUTH ) + { + /* skip the smoothing */ + } + else if ( fabsf( diff ) > CNG_MD_MAX_DIFF_AZIMUTH ) + { + hIsmMetaData->azimuth = hIsmMetaData->last_azimuth + sign( diff ) * CNG_MD_MAX_DIFF_AZIMUTH; + } + else if ( diff != 0 ) + { + hIsmMetaData->azimuth = hIsmMetaData->last_true_azimuth; + } + + if ( hIsmMetaData->azimuth > ISM_AZIMUTH_MAX ) + { + hIsmMetaData->azimuth -= ( ISM_AZIMUTH_MAX - ISM_AZIMUTH_MIN ); + } + + /* smooth elevation */ + diff = hIsmMetaData->last_true_elevation - hIsmMetaData->last_elevation; + + if ( ism_total_brate > IVAS_SID_5k2 && diff > IVAS_ISM_DTX_HO_MAX * CNG_MD_MAX_DIFF_ELEVATION ) + { + /* skip the smoothing */ + } + else if ( fabsf( diff ) > CNG_MD_MAX_DIFF_ELEVATION ) + { + hIsmMetaData->elevation = hIsmMetaData->last_elevation + sign( diff ) * CNG_MD_MAX_DIFF_ELEVATION; + } + } + + return; +} +#endif + + /*-------------------------------------------------------------------------* * ivas_ism_metadata_dec() * @@ -50,13 +133,16 @@ *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - int16_t *nchan_transport, /* o : number of transport channels */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ - const int16_t bfi, /* i : bfi flag */ - int16_t nb_bits_metadata[], /* o : number of metadata bits */ - ISM_MODE ism_mode, /* i : ISM mode */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + int16_t *nchan_transport, /* o : number of transport channels */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ + const int16_t bfi, /* i : bfi flag */ + int16_t nb_bits_metadata[], /* o : number of metadata bits */ + ISM_MODE ism_mode, /* i : ISM mode */ +#ifdef DISCRETE_ISM_DTX_CNG + int16_t *ism_dtx_hangover_cnt, /* i/o: DTX hangover counter */ +#endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ) { @@ -72,6 +158,9 @@ ivas_error ivas_ism_metadata_dec( int16_t localVAD[MAX_NUM_OBJECTS]; int16_t ism_imp[MAX_NUM_OBJECTS]; int16_t num_obj = 0, nbands, nblocks; +#ifdef DISCRETE_ISM_DTX_CNG + int16_t md_diff_flag[MAX_NUM_OBJECTS]; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -359,6 +448,12 @@ ivas_error ivas_ism_metadata_dec( /* updates */ hIsmMetaData->last_azimuth_idx = idx_azimuth; hIsmMetaData->last_elevation_idx = idx_elevation; + +#ifdef DISCRETE_ISM_DTX_CNG + /* save for smoothing metadata evolution */ + hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; + hIsmMetaData->last_true_elevation = hIsmMetaData->elevation; +#endif } /* save number of metadata bits read */ @@ -449,6 +544,14 @@ ivas_error ivas_ism_metadata_dec( } } +#ifdef DISCRETE_ISM_DTX_CNG + if ( *ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) + { + //ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); // VE!!!!! + } + *ism_dtx_hangover_cnt = min( ( *ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); +#endif + /*----------------------------------------------------------------* * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ @@ -489,6 +592,10 @@ ivas_error ivas_ism_metadata_dec( } } + /*----------------------------------------------------------------* + * Set bitsream pointers + *----------------------------------------------------------------*/ + /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; @@ -499,6 +606,15 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->bit_stream = hSCE[ch - 1]->hCoreCoder[0]->bit_stream + ( hSCE[ch - 1]->hCoreCoder[0]->total_brate / FRAMES_PER_SEC ); } +#ifdef DISCRETE_ISM_DTX_CNG + /*----------------------------------------------------------------* + * Updates + *----------------------------------------------------------------*/ + + set_s( md_diff_flag, 1, num_obj ); + update_last_metadata( *nchan_transport, hIsmMeta, md_diff_flag ); +#endif + #ifdef PARAM_ISM_DTX_CNG for ( ch = 0; ch < *nchan_transport; ch++ ) { @@ -538,10 +654,291 @@ ivas_error create_ism_metadata_dec( st_ivas->hIsmMetaData[ch]->last_azimuth_idx = 0; st_ivas->hIsmMetaData[ch]->last_elevation_idx = 1 << ( ISM_ELEVATION_NBITS - 1 ); +#ifdef DISCRETE_ISM_DTX_CNG + st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0; + st_ivas->hIsmMetaData[ch]->last_true_elevation = 0; +#endif + ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); +#ifdef DISCRETE_ISM_DTX_CNG + st_ivas->ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; +#endif + + return IVAS_ERR_OK; +} + + +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------* + * ivas_ism_dec_dequantize_DOA_dtx() + * + * + *-------------------------------------------------------------------*/ + +static void ivas_ism_dec_dequantize_DOA_dtx( + const int16_t azi_bits, + const int16_t ele_bits, + const int16_t azi_idx, + const int16_t ele_idx, + float *azi_val, + float *ele_val ) +{ + int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha, tmp_alpha; + + /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ + nbits = min( azi_bits, ele_bits ); + + if ( nbits == ISM_ELEVATION_NBITS ) + { + angle_spacing = 5; + } + else + { + angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); + } + + npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); + + /* sanity check */ + if ( angle_spacing == 360 ) + { + assert( azi_idx == 0 ); + assert( ele_idx == 0 ); + + *azi_val = 0.f; + *ele_val = 0.f; + return; + } + + /* Get the azimuth and elevation values */ + ele_alpha = 2 * npoints - 1; + assert( ( 0 <= ele_idx ) && ( ele_idx < ele_alpha ) ); + *ele_val = (float) ( ( ele_idx - npoints ) * angle_spacing ); + + az_alpha = 4 * npoints - 1; + assert( ( 0 <= azi_idx ) && ( azi_idx < az_alpha ) ); + tmp_alpha = (int16_t) ( azi_idx * ( 360.f / az_alpha ) ); + + if ( tmp_alpha > 180.0f ) + { + *azi_val = ( (float) tmp_alpha ) - 360.0f; + } + else + { + *azi_val = (float) tmp_alpha; + } + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_ism_metadata_sid_dec() + * + * Decode ISM metadata in SID frame + *-------------------------------------------------------------------*/ + +ivas_error ivas_ism_metadata_sid_dec( + SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t bfi, /* i : bfi flag */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels*/ + const ISM_MODE ism_mode, /* i : ISM mode */ + int16_t *flag_noisy_speech, /* o : noisy speech flag */ + int16_t *sce_id_dtx, /* o : SCE DTX ID */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +) +{ + int16_t i, ch, nb_bits_start, last_bit_pos, low_res_q; + int16_t idx, idx_azimuth, idx_elevation; + int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + int16_t md_diff_flag[MAX_NUM_OBJECTS]; + ISM_MODE ism_mode_bstr; + DEC_CORE_HANDLE st0; + ISM_METADATA_HANDLE hIsmMetaData; + int16_t next_bit_pos_orig; + uint16_t bstr_meta[IVAS_SID_5k2 / FRAMES_PER_SEC], *bstr_orig; + + if ( ism_total_brate == FRAME_NO_DATA ) + { + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + + return IVAS_ERR_OK; + } + + /* initialization */ + st0 = hSCE[0]->hCoreCoder[0]; + + nb_bits_start = 0; + last_bit_pos = (int16_t) ( ( ism_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); + bstr_orig = st0->bit_stream; + next_bit_pos_orig = st0->next_bit_pos; + st0->next_bit_pos = 0; + + /* reverse the bitstream for easier reading of indices */ + for ( i = 0; i < min( MAX_BITS_METADATA, last_bit_pos ); i++ ) + { + bstr_meta[i] = st0->bit_stream[last_bit_pos - i]; + } + st0->bit_stream = bstr_meta; + st0->total_brate = ism_total_brate; /* needed for BER detection in get_next_indice() */ + + if ( !bfi ) + { + /* take into account padding bits as metadata bits to keep later bitrate checks valid */ + nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + + /*----------------------------------------------------------------* + * ISm common signaling + *----------------------------------------------------------------*/ + + /* number of objects was already read in ivas_ism_get_dtx_dec() */ + /* update the position in the bitstream */ + st0->next_bit_pos += num_obj; + + /* read SID metadata flag( one per object ) */ + for ( ch = 0; ch < num_obj; ch++ ) + { + md_diff_flag[ch] = get_next_indice( st0, 1 ); + } + + /*----------------------------------------------------------------* + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + + low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + + /*----------------------------------------------------------------* + * Spatial parameters, loop over TCs - 1 + *----------------------------------------------------------------*/ + + *flag_noisy_speech = 0; + *sce_id_dtx = 0; + + /* write ISM mode flag to explicitly signal number of spatial parameters */ + if ( num_obj > 2 ) + { + idx = get_next_indice( st0, 1 ); + ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + + if ( ism_mode_bstr != ism_mode ) + { + return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\n!!! Error: Switching ISM mode in CNG not verified yet. Exiting.\n\n" ); + } + + if ( ism_mode_bstr == ISM_MODE_PARAM ) + { + /* read noisy speech flag */ + *flag_noisy_speech = get_next_indice( st0, 1 ); + } + } + + if ( nchan_transport > 1 ) + { + /* read sce id */ + *sce_id_dtx = get_next_indice( st0, nBits_sce_id ); + + /* decode the coherence */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + if ( ch == *sce_id_dtx ) + { + hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = 1.0f; + continue; + } + + idx = get_next_indice( st0, nBits_coh ); + hSCE[ch]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = (float) ( idx ) / (float) ( ( 1 << nBits_coh ) - 1 ); + } + } + else + { + *sce_id_dtx = 0; + } + + /*----------------------------------------------------------------* + * Metadata decoding and dequantization, loop over all objects + *----------------------------------------------------------------*/ + + for ( ch = 0; ch < num_obj; ch++ ) + { + hIsmMetaData = hIsmMeta[ch]; + + if ( md_diff_flag[ch] == 1 ) + { + if ( low_res_q ) + { + idx_azimuth = get_next_indice( st0, nBits_azimuth ); + idx_elevation = get_next_indice( st0, nBits_elevation ); + + ivas_ism_dec_dequantize_DOA_dtx( nBits_azimuth, nBits_elevation, idx_azimuth, idx_elevation, &( hIsmMetaData->azimuth ), &( hIsmMetaData->elevation ) ); + } + else + { + /* Azimuth decoding */ + idx_azimuth = get_next_indice( st0, nBits_azimuth ); + + /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ + if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_azimuth -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ + } + else if ( idx_azimuth < 0 ) + { + idx_azimuth += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ + } + + /* +180° == -180° */ + if ( idx_azimuth == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_azimuth = 0; + } + + /* sanity check in case of FER or BER */ + if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) + { + idx_azimuth = hIsmMetaData->last_azimuth_idx; + } + + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + + /* Elevation decoding */ + idx_elevation = get_next_indice( st0, nBits_elevation ); + + /* sanity check in case of FER or BER */ + if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) + { + idx_elevation = hIsmMetaData->last_elevation_idx; + } + + /* Elevation dequantization */ + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + } + + // VE: ToDo: this would not work well for switching from low_res_q to active frame coding + hIsmMetaData->last_azimuth_idx = idx_azimuth; + hIsmMetaData->last_elevation_idx = idx_elevation; + + /* save for smoothing metadata evolution */ + hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; + hIsmMetaData->last_true_elevation = hIsmMetaData->elevation; + } + } + + /* set the bitstream pointer to its original position */ + st0->bit_stream = bstr_orig; + st0->next_bit_pos = next_bit_pos_orig; + } + + /* smooth the metadata evolution */ + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + return IVAS_ERR_OK; } +#endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index a09c0bb4e7..cdf6cbb875 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -82,6 +82,23 @@ ivas_error ivas_sce_dec( { st->cng_type = FD_CNG; /* TODO: move to init if possible */ } + +#ifdef DISCRETE_ISM_DTX_CNG + // VE!!!!! + if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC && st_ivas->nchan_transport > 1 ) // VE!!!!! keep bitexactness for 1ISM case for now + { + if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) + { + /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ + st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; + st->cng_paramISM_flag = 1; + } + else + { + st->cng_paramISM_flag = 0; + } + } +#endif #endif /*------------------------------------------------------------------* @@ -98,6 +115,12 @@ ivas_error ivas_sce_dec( { st->total_brate = ivas_total_brate; } +#ifdef DISCRETE_ISM_DTX_CNG + else if ( !st_ivas->bfi && st_ivas->ivas_format != ISM_FORMAT && last_ivas_total_brate <= IVAS_SID_5k2 ) + { + st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; + } +#else else if ( !st_ivas->bfi && ( last_ivas_total_brate <= SID_2k40 || last_ivas_total_brate == IVAS_SID_5k2 ) ) { #ifdef PARAM_ISM_DTX_CNG @@ -110,6 +133,7 @@ ivas_error ivas_sce_dec( st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; #endif } +#endif /* read the bandwidth */ if ( st_ivas->bfi || st->total_brate <= SID_2k40 ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 3d9ed18351..3b0e99c4c2 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1968,6 +1968,9 @@ typedef struct Decoder_Struct int16_t sba_planar; /* Ambisonic (SBA) planar flag */ int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ +#ifdef DISCRETE_ISM_DTX_CNG + int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ +#endif /* rendering modules */ RENDERER_TYPE renderer_type; /* renderer type */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index ab531bc291..fa652d1a07 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -41,7 +41,17 @@ #endif #include "wmc_auto.h" + #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG +/*-----------------------------------------------------------------------* + * Local constants + *-----------------------------------------------------------------------*/ + +#define MD_MAX_DIFF_AZIMUTH 15 +#define MD_MAX_DIFF_ELEVATION 15 +#endif + /*-------------------------------------------------------------------* * ivas_ism_dtx_open() @@ -67,6 +77,9 @@ ivas_error ivas_ism_dtx_open( hISMDTX->dtx_flag = 0; hISMDTX->sce_id_dtx = 0; +#ifdef DISCRETE_ISM_DTX_CNG + hISMDTX->cnt_SID_ISM = -1; +#endif set_s( hISMDTX->dtx_speech_buffer_enc, 0, PARAM_ISM_HYS_BUF_SIZE ); @@ -83,6 +96,187 @@ ivas_error ivas_ism_dtx_open( } +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------* + * ivas_ism_get_dtx_enc() + * + * Analysis and decision about DTX in ISM format + *-------------------------------------------------------------------*/ + +/*! r: indication of DTX frame */ +int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + int16_t md_diff_flag[], /* o : metadata differential flag */ + int16_t *sid_flag /* o : indication of SID frame */ +) +{ + int16_t ch, dtx_flag; + int16_t nBits, nBits_MD_max; + int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; + + /*------------------------------------------------------------------* + * compute global ISM DTX flag + *-----------------------------------------------------------------*/ + + /* compute global ISM based on localVAD */ + dtx_flag = 1; + for ( ch = 0; ch < num_obj; ch++ ) + { + dtx_flag &= !vad_flag[ch]; + } + + /* compute global ISM based on long-term background noise */ + /* one of the channels is active -> no DTX */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + lp_noise[ch] = hSCE[ch]->hCoreCoder[0]->lp_noise; + } + + lp_noise_variation = var( lp_noise, num_obj ); + lp_noise_mean = mean( lp_noise, num_obj ); + + if ( lp_noise_mean > 50 || ( lp_noise_mean > 10 && lp_noise_variation > 2 ) ) + { + // dtx_flag = 0; // VE!!!!! + } + + /*------------------------------------------------------------------* + * Reset the bitstream + *-----------------------------------------------------------------*/ + + if ( dtx_flag ) + { + /* reset the bitstream (IVAS format signaling was already written) */ + reset_indices_enc( hSCE[0]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); + } + + /*------------------------------------------------------------------* + * decide about SID metadata to be sent or not (per object) + * estimate the MD bit-budget consumption + *-----------------------------------------------------------------*/ + + if ( dtx_flag ) + { + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + + nBits = 0; + for ( ch = 0; ch < num_obj; ch++ ) + { + /* check difference between current and last metadata */ + md_diff_flag[ch] = 0; + if ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_azimuth ) > MD_MAX_DIFF_AZIMUTH ) + { + md_diff_flag[ch] = 1; + } + + if ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_elevation ) > MD_MAX_DIFF_ELEVATION ) + { + md_diff_flag[ch] = 1; + } + + /* estimate SID metadata bit-budget */ + nBits++; /* number of objects */ + nBits++; /* SID metadata flag */ + if ( md_diff_flag[ch] == 1 ) + { + nBits += nBits_azimuth; + nBits += nBits_elevation; + } + } + + /* calculate maximum available MD bit-budget */ + nBits_MD_max = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + nBits_MD_max -= SID_FORMAT_NBITS; + if ( nchan_transport > 1 ) + { + nBits_MD_max -= nBits_sce_id; + } + + for ( ch = 0; ch < nchan_transport - 1; ch++ ) + { + nBits_MD_max -= nBits_coh; /* coherence */ + } + + if ( num_obj > 3 ) + { + nBits_MD_max--; /* ism_mode flag */ + } + + /* too many metadata bits -> switch to active coding */ + if ( nBits > nBits_MD_max ) + { + dtx_flag = 0; + } + } + + /*------------------------------------------------------------------* + * set core_brate for all channels + * get 'sid_flag' value + *-----------------------------------------------------------------*/ + + *sid_flag = 0; + + if ( !dtx_flag ) + { + /* at least one of the channels is active -> no DTX */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->core_brate = -1; + } + + hISMDTX->cnt_SID_ISM = -1; + + /* IVAS format signaling was erased in dtx() */ + if ( hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot == 0 ) + { + push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, 2 /* == ISM format */, IVAS_FORMAT_SIGNALING_NBITS ); + } + } + else /* ism_dtx_flag == 1 */ + { + for ( ch = 0; ch < num_obj; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->cng_type = FD_CNG; + } + + /* * update the global SID counter */ + hISMDTX->cnt_SID_ISM++; + if ( hISMDTX->cnt_SID_ISM >= hSCE[0]->hCoreCoder[0]->hDtxEnc->max_SID ) + { + /* adaptive SID update interval */ + hSCE[0]->hCoreCoder[0]->hDtxEnc->max_SID = hSCE[0]->hCoreCoder[0]->hDtxEnc->interval_SID; + hISMDTX->cnt_SID_ISM = 0; + } + + /* encode SID in one channel only */ + for ( ch = 0; ch < num_obj; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; + } + + if ( hISMDTX->cnt_SID_ISM == 0 ) + { + hSCE[hISMDTX->sce_id_dtx]->hCoreCoder[0]->core_brate = SID_2k40; + *sid_flag = 1; + } + } + + if ( dtx_flag == 1 && *sid_flag == 0 ) + { + set_s( md_diff_flag, 0, num_obj ); + } + + return dtx_flag; +} +#endif + + /*-------------------------------------------------------------------* * ivas_ism_dtx_enc() * diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 9f9637d95e..43268069ca 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -87,7 +87,12 @@ ivas_error ivas_ism_enc( int16_t localVAD_HE_SAD[1]; /* local HE VAD */ int16_t i, nBits; #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + int16_t num_obj, dtx_flag, sid_flag; + int16_t md_diff_flag[MAX_NUM_OBJECTS]; +#else int16_t dtx_flag, sid_flag; +#endif #endif ivas_error error; @@ -102,6 +107,19 @@ ivas_error ivas_ism_enc( #ifdef PARAM_ISM_DTX_CNG dtx_flag = 0; sid_flag = 0; + +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + num_obj = st_ivas->hDirAC->hParamIsm->num_obj; + } + else /* ism_mode == ISM_MODE_DISC */ + { + num_obj = st_ivas->nchan_transport; + } + + set_s( md_diff_flag, 1, num_obj ); +#endif #endif /*------------------------------------------------------------------* @@ -184,13 +202,24 @@ ivas_error ivas_ism_enc( * DTX analysis *-----------------------------------------------------------------*/ +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->hEncoderConfig->Opt_DTX_ON && num_obj > 1 ) // VE!!!!! keep bitexactness for 1ISM case for now +#else if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) +#endif { /* compute the dominant sce_id using long term energy */ ivas_ism_get_sce_id_dtx( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); /* analysis and decision about DTX */ - dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->ism_mode != ISM_MODE_PARAM ) + { + dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); + } + else +#endif + dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); if ( sid_flag ) { @@ -199,7 +228,7 @@ ivas_error ivas_ism_enc( } #ifdef DEBUG_MODE_PARAM_ISM - dbgwrite( &( st_ivas->hISMDTX->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); + dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif } @@ -218,7 +247,14 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { - if ( sid_flag ) +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->ism_mode != ISM_MODE_PARAM ) + { + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm->flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); + } + else +#endif + if ( sid_flag ) { ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); } @@ -265,6 +301,10 @@ ivas_error ivas_ism_enc( ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); } +#ifdef DISCRETE_ISM_DTX_CNG + update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); +#endif + /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ @@ -276,7 +316,11 @@ ivas_error ivas_ism_enc( ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + if ( num_obj == 1 ) // VE!!!!! keep bitexactness for 1ISM case for now +#else if ( st_ivas->ism_mode != ISM_MODE_PARAM ) +#endif #endif { /* write unused bits */ diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 9aaa3af4b4..c06eeb9b86 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -764,9 +764,222 @@ ivas_error create_ism_metadata_enc( st_ivas->hIsmMetaData[ch]->last_ism_metadata_flag = 0; ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); + +#ifdef DISCRETE_ISM_DTX_CNG + st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f; + st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f; +#endif } ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); return IVAS_ERR_OK; } + + +#ifdef DISCRETE_ISM_DTX_CNG +/*-------------------------------------------------------------------* + * ivas_ism_quantize_DOA_dtx() + * + * + *-------------------------------------------------------------------*/ + +static void ivas_ism_quantize_DOA_dtx( + const float azimuth, + const float elevation, + const int16_t azi_bits, + const int16_t ele_bits, + int16_t *azi_idx, + int16_t *ele_idx ) +{ + int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha; + float azi_val; + + /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ + nbits = min( azi_bits, ele_bits ); + + if ( nbits == ISM_ELEVATION_NBITS ) + { + angle_spacing = 5; + } + else + { + angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); + } + + npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); + + /* Step 2: Quantize Elevation */ + ele_alpha = 2 * npoints - 1; + *ele_idx = (int16_t) ( ( elevation / angle_spacing ) + 0.5f ) + npoints; + if ( *ele_idx >= ele_alpha ) + { + *ele_idx = ele_alpha - 1; + } + assert( ( 0 <= *ele_idx ) && ( *ele_idx < ele_alpha ) ); + + /* Step 3: Quantize Azimuth */ + az_alpha = 4 * npoints - 1; + + /* Convert azimuth in {-180,180} into {0,360} before quantization */ + if ( azimuth >= 0 ) + { + azi_val = azimuth; + } + else + { + azi_val = azimuth + 360.f; + } + + /* Obtain the index of quantized azimuth values */ + *azi_idx = (int16_t) ( ( ( azi_val / 360.f ) * az_alpha ) + 0.5f ); + if ( *azi_idx == az_alpha ) + { + /*wrap around the azimuth angle*/ + *azi_idx = 0; + } + assert( ( 0 <= *azi_idx ) && ( *azi_idx < az_alpha ) ); + + return; +} + + +/*-------------------------------------------------------------------* + * ivas_ism_metadata_sid_enc() + * + * Quantize and encode ISM metadata in SID frame + *-------------------------------------------------------------------*/ + +void ivas_ism_metadata_sid_enc( + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + const int16_t flag_noisy_speech, /* i : noisy speech flag */ + const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const ISM_MODE ism_mode, /* i : ISM mode */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t sid_flag, /* i : indication of SID frame */ + const int16_t md_diff_flag[], /* i : metadata differental flag */ + BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ + int16_t nb_bits_metadata[] /* o : number of metadata bits */ +) +{ + int16_t i, ch, nBits, nBits_start, nBits_unused, low_res_q; + int16_t idx, idx_azimuth, idx_elevation; + int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + float valQ; + ISM_METADATA_HANDLE hIsmMetaData; + + if ( sid_flag ) + { + nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + nBits -= SID_FORMAT_NBITS; + nBits_start = hBstr->nb_bits_tot; + + /*----------------------------------------------------------------* + * Write ISm common signaling + *----------------------------------------------------------------*/ + + /* write number of objects - unary coding */ + for ( ch = 1; ch < num_obj; ch++ ) + { + push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); + } + push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); + + /* write SID metadata flag (one per object) */ + for ( ch = 0; ch < num_obj; ch++ ) + { + push_indice( hBstr, IND_ISM_METADATA_FLAG, md_diff_flag[ch], 1 ); + } + + /*----------------------------------------------------------------* + * Set quantization bits based on the number of coded objects + *----------------------------------------------------------------*/ + + low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + + /*----------------------------------------------------------------* + * Spatial parameters, loop over TCs - 1 + *----------------------------------------------------------------*/ + + /* write ISM mode flag to explicitly signal number of spatial parameters */ + if ( num_obj > 2 ) + { + if ( ism_mode == ISM_MODE_DISC ) + { + push_indice( hBstr, IND_ISM_VAD_FLAG, 0, 1 ); + } + else + { + push_indice( hBstr, IND_ISM_VAD_FLAG, 1, 1 ); + } + + if ( ism_mode == ISM_MODE_PARAM ) + { + /* write noisy speech flag */ + push_indice( hBstr, IND_ISM_NOISY_SPEECH_FLAG, flag_noisy_speech, 1 ); + } + } + + if ( nchan_transport > 1 ) + { + /* write sce id */ + push_indice( hBstr, IND_ISM_SCE_ID_DTX, hISMDTX->sce_id_dtx, nBits_sce_id ); + + /* quantize and write coherence */ + for ( ch = 0; ch < nchan_transport; ch++ ) + { + if ( ch == hISMDTX->sce_id_dtx ) + { + continue; + } + + idx = (int16_t) ( hISMDTX->coh[ch] * ( ( 1 << nBits_coh ) - 1 ) + 0.5f ); + assert( ( idx >= 0 ) && ( idx <= ( ( 1 << nBits_coh ) - 1 ) ) ); + push_indice( hBstr, IND_ISM_DTX_COH_SCA, idx, nBits_coh ); + } + } + + /*----------------------------------------------------------------* + * Metadata quantization and coding, loop over all objects + *----------------------------------------------------------------*/ + + for ( ch = 0; ch < num_obj; ch++ ) + { + if ( md_diff_flag[ch] == 1 ) + { + hIsmMetaData = hIsmMeta[ch]; + + if ( low_res_q ) + { + ivas_ism_quantize_DOA_dtx( hIsmMetaData->azimuth, hIsmMetaData->elevation, nBits_azimuth, nBits_elevation, &idx_azimuth, &idx_elevation ); + } + else + { + idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); + idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); + } + + push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); + push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); + + hIsmMetaData->last_azimuth_idx = idx_azimuth; + hIsmMetaData->last_elevation_idx = idx_elevation; + } + } + + /* Write unused (padding) bits */ + nBits_unused = nBits - hBstr->nb_bits_tot; + while ( nBits_unused > 0 ) + { + i = min( nBits_unused, 16 ); + push_indice( hBstr, IND_UNUSED, 0, i ); + nBits_unused -= i; + } + + nb_bits_metadata[0] = hBstr->nb_bits_tot - nBits_start; + } + + return; +} +#endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 1f88d0c0c1..69125f91c3 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -561,6 +561,9 @@ typedef struct int16_t dtx_flag; int16_t sce_id_dtx; +#ifdef DISCRETE_ISM_DTX_CNG + int16_t cnt_SID_ISM; +#endif // VE!!!!! int16_t dtx_speech_buffer_enc[PARAM_ISM_HYS_BUF_SIZE]; float long_term_energy_stereo_dmx_enc[MAX_NUM_OBJECTS][PARAM_ISM_HYS_BUF_SIZE]; -- GitLab From 69f3add690f863e64f1ce780f74cab24a94d4038 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 17 Feb 2023 13:06:09 +0100 Subject: [PATCH 02/45] fixes to DiscISM DTX - first ~working version (tested 4ISMs with MD) --- lib_dec/ivas_init_dec.c | 2 +- lib_enc/ivas_init_enc.c | 4 ++++ lib_enc/ivas_ism_dtx_enc.c | 4 ++++ lib_enc/ivas_ism_enc.c | 15 ++++++++++++--- lib_enc/lib_enc.c | 17 +++++++++++------ 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 86fdf65309..cdd724cc2d 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -427,7 +427,7 @@ static ivas_error ivas_read_format( break; case SID_ISM: st_ivas->ivas_format = ISM_FORMAT; -#ifndef DISCRETE_ISM_DTX +#ifndef DISCRETE_ISM_DTX_CNG #ifdef PARAM_ISM_DTX_CNG if ( st_ivas->ism_mode == ISM_MODE_DISC ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 8995ebe92a..9301f43d80 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -443,7 +443,11 @@ ivas_error ivas_init_encoder( } #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) +#else if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) +#endif { if ( ( error = ivas_ism_dtx_open( st_ivas ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index fa652d1a07..63e94c8ff9 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -486,7 +486,11 @@ void ivas_ism_coh_estim_dtx_enc( { Encoder_State *st, *st_id0; int16_t sce_id, i; +#ifdef DISCRETE_ISM_DTX_CNG + float acorr_ene[MAX_NUM_OBJECTS], xcorr_ene; +#else float acorr_ene[PARAM_ISM_MAX_DMX], xcorr_ene; +#endif if ( nchan_transport == 1 ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 43268069ca..845c123d56 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -88,7 +88,7 @@ ivas_error ivas_ism_enc( int16_t i, nBits; #ifdef PARAM_ISM_DTX_CNG #ifdef DISCRETE_ISM_DTX_CNG - int16_t num_obj, dtx_flag, sid_flag; + int16_t num_obj, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; #else int16_t dtx_flag, sid_flag; @@ -107,6 +107,7 @@ ivas_error ivas_ism_enc( #ifdef PARAM_ISM_DTX_CNG dtx_flag = 0; sid_flag = 0; + flag_noisy_speech = 0; #ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->ism_mode == ISM_MODE_PARAM ) @@ -228,7 +229,8 @@ ivas_error ivas_ism_enc( } #ifdef DEBUG_MODE_PARAM_ISM - dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); + if ( st_ivas->hDirAC != NULL ) + dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif } @@ -243,6 +245,9 @@ ivas_error ivas_ism_enc( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { ivas_param_ism_compute_noisy_speech_flag( st_ivas ); +#ifdef DISCRETE_ISM_DTX_CNG + flag_noisy_speech = st_ivas->hDirAC->hParamIsm->flag_noisy_speech; +#endif } if ( dtx_flag ) @@ -250,7 +255,7 @@ ivas_error ivas_ism_enc( #ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { - ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm->flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); } else #endif @@ -311,7 +316,11 @@ ivas_error ivas_ism_enc( st = st_ivas->hSCE[0]->hCoreCoder[0]; +#ifdef DISCRETE_ISM_DTX_CNG + if ( st->core_brate == SID_2k40 || sid_flag ) // VE!!!!! to be simplified +#else if ( st->core_brate == SID_2k40 ) +#endif { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 33f1d02437..613d6063c2 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -875,12 +875,15 @@ static ivas_error configureEncoder( #ifdef PARAM_ISM_DTX_CNG if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && - ( ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp == 2 ) || // ToDo: see Issue 113 - ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 2 && hEncoderConfig->ivas_total_brate != IVAS_24k4 && hEncoderConfig->ivas_total_brate != IVAS_32k ) || // ParamISM - ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation - ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done - hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD - ) ) + ( +#ifndef DISCRETE_ISM_DTX_CNG + ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp == 2 ) || // ToDo: see Issue 113 + ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 2 && hEncoderConfig->ivas_total_brate != IVAS_24k4 && hEncoderConfig->ivas_total_brate != IVAS_32k ) || // ParamISM +#endif + ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation + ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done + hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD + ) ) #else if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && ( ( hEncoderConfig->ivas_format == ISM_FORMAT && hEncoderConfig->nchan_inp > 1 ) || // ToDo: see Issue 113 @@ -919,11 +922,13 @@ static ivas_error configureEncoder( return error; } +#ifndef DISCRETE_ISM_DTX_CNG #ifdef PARAM_ISM_DTX_CNG if ( hEncoderConfig->Opt_DTX_ON && ( hEncoderConfig->ivas_format == ISM_FORMAT ) && !( st_ivas->ism_mode == ISM_MODE_DISC && hEncoderConfig->nchan_inp == 1 ) && !( st_ivas->ism_mode == ISM_MODE_PARAM && ( hEncoderConfig->nchan_inp == 3 || hEncoderConfig->nchan_inp == 4 ) ) ) { return IVAS_ERROR( IVAS_ERR_UNKNOWN, "DTX is not supported in this IVAS format and element mode." ); } +#endif #endif if ( hEncoderConfig->ivas_format == MONO_FORMAT ) -- GitLab From d7729af74c8ffab709cb0fb5ff83921f466184d1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 17 Feb 2023 13:09:20 +0100 Subject: [PATCH 03/45] comments --- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_dtx_dec.c | 2 +- lib_enc/ivas_ism_enc.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index cdd724cc2d..49434654bd 100755 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -245,7 +245,7 @@ ivas_error ivas_dec_setup( case SID_MDCT_STEREO: st_ivas->element_mode_init = IVAS_CPE_MDCT; break; -#ifdef DISCRETE_ISM_DTX +#ifdef DISCRETE_ISM_DTX_CNG case SID_ISM: st_ivas->element_mode_init = IVAS_SCE; break; diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index b040b93ac8..cc8d60254b 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -157,7 +157,7 @@ ivas_error ivas_ism_dtx_dec( } /* Metadata decoding and dequantization */ -#ifdef DISCRETE_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized #if 1 if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 845c123d56..e6dd7d0fba 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -213,7 +213,7 @@ ivas_error ivas_ism_enc( ivas_ism_get_sce_id_dtx( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); /* analysis and decision about DTX */ -#ifdef DISCRETE_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); @@ -252,7 +252,7 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { -#ifdef DISCRETE_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); -- GitLab From dcc1b70f1328b9d63a414e6a58499f75f39bc180 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Feb 2023 14:44:44 +0100 Subject: [PATCH 04/45] - harmonize MD quantization and coding - temporary switches MD_Q_PARAM_BE and MD_SMOOTH_PARAM_BE to keep ParamISM BE for the moment --- lib_com/ivas_cnst.h | 12 +- lib_com/ivas_ism_config.c | 4 - lib_com/ivas_prot.h | 13 +- lib_com/options.h | 4 +- lib_com/prot.h | 2 +- lib_dec/fd_cng_dec.c | 4 +- lib_dec/ivas_ism_dtx_dec.c | 55 ++-- lib_dec/ivas_ism_metadata_dec.c | 34 +- lib_dec/ivas_ism_param_dec.c | 3 +- lib_enc/ivas_ism_dtx_enc.c | 23 +- lib_enc/ivas_ism_enc.c | 26 +- lib_enc/ivas_ism_metadata_enc.c | 14 +- lib_enc/ivas_ism_param_enc.c | 3 +- scripts/config/self_test.prm | 345 +++++++++++---------- scripts/testv/stv_IVASMASA_1dir1TC.met | 3 - scripts/testv/stv_IVASMASA_1dir1TC.pcm | 3 - scripts/testv/stv_IVASMASA_1dir1TC_DTX.met | 3 - scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm | 3 - scripts/testv/stv_IVASMASA_1dir2TC.met | 3 - scripts/testv/stv_IVASMASA_1dir2TC.pcm | 3 - scripts/testv/stv_IVASMASA_1dir2TC_DTX.met | 3 - scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm | 3 - scripts/testv/stv_IVASMASA_2dir1TC.met | 3 - scripts/testv/stv_IVASMASA_2dir1TC.pcm | 3 - scripts/testv/stv_IVASMASA_2dir2TC.met | 3 - scripts/testv/stv_IVASMASA_2dir2TC.pcm | 3 - scripts/testv/test_FOA.wav | 3 - scripts/testv/test_HOA2.wav | 3 - scripts/testv/test_HOA3.wav | 3 - scripts/testv/test_ISM_1obj.wav | 3 - scripts/testv/test_ISM_2obj.wav | 3 - scripts/testv/test_ISM_3obj.wav | 3 - scripts/testv/test_ISM_4obj.wav | 3 - scripts/testv/test_MASA_1dir1TC.met | 3 - scripts/testv/test_MASA_1dir1TC.wav | 3 - scripts/testv/test_MASA_1dir2TC.met | 3 - scripts/testv/test_MASA_1dir2TC.wav | 3 - scripts/testv/test_MASA_2dir1TC.met | 3 - scripts/testv/test_MASA_2dir1TC.wav | 3 - scripts/testv/test_MASA_2dir2TC.met | 3 - scripts/testv/test_MASA_2dir2TC.wav | 3 - scripts/testv/test_MC51.wav | 3 - scripts/testv/test_MC51p2.wav | 3 - scripts/testv/test_MC51p4.wav | 3 - scripts/testv/test_MC71.wav | 3 - scripts/testv/test_MC71p4.wav | 3 - scripts/testv/test_mono.wav | 3 - scripts/testv/test_stereo.wav | 3 - 48 files changed, 303 insertions(+), 341 deletions(-) delete mode 100644 scripts/testv/stv_IVASMASA_1dir1TC.met delete mode 100644 scripts/testv/stv_IVASMASA_1dir1TC.pcm delete mode 100644 scripts/testv/stv_IVASMASA_1dir1TC_DTX.met delete mode 100644 scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm delete mode 100644 scripts/testv/stv_IVASMASA_1dir2TC.met delete mode 100644 scripts/testv/stv_IVASMASA_1dir2TC.pcm delete mode 100644 scripts/testv/stv_IVASMASA_1dir2TC_DTX.met delete mode 100644 scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm delete mode 100644 scripts/testv/stv_IVASMASA_2dir1TC.met delete mode 100644 scripts/testv/stv_IVASMASA_2dir1TC.pcm delete mode 100644 scripts/testv/stv_IVASMASA_2dir2TC.met delete mode 100644 scripts/testv/stv_IVASMASA_2dir2TC.pcm delete mode 100644 scripts/testv/test_FOA.wav delete mode 100644 scripts/testv/test_HOA2.wav delete mode 100644 scripts/testv/test_HOA3.wav delete mode 100644 scripts/testv/test_ISM_1obj.wav delete mode 100644 scripts/testv/test_ISM_2obj.wav delete mode 100644 scripts/testv/test_ISM_3obj.wav delete mode 100644 scripts/testv/test_ISM_4obj.wav delete mode 100644 scripts/testv/test_MASA_1dir1TC.met delete mode 100644 scripts/testv/test_MASA_1dir1TC.wav delete mode 100644 scripts/testv/test_MASA_1dir2TC.met delete mode 100644 scripts/testv/test_MASA_1dir2TC.wav delete mode 100644 scripts/testv/test_MASA_2dir1TC.met delete mode 100644 scripts/testv/test_MASA_2dir1TC.wav delete mode 100644 scripts/testv/test_MASA_2dir2TC.met delete mode 100644 scripts/testv/test_MASA_2dir2TC.wav delete mode 100644 scripts/testv/test_MC51.wav delete mode 100644 scripts/testv/test_MC51p2.wav delete mode 100644 scripts/testv/test_MC51p4.wav delete mode 100644 scripts/testv/test_MC71.wav delete mode 100644 scripts/testv/test_MC71p4.wav delete mode 100644 scripts/testv/test_mono.wav delete mode 100644 scripts/testv/test_stereo.wav diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index fab0fa0ab6..6edbb42cc9 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -335,11 +335,12 @@ typedef enum #define PARAM_ISM_HYS_BUF_SIZE 10 /* ISM DTX */ +#ifdef PARAM_ISM_DTX_CNG #ifdef DISCRETE_ISM_DTX_CNG #define ISM_DTX_COH_SCA_BITS 4 +#else +#define PARAM_ISM_DTX_COH_SCA_BITS 4 #endif -#ifdef PARAM_ISM_DTX_CNG -#define PARAM_ISM_DTX_COH_SCA_BITS 4 // VE!!!!! to be removed #define PARAM_ISM_DTX_AZI_BITS 5 #define PARAM_ISM_DTX_ELE_BITS 4 #endif @@ -362,10 +363,15 @@ enum { IND_ISM_NUM_OBJECTS, IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, - IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, + IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, /* in SID frames, it is "ism_mode" */ #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + IND_ISM_NOISY_SPEECH_FLAG = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, + IND_ISM_SCE_ID_DTX, +#else IND_ISM_SCE_ID_DTX = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, IND_ISM_NOISY_SPEECH_FLAG, +#endif IND_ISM_DTX_COH_SCA, #endif diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 3f4aa7ffd2..16c6c9243a 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -531,7 +531,6 @@ int16_t ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ int16_t *nBits_elevation, /* o : number of Q bits for elevation */ - int16_t *nBits_ener, /* o : number of Q bits for energy */ int16_t *nBits_coh, /* o : number of Q bits for coherence */ int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ) @@ -541,7 +540,6 @@ int16_t ivas_get_ism_sid_quan_bitbudget( low_res_q = 0; *nBits_azimuth = ISM_AZIMUTH_NBITS; *nBits_elevation = ISM_ELEVATION_NBITS; - *nBits_ener = ISM_DTX_ENER_BITS; *nBits_coh = ISM_DTX_COH_SCA_BITS; *nBits_sce_id = 1; @@ -550,8 +548,6 @@ int16_t ivas_get_ism_sid_quan_bitbudget( low_res_q = 1; *nBits_azimuth = PARAM_ISM_DTX_AZI_BITS; *nBits_elevation = PARAM_ISM_DTX_ELE_BITS; - *nBits_ener = ISM_DTX_ENER_BITS - 1; - *nBits_coh = ISM_DTX_COH_SCA_BITS - 1; *nBits_sce_id = 2; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 74feb3b6b5..9df513e4e1 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -968,6 +968,10 @@ int16_t ivas_ism_dtx_enc_COMMON( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ +#ifdef MD_Q_PARAM_BE + , + const ISM_MODE ism_mode +#endif ); #endif /*! r: indication of DTX frame */ @@ -994,14 +998,14 @@ void ivas_ism_metadata_sid_enc( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ int16_t nb_bits_metadata[] /* o : number of metadata bits */ ); -#endif // VE!!!!! - +#else void ivas_param_ism_metadata_dtx_enc( BSTR_ENC_HANDLE hBstr, /* i/o: bitstream handle */ ISM_METADATA_HANDLE hIsmMeta[], /* i : ISM metadata handles */ ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Enc Handle */ ); +#endif #ifdef DISCRETE_ISM_DTX_CNG ivas_error ivas_ism_metadata_sid_dec( @@ -1016,11 +1020,11 @@ ivas_error ivas_ism_metadata_sid_dec( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t nb_bits_metadata[] /* o : number of metadata bits */ ); -#endif // VE!!!!! - +#else void ivas_param_ism_metadata_dtx_dec( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); +#endif void ivas_ism_get_sce_id_dtx( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ @@ -1052,7 +1056,6 @@ int16_t ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ int16_t *nBits_elevation, /* o : number of Q bits for elevation */ - int16_t *nBits_ener, /* o : number of Q bits for energy */ int16_t *nBits_coh, /* o : number of Q bits for coherence */ int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); diff --git a/lib_com/options.h b/lib_com/options.h index bccecd0420..fc8b89be6e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -179,7 +179,9 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ - +#define MD_Q_PARAM_BE +#define MD_SMOOTH_PARAM_BE +#define DTX_PARAM_BE /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index f47c2d65b2..4bb1dfbeb6 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -8523,7 +8523,7 @@ void generate_comfort_noise_dec_hf( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ #ifdef PARAM_ISM_DTX_CNG , - int16_t cng_flag /*i: CNG Flag */ + const int16_t cng_flag /* i : CNG Flag */ #endif ); diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 314d0534a7..39b09921e9 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1351,7 +1351,7 @@ void generate_comfort_noise_dec_hf( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ #ifdef PARAM_ISM_DTX_CNG , - int16_t cng_coh_flag /* i: CNG Flag for coherence handling */ + const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ #endif ) { @@ -1369,7 +1369,7 @@ void generate_comfort_noise_dec_hf( { seed2 = &( hFdCngCom->seed3 ); - c1 = (float) sqrt( hFdCngCom->coherence ); + c1 = (float) sqrt( hFdCngCom->coherence ); // VE!!!!! all occurences of "(float) sqrt()" should be replaced by "sqrtf()" c2 = (float) sqrt( 1 - hFdCngCom->coherence ); } #endif diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index cc8d60254b..5ca201eec2 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -157,40 +157,31 @@ ivas_error ivas_ism_dtx_dec( } /* Metadata decoding and dequantization */ -#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized -#if 1 - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, + &flag_noisy_speech, &sce_id, st_ivas->hIsmMetaData, nb_bits_metadata ); + + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) { - ivas_param_ism_metadata_dtx_dec( st_ivas ); + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; + } } - else -#endif - { - ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, - &flag_noisy_speech, &sce_id, st_ivas->hIsmMetaData, nb_bits_metadata ); - if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + { + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; - } + st_ivas->hISMDTX.sce_id_dtx = sce_id; } - - if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) + else /* ism_mode == ISM_MODE_DISC */ { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - st_ivas->hISMDTX.sce_id_dtx = sce_id; - } - else /* ism_mode == ISM_MODE_DISC */ + for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { - for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) - { - st_ivas->hSCE[ch]->hCoreCoder[0]->read_sid_info = 0; - } - st_ivas->hSCE[sce_id]->hCoreCoder[0]->read_sid_info = 1; + st_ivas->hSCE[ch]->hCoreCoder[0]->read_sid_info = 0; } + st_ivas->hSCE[sce_id]->hCoreCoder[0]->read_sid_info = 1; } } #else @@ -199,7 +190,17 @@ ivas_error ivas_ism_dtx_dec( #ifdef DISCRETE_ISM_DTX_CNG set_s( md_diff_flag, 1, num_obj ); - //update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); // VE!!!!! + + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + for ( ch = 0; ch < num_obj; ch++ ) + { + st_ivas->hDirAC->azimuth_values[ch] = st_ivas->hIsmMetaData[ch]->azimuth; + st_ivas->hDirAC->elevation_values[ch] = st_ivas->hIsmMetaData[ch]->elevation; + } + } + + update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); st_ivas->ism_dtx_hangover_cnt = 0; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 814ccbffba..6d53b3b5dc 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -547,7 +547,10 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG if ( *ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { - //ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); // VE!!!!! +#ifdef MD_SMOOTH_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); } *ism_dtx_hangover_cnt = min( ( *ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); #endif @@ -757,7 +760,7 @@ ivas_error ivas_ism_metadata_sid_dec( { int16_t i, ch, nb_bits_start, last_bit_pos, low_res_q; int16_t idx, idx_azimuth, idx_elevation; - int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; int16_t md_diff_flag[MAX_NUM_OBJECTS]; ISM_MODE ism_mode_bstr; DEC_CORE_HANDLE st0; @@ -767,7 +770,10 @@ ivas_error ivas_ism_metadata_sid_dec( if ( ism_total_brate == FRAME_NO_DATA ) { - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); +#ifdef MD_SMOOTH_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); return IVAS_ERR_OK; } @@ -812,7 +818,7 @@ ivas_error ivas_ism_metadata_sid_dec( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ - low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -836,6 +842,7 @@ ivas_error ivas_ism_metadata_sid_dec( { /* read noisy speech flag */ *flag_noisy_speech = get_next_indice( st0, 1 ); + nBits_sce_id = 1; } } @@ -862,6 +869,11 @@ ivas_error ivas_ism_metadata_sid_dec( *sce_id_dtx = 0; } + if ( ism_mode == ISM_MODE_PARAM ) + { + hSCE[*sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = hSCE[!*sce_id_dtx]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence; + } + /*----------------------------------------------------------------* * Metadata decoding and dequantization, loop over all objects *----------------------------------------------------------------*/ @@ -922,8 +934,13 @@ ivas_error ivas_ism_metadata_sid_dec( } // VE: ToDo: this would not work well for switching from low_res_q to active frame coding - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; +#ifdef MD_Q_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + { + hIsmMetaData->last_azimuth_idx = idx_azimuth; + hIsmMetaData->last_elevation_idx = idx_elevation; + } /* save for smoothing metadata evolution */ hIsmMetaData->last_true_azimuth = hIsmMetaData->azimuth; @@ -937,7 +954,10 @@ ivas_error ivas_ism_metadata_sid_dec( } /* smooth the metadata evolution */ - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); +#ifdef MD_SMOOTH_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 165dddb546..3b5d50837c 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1130,7 +1130,7 @@ void ivas_param_ism_params_to_masa_param_mapping( return; } - +#ifndef DISCRETE_ISM_DTX_CNG #ifdef PARAM_ISM_DTX_CNG static void ivas_param_ism_dec_dequantize_DOA_dtx( int16_t azi_bits, @@ -1263,3 +1263,4 @@ void ivas_param_ism_metadata_dtx_dec( return; } #endif +#endif diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 63e94c8ff9..fc8867a5b0 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -113,11 +113,15 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ +#ifdef MD_Q_PARAM_BE + , + const ISM_MODE ism_mode +#endif ) { int16_t ch, dtx_flag; int16_t nBits, nBits_MD_max; - int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; /*------------------------------------------------------------------* @@ -126,7 +130,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end /* compute global ISM based on localVAD */ dtx_flag = 1; - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { dtx_flag &= !vad_flag[ch]; } @@ -163,7 +167,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end if ( dtx_flag ) { - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); nBits = 0; for ( ch = 0; ch < num_obj; ch++ ) @@ -180,6 +184,13 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end md_diff_flag[ch] = 1; } +#ifdef MD_Q_PARAM_BE + if ( ism_mode == ISM_MODE_PARAM ) + { + md_diff_flag[ch] = 1; + } +#endif + /* estimate SID metadata bit-budget */ nBits++; /* number of objects */ nBits++; /* SID metadata flag */ @@ -240,7 +251,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end } else /* ism_dtx_flag == 1 */ { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->cng_type = FD_CNG; } @@ -255,7 +266,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end } /* encode SID in one channel only */ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; } @@ -269,7 +280,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end if ( dtx_flag == 1 && *sid_flag == 0 ) { - set_s( md_diff_flag, 0, num_obj ); + set_s( md_diff_flag, 0, nchan_transport ); } return dtx_flag; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index e6dd7d0fba..b2dfde3782 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -196,6 +196,12 @@ ivas_error ivas_ism_enc( } vad_flag[sce_id] = st->vad_flag; +#ifdef DTX_PARAM_BE + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + vad_flag[sce_id] = vad_flag_dtx[sce_id][0]; + } +#endif } #ifdef PARAM_ISM_DTX_CNG @@ -216,7 +222,12 @@ ivas_error ivas_ism_enc( #ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { - dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); + dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag +#ifdef MD_Q_PARAM_BE + , + st_ivas->ism_mode +#endif + ); } else #endif @@ -252,17 +263,14 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { -#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized - if ( st_ivas->ism_mode != ISM_MODE_PARAM ) - { - ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); - } - else -#endif - if ( sid_flag ) +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); +#else + if ( sid_flag ) { ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); } +#endif } else #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index c06eeb9b86..dd57403d1e 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -865,7 +865,7 @@ void ivas_ism_metadata_sid_enc( { int16_t i, ch, nBits, nBits_start, nBits_unused, low_res_q; int16_t idx, idx_azimuth, idx_elevation; - int16_t nBits_azimuth, nBits_elevation, nBits_ener, nBits_coh, nBits_sce_id; + int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float valQ; ISM_METADATA_HANDLE hIsmMetaData; @@ -896,7 +896,7 @@ void ivas_ism_metadata_sid_enc( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ - low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_ener, &nBits_coh, &nBits_sce_id ); + low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -918,6 +918,7 @@ void ivas_ism_metadata_sid_enc( { /* write noisy speech flag */ push_indice( hBstr, IND_ISM_NOISY_SPEECH_FLAG, flag_noisy_speech, 1 ); + nBits_sce_id = 1; } } @@ -963,8 +964,13 @@ void ivas_ism_metadata_sid_enc( push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; +#ifdef MD_Q_PARAM_BE + if ( ism_mode != ISM_MODE_PARAM ) +#endif + { + hIsmMetaData->last_azimuth_idx = idx_azimuth; + hIsmMetaData->last_elevation_idx = idx_elevation; + } } } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index d7e3a9a35d..09383db54b 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -400,6 +400,7 @@ void ivas_param_ism_enc( #ifdef PARAM_ISM_DTX_CNG +#ifndef DISCRETE_ISM_DTX_CNG static void ivas_param_ism_enc_quantize_DOA_dtx( float azimuth, float elevation, @@ -524,7 +525,7 @@ void ivas_param_ism_metadata_dtx_enc( return; } - +#endif /*-------------------------------------------------------------------* * ivas_param_ism_compute_noisy_speech_flag() diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm index a007d937a1..96f6d7dfc3 100644 --- a/scripts/config/self_test.prm +++ b/scripts/config/self_test.prm @@ -157,11 +157,11 @@ ../IVAS_dec -fec 5 MONO 16 bit testv/stvST32n.pcm_Unified_32000_32-16_DTX_MONO_FEC5.tst // unified stereo at 32 kbps, 48kHz in, 48kHz out, bandwidth switching -../IVAS_cod -stereo -max_band testv/bwidth_cntl.txt 32000 48 testv/stvST48c.pcm bit +../IVAS_cod -stereo -max_band testv/bwidth_cntl.txt 32000 48 testv/stvST48c.wav bit ../IVAS_dec STEREO 48 bit testv/stvST48c.pcm_Unified_32000_48-48_bandwidth_sw.tst // unified stereo at 32 kbps, 48kHz in, 32kHz out, random FEC at 6% -../IVAS_cod -stereo -max_band FB 32000 48 testv/stvST48c.pcm bit +../IVAS_cod -stereo -max_band FB 32000 48 testv/stvST48c.wav bit ../IVAS_dec -fec testv/FEC_6pct.bin STEREO 32 bit testv/stvST48c.pcm_Unified_32000_48-32_FEC5.tst // unified stereo at 32 kbps, 48kHz in, 48kHz out, DTX on, random FEC at 5% @@ -214,7 +214,7 @@ ../IVAS_dec MONO 32 bit testv/stvST32c.pcm_MDCT_48000_32-32_MONO.tst // MDCT stereo at 128 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -stereo 128000 48 testv/stvST48c.pcm bit +../IVAS_cod -stereo 128000 48 testv/stvST48c.wav bit ../IVAS_dec MONO 48 bit testv/stvST32c.pcm_MDCT_128000_48-48_MONO.tst // MDCT stereo at 48 kbps, 48 kHz in, 48 kHz out, DTX on @@ -249,8 +249,10 @@ //../IVAS_cod -dtx -stereo ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stvST48n.pcm bit //../IVAS_dec MONO 48 bit testv/stvST48n.pcm_stereo_sw_48-48_DTX_MONO.tst + + // 1 ISm with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, MONO out -../IVAS_cod -ism 1 testv/stvISM1.csv 13200 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 13200 48 testv/stv1ISM48s.wav bit ../IVAS_dec MONO 48 bit testv/stv1ISM48s.pcm_13200_48-48_MONO.tst // 1 ISm with metadata at 13.2 kbps, 48 kHz in, 48 kHz out, DTX on, BINAURAL out, random FEC at 5% @@ -258,15 +260,15 @@ ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv48n.pcm_13200_48-48_DTX_FEC5_BINAURAL.tst // 2 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit ../IVAS_dec STEREO 48 bit testv/stv2ISM48s.pcm_16400_48-48_STEREO.tst // 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, 7_1 out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit ../IVAS_dec 7_1 48 bit testv/stv3ISM48s.pcm_24400_48-48_7_1.tst // 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, MONO out, random FEC at 5% -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit ../IVAS_dec -fec 5 MONO 48 bit testv/stv3ISM48s.pcm_24400_48-48_MONO_FEC5.tst // 1 ISm with metadata at 32 kbps, 32 kHz in, 32 kHz out, DTX on, MONO out @@ -274,107 +276,107 @@ ../IVAS_dec MONO 32 bit testv/stv32n.pcm_32000_32-32_DTX_MONO.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec FOA 48 bit testv/stv4ISM48s.pcm_32000_48-48_FOA.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec STEREO 48 bit testv/stv4ISM48s.pcm_32000_48-48_STEREO.tst // 3 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, MONO out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 48000 48 testv/stv3ISM48s.wav bit ../IVAS_dec MONO 48 bit testv/stv43ISM48s_48000_48-48_MONO.tst // 2 ISm with metadata at 64 kbps, 48 kHz in, 32 kHz out, 5_1 out -../IVAS_cod -max_band FB -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 2 testv/stvISM1.csv testv/stvISM2.csv 64000 48 testv/stv2ISM48s.wav bit ../IVAS_dec 5_1 32 bit testv/stv2ISM48s.pcm_64000_48-32_5_1.tst // 4 ISm with metadata at 80 kbps, 48 kHz in, 48 kHz out, HOA2 out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 80000 48 testv/stv4ISM48s.wav bit ../IVAS_dec HOA2 48 bit testv/stv4ISM48s.pcm_80000_48-48_HOA2.tst // 4 ISm with metadata at 96 kbps, 48 kHz in, 48 kHz out, Custom LS setup out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 96000 48 testv/stv4ISM48s.wav bit ../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv4ISM48s.pcm_96000_48-48_MC_custom_setup.tst // 3 ISm with metadata at 128 kbps, 48 kHz in, 32 kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -max_band FB -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 128000 48 testv/stv3ISM48s.wav bit ../IVAS_dec -fec 5 HOA3 32 bit testv/stv3ISM48s.pcm_128000_48-32_HOA3_FEC5.tst // 4 ISm with metadata at 160 kbps, 48 kHz in, 48 kHz out, STEREO out -../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -max_band FB -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 160000 48 testv/stv4ISM48s.wav bit ../IVAS_dec STEREO 48 bit testv/stv4ISM48s.pcm_160000_48-48_STEREO.tst // 2 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 16400 48 testv/stv2ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv2ISM48s.pcm_16400_48-48_binaural.tst // 3 ISm with metadata at 24.4 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 24400 48 testv/stv3ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv3ISM48s.pcm_24400_48-48_binaural.tst // 2 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 48000 48 testv/stv2ISM48s.wav bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2ISM48s.pcm_48000_48-48_binaural_FEC5.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_32000_48-48_binaural.tst // 1 ISm with metadata at 16.4 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 16400 48 testv/stv1ISM48s.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1ISM48s.pcm_16400_48-48_binaural_room.tst // 2 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, EXTERNAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 32000 48 testv/stv2ISM48s.wav bit ../IVAS_dec EXT 48 bit testv/stv2ISM48s.pcm_32000_48-48_external.tst // 2 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv2ISM48s.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2ISM48s.pcm_64000_48-48_binaural_room.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, random FEC at 5% -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit ../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stv4ISM48s.pcm_32000_48-48_binaural_room_FEC5.tst // 4 ISm with metadata at 64 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 64000 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv4ISM48s.pcm_64000_48-48_binaural_room.tst // 1 ISm with metadata at 48 kbps, 48 kHz in, 48 kHz out, BINAURAL ROOM out, head rotation, random FEC at 5% -../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 48000 48 testv/stv1ISM48s.wav bit ../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv1ISM48s.pcm_64000_48-48_binaural_room_HR.tst // 1 ISm with metadata at 96 kbps, 48 kHz in, 16 kHz out, TD BINAURAL out (Model from file) -../IVAS_cod -ism 1 testv/stvISM1.csv 96000 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 96000 48 testv/stv1ISM48s.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.pcm_96000_48-16_TD_binaural.tst // 2 ISm with metadata at 160 kbps, 48 kHz in, 32 kHz out, TD BINAURAL out -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 160000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 160000 48 testv/stv2ISM48s.wav bit ../IVAS_dec BINAURAL 32 bit testv/stv2ISM48s.pcm_160000_48-32_TD_binaural.tst // 3 ISm with metadata at 192 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out (Model from file) -../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stv3ISM48s.pcm_192000_48-48_TD_binaural.tst // 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TD_binaural.tst // 1 ISm with metadata at 80 kbps, 48 kHz in, 16 kHz out, TD BINAURAL out (Model from file), head rotation, random FEC at 5% -../IVAS_cod -ism 1 testv/stvISM1.csv 80000 48 testv/stv1ISM48s.pcm bit +../IVAS_cod -ism 1 testv/stvISM1.csv 80000 48 testv/stv1ISM48s.wav bit ../IVAS_dec -fec 5 -t testv/headrot_case00_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL 16 bit testv/stv2ISM48s.pcm_80000_48-16_TDHR_FEC5.tst // 2 ISm with metadata at 128 kbps, 48 kHz in, 32 kHz out, TD BINAURAL out (Model from file), head rotation -../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 128000 48 testv/stv2ISM48s.pcm bit +../IVAS_cod -ism 2 testv/stvISM1.csv testv/stvISM2.csv 128000 48 testv/stv2ISM48s.wav bit ../IVAS_dec -t testv/headrot_case01_3000_q.csv -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv2ISM48s.pcm_128000_48-32_TDHR.tst // 3 ISm with metadata at 192 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation, random FEC at 5% -../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.pcm bit +../IVAS_cod -ism 3 testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 192000 48 testv/stv3ISM48s.wav bit ../IVAS_dec -fec 5 -t testv/headrot_case02_3000_q.csv BINAURAL 48 bit testv/stv3ISM48s.pcm_192000_48-48_TDHR_FEC5.tst // 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, TD BINAURAL out, head rotation -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.wav bit ../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR.tst // 1 ISm with metadata bitrate switching from 13.2 kbps to 128 kbps, 32 kHz in, 32 kHz out, mono out, DTX on @@ -382,9 +384,11 @@ ../IVAS_dec MONO 32 bit testv/stv32c.pcm_brate_sw_32-32_mono_dtx.tst // 4 ISm with metadata bitrate switching from 24.4 kbps to 256 kbps, 48 kHz in, 48 kHz out, BINAURAL out -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv4ISM48s.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv4ISM48s.pcm_brate_sw_48-48_BINAURAL.tst + + // SBA at 13.2 kbps, 32kHz in, 32kHz out, HOA3 out ../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.pcm bit ../IVAS_dec HOA3 32 bit testv/stv3OA32c.pcm_SBA_13200_32-32_HOA3.tst @@ -438,7 +442,7 @@ ../IVAS_dec BINAURAL_ROOM 32 bit testv/stvFOA32c.pcm_SBA_32000_32-32_BINAURAL_ROOM.tst // SBA at 32 kbps, 48kHz in, 48kHz out, MONO out, DTX -../IVAS_cod -dtx -sba 1 32000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -dtx -sba 1 32000 48 testv/stvFOA48c.wav bit ../IVAS_dec MONO 48 bit testv/stvFOA48c.pcm_SBA_32000_48-48_DTX_MONO.tst // SBA at 48 kbps, 32kHz in, 32kHz out, MONO out, random FEC at 5% @@ -478,19 +482,19 @@ ../IVAS_dec -fec 5 FOA 32 bit testv/stvFOA32c.pcm_SBA_64000_32-32_DTX_FOA.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 5_1_4 out -../IVAS_cod -max_band FB -sba 1 64000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -max_band FB -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec 5_1_4 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_5_1_4.tst // SBA at 64 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_7_1_4.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_DTX_BINAURAL.tst // SBA at 64 kpbs, 48kHz in, 48kHz out, BINAURAL_ROOM out, DTX -../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -dtx -sba 1 64000 48 testv/stvFOA48c.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stvFOA48c.pcm_SBA_64000_48-48_DTX_BINAURAL_ROOM.tst // SBA at 80 kbps, 32kHz in, 32kHz out, HOA3 out @@ -510,7 +514,7 @@ ../IVAS_dec STEREO 32 bit testv/stvFOA32c.pcm_SBA_96000_32-32_STEREO.tst // SBA at 96 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 96000 48 testv/stvFOA48c.wav bit ../IVAS_dec FOA 48 bit testv/stvFOA48c.pcm_SBA_96000_48-48_FOA.tst // SBA at 128 kbps, 32kHz in, 32kHz out, BINAURAL ROOM out, Headrotation @@ -518,11 +522,11 @@ ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 32 bit testv/stv3OA32c.pcm_SBA_128000_32-32_Binaural_room_Headrot.tst // SBA at 192 kbps, 48kHz in, 48kHz out, HOA2 out, random FEC at 5% -../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba 3 192000 48 testv/stv3OA48c.wav bit ../IVAS_dec -fec 5 HOA2 48 bit testv/stv3OA48c.pcm_SBA_192000_48-48_HOA2_FEC5.tst // SBA at 48 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba 3 -dtx 48000 48 testv/stv3OA48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv3OA48c.pcm_SBA_48000_48-48_DTX_5_1.tst // SBA at 160 kbps, 32kHz in, 32kHz out, FOA out @@ -530,15 +534,15 @@ ../IVAS_dec FOA 32 bit testv/stvFOA32c.pcm_SBA_160000_32-32_FOA.tst // SBA at 160 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out, random FEC at 5% -../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.wav bit ../IVAS_dec -fec 5 BINAURAL_ROOM 48 bit testv/stvFOA48c.pcm_SBA_160000_48-48_BINAURAL_ROOM_FEC5.tst // SBA at 160 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 160000 48 testv/stvFOA48c.wav bit ../IVAS_dec 5_1 48 bit testv/stvFOA48c.pcm_SBA_160000_48-48_5_1.tst // SBA at 192 kbps, 48kHz in, 48kHz out, Custom LS setup out -../IVAS_cod -sba 1 192000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 192000 48 testv/stvFOA48c.wav bit ../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stvFOA48c.pcm_SBA_192000_48-48_MC_custom_setup.tst // SBA at 256 kbps, 32kHz in, 32kHz out, FOA out @@ -550,7 +554,7 @@ ../IVAS_dec BINAURAL_ROOM 32 bit testv/stvFOA32c.pcm_SBA_256000_32-32_BINAURAL_ROOM.tst // SBA at 256 kbps, 48kHz in, 48kHz out, 7_1 out, random FEC at 5% -../IVAS_cod -sba 1 256000 48 testv/stvFOA48c.pcm bit +../IVAS_cod -sba 1 256000 48 testv/stvFOA48c.wav bit ../IVAS_dec -fec 5 7_1 48 bit testv/stvFOA48c.pcm_SBA_256000_48-48_7_1_FEC5.tst // SBA 2OA at 384 kbps, 32kHz in, 32kHz out, STEREO out @@ -558,7 +562,7 @@ ../IVAS_dec STEREO 32 bit testv/stv2OA32c.pcm_SBA_384000_32-32_stereo.tst // SBA 3OA at 512 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba 3 512000 48 testv/stv3OA48c.wav bit ../IVAS_dec binaural 48 bit testv/stv3OA48c.pcm_SBA_512000_48-48_binaural.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 48kHz in, 48kHz out, BINAURAL out @@ -570,11 +574,11 @@ ../IVAS_dec FOA 48 bit testv/stv2OA48c.pcm_sw_48-48_FOA.tst // SBA 3OA bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba 3 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec HOA3 48 bit testv/stv3OA48c.pcm_sw_48-48_HOA3.tst // SBA planar 3OA bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.pcm bit +../IVAS_cod -sba -3 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv3OA48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stv3OA48c.pcm_sw_48-48_7_1_4.tst // SBA FOA bitrate switching from 13.2 kbps to 192 kbps, 32kHz in, 32kHz out,DTX on, BINAURAL out @@ -585,349 +589,354 @@ ../IVAS_cod -dtx -sba 3 ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 32 testv/stv3OA32c.pcm bit ../IVAS_dec HOA3 32 bit testv/stv3OA32c.pcm_sw_32-32_DTX_HOA3.tst + + // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 13200 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_1dir1TC.pcm_13200_48-48_BINAURAL.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 13200 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA1TC48c.pcm_13200_48-48_BINAURAL.tst // MASA 1dir 1TC at 16.4 kbps, 48kHz in, 48kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 16400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -fec 5 HOA3 48 bit testv/stv_IVASMASA_1dir1TC.pcm_16400_48-48_HOA3_FEC5.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 16400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -fec 5 HOA3 48 bit testv/stv1MASA1TC48c.pcm_16400_48-48_HOA3_FEC5.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.pcm_24400_48-48_BinauralRoom.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom_Subframe.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.pcm_24400_48-48_BinauralRoom_Subframe.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 24400 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir1TC.pcm_24400_48-48_BinauralRoom_Headrot.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 24400 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv1MASA1TC48c.pcm_24400_48-48_BinauralRoom_Headrot.tst // MASA 1dir 1TC at 32 kbps, 48kHz in, 48kHz out, 7_1_4, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 32000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir1TC.pcm_32000_48-48_7_1_4_FEC5.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 32000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec -fec 5 7_1_4 48 bit testv/stv1MASA1TC48c.pcm_32000_48-48_7_1_4_FEC5.tst // MASA 1dir 1TC at 48 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 48000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec MONO 48 bit testv/stv_IVASMASA_1dir1TC.pcm_48000_48-48_MONO.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 48000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv1MASA1TC48c.pcm_48000_48-48_MONO.tst // MASA 1dir 1TC at 64 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC.met 64000 48 testv/stv_IVASMASA_1dir1TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir1TC.pcm_64000_48-48_STEREO.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48c.met 64000 48 testv/stv1MASA1TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv1MASA1TC48c.pcm_64000_48-48_STEREO.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_FEC5.tst +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv2MASA1TC48c.pcm_128000_48-48_BINAURAL_FEC5.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_Subframe.tst +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec BINAURAL 48 bit testv/stv2MASA1TC48c.pcm_128000_48-48_BINAURAL_Subframe.tst // MASA 2dir 1TC at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -masa 1 testv/stv_IVASMASA_2dir1TC.met 128000 48 testv/stv_IVASMASA_2dir1TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv_IVASMASA_2dir1TC.pcm_128000_48-48_BINAURAL_Headrot.tst +../IVAS_cod -masa 1 testv/stv2MASA1TC48c.met 128000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv2MASA1TC48c.pcm_128000_48-48_BINAURAL_Headrot.tst // MASA 1dir 2TC at 13.2 kbps, 48kHz in, 48kHz out, 5_1 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 13200 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_13200_48-48_5_1_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 13200 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 5_1 48 bit testv/stv2MASA1TC48c.pcm_13200_48-48_5_1_FEC5.tst // MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 16400 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_16400_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 16400 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA1TC48c.pcm_16400_48-48_5_1.tst // MASA 1dir 2TC at 24.4 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 24400 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_24400_48-48_STEREO.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 24400 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv2MASA1TC48c.pcm_24400_48-48_STEREO.tst // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 32000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2MASA1TC48c.pcm_32000_48-48_BinauralRoom.tst // MASA 1dir 2TC at 32 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 32000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv_IVASMASA_1dir2TC.pcm_32000_48-48_BinauralRoom_Headrot.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 32000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL_ROOM 48 bit testv/stv2MASA1TC48c.pcm_32000_48-48_BinauralRoom_Headrot.tst // MASA 1dir 2TC at 48 kbps, 48kHz in, 48kHz out, 7_1_4 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 48000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC.pcm_48000_48-48_7_1_4_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 48000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 7_1_4 48 bit testv/stv2MASA1TC48c.pcm_48000_48-48_7_1_4_FEC5.tst // MASA 1dir 2TC at 80 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 80000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec STEREO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_80000_48-48_STEREO.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 80000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec STEREO 48 bit testv/stv2MASA1TC48c.pcm_80000_48-48_STEREO.tst // MASA 1dir 2TC at 96 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 96000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec MONO 48 bit testv/stv_IVASMASA_1dir2TC.pcm_96000_48-48_MONO.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 96000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec MONO 48 bit testv/stv2MASA1TC48c.pcm_96000_48-48_MONO.tst // MASA 1dir 2TC at 160 kbps, 48kHz in, 48kHz out, HOA3 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 160000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec -fec 5 HOA3 48 bit testv/stv_IVASMASA_1dir2TC.pcm_160000_48-48_HOA3_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 160000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec -fec 5 HOA3 48 bit testv/stv2MASA1TC48c.pcm_160000_48-48_HOA3_FEC5.tst // MASA 1dir 2TC at 256 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC.met 256000 48 testv/stv_IVASMASA_1dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC.pcm_256000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA1TC48c.met 256000 48 testv/stv2MASA1TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA1TC48c.pcm_256000_48-48_5_1.tst // MASA 2dir 2TC at 48 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 48000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_2dir2TC.pcm_48000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 48000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.pcm_48000_48-48_5_1.tst // MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, EXTERNAL out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 64000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -fec 5 EXT 48 bit testv/stv_IVASMASA_2dir2TC.pcm_64000_48-48_external_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -fec 5 EXT 48 bit testv/stv2MASA2TC48c.pcm_64000_48-48_external_FEC5.tst // MASA 2dir 2TC at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 64000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv_IVASMASA_2dir2TC.pcm_64000_48-48_BINAURAL_Headrot.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 64000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv2MASA2TC48c.pcm_64000_48-48_BINAURAL_Headrot.tst // MASA 2dir 2TC at 128 kbps, 48kHz in, 48kHz out, FOA out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 128000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec FOA 48 bit testv/stv_IVASMASA_2dir2TC.pcm_128000_48-48_FOA.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 128000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec FOA 48 bit testv/stv2MASA2TC48c.pcm_128000_48-48_FOA.tst // MASA 2dir 2TC at 192 kbps, 48kHz in, 48kHz out, 5_1_4 out, random FEC at 5% -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 192000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec -fec 5 5_1_4 48 bit testv/stv_IVASMASA_2dir2TC.pcm_192000_48-48_5_1_4_FEC5.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 192000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec -fec 5 5_1_4 48 bit testv/stv2MASA2TC48c.pcm_192000_48-48_5_1_4_FEC5.tst // MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 384000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2MASA2TC48c.pcm_384000_48-48_BinauralRoom.tst // MASA 2dir 2TC at 384 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 384000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec BINAURAL_ROOM 48 bit testv/stv_IVASMASA_2dir2TC.pcm_384000_48-48_BinauralRoom_Subframe.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 384000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec BINAURAL_ROOM 48 bit testv/stv2MASA2TC48c.pcm_384000_48-48_BinauralRoom_Subframe.tst // MASA 2dir 2TC at 512 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 2 testv/stv_IVASMASA_2dir2TC.met 512000 48 testv/stv_IVASMASA_2dir2TC.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_2dir2TC.pcm_512000_48-48_5_1.tst +../IVAS_cod -masa 2 testv/stv2MASA2TC48c.met 512000 48 testv/stv2MASA2TC48c.wav bit +../IVAS_dec 5_1 48 bit testv/stv2MASA2TC48c.pcm_512000_48-48_5_1.tst // MASA 1dir 1TC at 13.2 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out -../IVAS_cod -dtx -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met 13200 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_13200_48-48_DTX_7_1_4.tst +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 13200 48 testv/stv1MASA1TC48n.pcm bit +../IVAS_dec 7_1_4 48 bit testv/stv1MASA1TC48n.pcm_13200_48-48_DTX_7_1_4.tst // MASA 1dir 1TC at 24.4 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -dtx -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met 24400 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_24400_48-48_DTX_5_1.tst +../IVAS_cod -dtx -masa 1 testv/stv1MASA1TC48n.met 24400 48 testv/stv1MASA1TC48n.pcm bit +../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.pcm_24400_48-48_DTX_5_1.tst // MASA 1dir 2TC at 16.4 kbps, 48kHz in, 48kHz out, DTX on, 7_1_4 out -../IVAS_cod -dtx -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met 16400 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec 7_1_4 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_16400_48-48_DTX_7_1_4.tst +../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 16400 48 testv/stv1MASA2TC48n.pcm bit +../IVAS_dec 7_1_4 48 bit testv/stv1MASA2TC48n.pcm_16400_48-48_DTX_7_1_4.tst // MASA 1dir 2TC at 32.0 kbps, 48kHz in, 48kHz out, DTX on, 5_1 out -../IVAS_cod -dtx -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met 32000 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_32000_48-48_DTX_5_1.tst +../IVAS_cod -dtx -masa 2 testv/stv1MASA2TC48n.met 32000 48 testv/stv1MASA2TC48n.pcm bit +../IVAS_dec 5_1 48 bit testv/stv1MASA2TC48n.pcm_32000_48-48_DTX_5_1.tst // MASA 1dir 1TC bitrate switching from 13.2 kbps to 128 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -masa 1 testv/stv_IVASMASA_1dir1TC_DTX.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv_IVASMASA_1dir1TC_DTX.pcm bit -../IVAS_dec 5_1 48 bit testv/stv_IVASMASA_1dir1TC_DTX.pcm_sw_48-48_5_1.tst +../IVAS_cod -masa 1 testv/stv1MASA1TC48n.met ../scripts/switchPaths/sw_13k2_to_128k_10fr.bin 48 testv/stv1MASA1TC48n.pcm bit +../IVAS_dec 5_1 48 bit testv/stv1MASA1TC48n.pcm_sw_48-48_5_1.tst // MASA 1dir 2TC bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -masa 2 testv/stv_IVASMASA_1dir2TC_DTX.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv_IVASMASA_1dir2TC_DTX.pcm bit -../IVAS_dec BINAURAL 48 bit testv/stv_IVASMASA_1dir2TC_DTX.pcm_sw_48-48_BINAURAL.tst +../IVAS_cod -masa 2 testv/stv1MASA2TC48n.met ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv1MASA2TC48n.pcm bit +../IVAS_dec BINAURAL 48 bit testv/stv1MASA2TC48n.pcm_sw_48-48_BINAURAL.tst + // Multi-channel 5_1 at 13.2 kbps, 48kHz in, 48kHz out -../IVAS_cod -mc 5_1 13200 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 13200 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_13200_48-48_5_1.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, random FEC at 5% -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 5 BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_FEC5.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_Subframe.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 48 kbps, 48kHz in, 48kHz out, random FEC at 5% -../IVAS_cod -mc 5_1 48000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 48000 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 5 5_1 48 bit testv/stv51MC48c.pcm_MC51_48000_48-48_5_1_FEC5.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 64 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, Headrotation -../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 64000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_64000_48-48_Binaural_room_Headrot.tst // Multi-channel 5_1 at 96 kbps, 48kHz in, 48kHz out, random FEC at 5% -../IVAS_cod -mc 5_1 96000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 96000 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 5 5_1 48 bit testv/stv51MC48c.pcm_MC51_96000_48-48_5_1_FEC5.tst // Multi-channel 5_1 at 128 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_128000_48-48_Binaural.tst // Multi-channel 5_1 at 128 kbps, 48kHz in, 48kHz out, BINAURAL out, Headrotation -../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 128000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot.csv BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_128000_48-48_Binaural_Headrot.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, STEREO out, random FEC at 5% -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 5 STEREO 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_stereo_FEC5.tst // Multi-channel 5_1 at 192 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out -../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_192000_48-48_BinauralRoom.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec MONO 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_mono.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, BINAURAL ROOM out, head rotation -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec -t testv/headrot_case00_3000_q.csv BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_BinauralRoom_Headrot.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_5_1.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, BINAURAL out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_Binaural.tst // Multi-channel 5_1 at 192 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 192000 48 testv/stv51MC48c.wav bit ../IVAS_dec STEREO 48 bit testv/stv51MC48c.pcm_MC51_192000_48-48_stereo.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stv51MC48c.pcm_MC51_384000_48-48_7_1_4.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec MONO 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_MONO.tst // Multi-channel 7_1_4 at 48 kbps, 48kHz in, 48kHz out, MONO out -../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 48000 48 testv/stv714MC48c.wav bit ../IVAS_dec MONO 48 bit testv/stv714MC48c.pcm_MC714_48000_48-48_Mono.tst // Multi-channel 7_1_4 at 64 kbps, 48kHz in, 48kHz out, MONO out, random FEC at 5% -../IVAS_cod -mc 7_1_4 64000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 64000 48 testv/stv714MC48c.wav bit ../IVAS_dec -fec 5 MONO 48 bit testv/stv714MC48c.pcm_MC714_64000_48-48_MONO_FEC5.tst // Multi-channel 5_1 at 24.4 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 24400 48 testv/stv51MC48c.wav bit ../IVAS_dec STEREO 48 bit testv/stv51MC48c.pcm_MC51_24400_48-48_Stereo.tst // Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, STEREO out -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit ../IVAS_dec STEREO 48 bit testv/stv714MC48c.pcm_MC714_96000_48-48_Stereo.tst // Multi-channel 7_1_4 at 96 kbps, 48kHz in, 48kHz out, 5_1 out, random FEC at 5% -../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 96000 48 testv/stv714MC48c.wav bit ../IVAS_dec -fec 5 5_1 48 bit testv/stv714MC48c.pcm_MC714_96000_48-48_5_1_FEC5.tst // Multi-channel 5_1_2 at 32 kbps, 48kHz in, 48kHz out, STEREO out, random FEC at 5% -../IVAS_cod -mc 5_1_2 32000 48 testv/stv512MC48c.pcm bit +../IVAS_cod -mc 5_1_2 32000 48 testv/stv512MC48c.wav bit ../IVAS_dec -fec 5 STEREO 48 bit testv/stv512MC48c.pcm_MC714_32000_48-48_Stereo.tst // Multi-channel 5_1_2 at 80 kbps, 48kHz in, 48kHz out, 5_1 out -../IVAS_cod -mc 5_1_2 80000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1_2 80000 48 testv/stv51MC48c.wav bit ../IVAS_dec 5_1 48 bit testv/stv512MC48c.pcm_MC512_80000_48-48_5_1.tst // Multi-channel 5_1_2 at 160 kbps, 48kHz in, 48kHz out, 5_1_2 out -../IVAS_cod -mc 5_1_2 160000 48 testv/stv512MC48c.pcm bit +../IVAS_cod -mc 5_1_2 160000 48 testv/stv512MC48c.wav bit ../IVAS_dec 5_1_2 48 bit testv/stv512MC48c.pcm_MC512_160000_48-48_5_1_2.tst // Multi-channel 5_1 at 256 kbps, 48kHz in, 48kHz out, Custom LS setup out -../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 256000 48 testv/stv51MC48c.wav bit ../IVAS_dec testv/ls_setup_16ch_8+4+4.txt 48 bit testv/stv51MC48c.pcm_MC51_256000_48-48_MC_custom_setup.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 32kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 32 bit testv/stv51MC48c.pcm_MC51_512000_48-32_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 16 bit testv/stv51MC48c.pcm_MC51_512000_48-16_MC_Config_renderer.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config hospital_patientroom -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_hospital_patientroom.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_hospital_patientroom.tst // Multi-channel 5_1 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config recreation -../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 512000 48 testv/stv51MC48c.wav bit ../IVAS_dec -render_config testv/config_recreation.cfg BINAURAL_ROOM 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_Config_recreation.tst // Multi-channel 5_1_2 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1_2 512000 48 testv/stv512MC48c.pcm bit +../IVAS_cod -mc 5_1_2 512000 48 testv/stv512MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv512MC48c.pcm_MC512_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.pcm bit +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv514MC48c.pcm_MC514_512000_48-48_MC_Config_renderer.tst // Multi-channel 7_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out Config renderer -../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit ../IVAS_dec -render_config testv/config_renderer.cfg BINAURAL_ROOM 48 bit testv/stv714MC48c.pcm_MC714_512000_48-48_MC_Config_renderer.tst // Multi-channel 5_1 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, 7_1_4 out -../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv51MC48c.wav bit ../IVAS_dec 7_1_4 48 bit testv/stv51MC48c.pcm_sw_48-48_7_1_4.tst // Multi-channel 5_1 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 48kHz out, BINAURAL out, FEC at 10% -../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv51MC48c.wav bit ../IVAS_dec -fec 10 BINAURAL 48 bit testv/stv51MC48c.pcm_sw_48-48_binaural_fec10.tst // Multi-channel 5_1_2 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out -../IVAS_cod -mc 5_1_2 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv512MC48c.pcm bit +../IVAS_cod -mc 5_1_2 ../scripts/switchPaths/sw_13k2_512k.bin 48 testv/stv512MC48c.wav bit ../IVAS_dec BINAURAL_ROOM 16 bit testv/stv512MC48c.pcm_sw_48-16_Binaural_room.tst // Multi-channel 7_1_4 bitrate switching from 13.2 kbps to 512 kbps, 48kHz in, 48kHz out, HOA3 out -../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_mctech_5fr.bin 48 testv/stv714MC48c.wav bit ../IVAS_dec HOA3 48 bit testv/stv51MC48c.pcm_sw_48-48_HOA3.tst // Multi-channel 7_1_4 bitrate switching from 24.4 kbps to 256 kbps, 48kHz in, 32kHz out, STEREO out, FEC at 5% -../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 ../scripts/switchPaths/sw_24k4_256k.bin 48 testv/stv714MC48c.wav bit ../IVAS_dec -FEC 5 STEREO 32 bit testv/stv714MC48c.pcm_sw_48-32_stereo.tst // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 16kHz out, BINAURAL_ROOM out (Model from file) -../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.pcm bit +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_16kHz.bin BINAURAL_ROOM 16 bit testv/stv51MC48c.pcm_MC51_512000_48-16_MC_binaural_room.tst // Multi-channel 7_1_4 at 512 kbps, 48kHz in, 32kHz out, BINAURAL out (Model from file) -../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_32kHz.bin BINAURAL 32 bit testv/stv714MC48c.pcm_MC714_512000_48-32_MC_binaural.tst // Multi-channel 5_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL out (Model from file) -../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.pcm bit +../IVAS_cod -mc 5_1_4 512000 48 testv/stv514MC48c.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL 48 bit testv/stv51MC48c.pcm_MC51_512000_48-48_MC_binaural.tst // Multi-channel 7_1_4 at 512 kbps, 48kHz in, 48kHz out, BINAURAL_ROOM out (Model from file) -../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.pcm bit +../IVAS_cod -mc 7_1_4 512000 48 testv/stv714MC48c.wav bit ../IVAS_dec -hrtf ../scripts/binauralRenderer_interface/binaural_renderers_hrtf_data/ivas_binaural_48kHz.bin BINAURAL_ROOM 48 bit testv/stv714MC48c.pcm_MC714_512000_48-48_MC_binaural_room.tst + // Stereo downmix to bit-exact EVS at 13200 kbps, 32kHz in, 32kHz out ../IVAS_cod -stereo_dmx_evs 13200 32 testv/stvST32c.pcm bit ../IVAS_dec 32 bit testv/stvST32c.pcm_StereoDmxEVS_13200_32-32.tst // Stereo downmix to bit-exact EVS at 24400 kbps, 48kHz in, 48kHz out -../IVAS_cod -stereo_dmx_evs 24400 48 testv/stvST48c.pcm bit +../IVAS_cod -stereo_dmx_evs 24400 48 testv/stvST48c.wav bit ../IVAS_dec 48 bit testv/stvST48c.pcm_StereoDmxEVS_24400_48-48.tst + // MDCT stereo at 48 kbps, 16 kHz in, 16 kHz out, DTX on, JBM Prof 5 ../IVAS_cod -stereo -dtx 48000 16 testv/stvST16n.pcm bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP STEREO 16 netsimoutput testv/stvST16n.pcm_MDCT_48000_16-16_DTX_JBM5.tst // 4 ISm with metadata at 32 kbps, 48 kHz in, 48 kHz out, FOA out, JBM Prof 5 -../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.pcm bit +../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 32000 48 testv/stv4ISM48s.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP FOA 48 netsimoutput testv/stv4ISM48s.pcm_32000_48-48_FOA_JBM5.tst @@ -937,6 +946,6 @@ networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit ../IVAS_dec -Tracefile tracefile_dec -VOIP HOA3 32 netsimoutput testv/stv3OA32c.pcm_SBA_80000_32-32_HOA3_JBM5.tst // Multi-channel 5_1 at 384 kbps, 48kHz in, 48kHz out, 7_1_4 out, JBM Prof 5 -../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.pcm bit +../IVAS_cod -mc 5_1 384000 48 testv/stv51MC48c.wav bit networkSimulator_g192 ../scripts/dly_error_profiles/dly_error_profile_5.dat bit netsimoutput tracefile_sim 2 0 ../IVAS_dec -Tracefile tracefile_dec -VOIP 7_1_4 48 netsimoutput testv/stv51MC48c.pcm_MC51_384000_48-48_7_1_4_JBM5.tst diff --git a/scripts/testv/stv_IVASMASA_1dir1TC.met b/scripts/testv/stv_IVASMASA_1dir1TC.met deleted file mode 100644 index f2ce23bd20..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6349efe3448d28979b80744bcdc29d57f1c025704939b42d7b913d7fc3f23ccc -size 102300 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC.pcm b/scripts/testv/stv_IVASMASA_1dir1TC.pcm deleted file mode 100644 index 8f2bfc54e0..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:4dbbaa5c75c36bc74a100bc5721bc3cf2af4e22e2854a5b85c93532556afc776 -size 288000 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.met b/scripts/testv/stv_IVASMASA_1dir1TC_DTX.met deleted file mode 100644 index 945a81f0b4..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:64b974b376ef0ca29da837d33173c621499d753800ebf5e5587019ee5db481bd -size 684728 diff --git a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm b/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm deleted file mode 100644 index b642a34076..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir1TC_DTX.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c45ab47c02eab6c5f9737749a0229c0bc4eed4b6ebe2cf8db077929ec1aa76a2 -size 1927680 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC.met b/scripts/testv/stv_IVASMASA_1dir2TC.met deleted file mode 100644 index 00acdae539..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a1f87bfe360dbd221a94583aa68a58ef050e968a63351730d643f2dc2cac4e1 -size 204600 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC.pcm b/scripts/testv/stv_IVASMASA_1dir2TC.pcm deleted file mode 100644 index 491e75f868..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cd34c99b89d9c1ed3514c3f8e32faf6b82fbc8bf364bc464904fc1c745266350 -size 1152000 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.met b/scripts/testv/stv_IVASMASA_1dir2TC_DTX.met deleted file mode 100644 index f6e0e439a0..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2ec41c82c305f075c67b51e1f0a6e97dfc272bafcfca64e38c902c9f0d2c4500 -size 684728 diff --git a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm b/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm deleted file mode 100644 index 34f827e55b..0000000000 --- a/scripts/testv/stv_IVASMASA_1dir2TC_DTX.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:04fe84511787c1577f2886bae5ee440fd3a7692381e119dab714aed70ff16466 -size 3855360 diff --git a/scripts/testv/stv_IVASMASA_2dir1TC.met b/scripts/testv/stv_IVASMASA_2dir1TC.met deleted file mode 100644 index 6468877408..0000000000 --- a/scripts/testv/stv_IVASMASA_2dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d125a4c4e3989ac55f9c2617f464431feae4ede9b2e15d087d3271c0a4a56303 -size 319800 diff --git a/scripts/testv/stv_IVASMASA_2dir1TC.pcm b/scripts/testv/stv_IVASMASA_2dir1TC.pcm deleted file mode 100644 index 7c7209de2d..0000000000 --- a/scripts/testv/stv_IVASMASA_2dir1TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5afc7014451a8599f8399e3a503a29b23d22843ef482c0a701d4c46f6329ebc4 -size 576000 diff --git a/scripts/testv/stv_IVASMASA_2dir2TC.met b/scripts/testv/stv_IVASMASA_2dir2TC.met deleted file mode 100644 index 1b62022af5..0000000000 --- a/scripts/testv/stv_IVASMASA_2dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2eb412d646d7a32c77413dea54dc44cf45dc49e6d8c2de19abe4f4b93a91fa4a -size 159900 diff --git a/scripts/testv/stv_IVASMASA_2dir2TC.pcm b/scripts/testv/stv_IVASMASA_2dir2TC.pcm deleted file mode 100644 index ac8d4d341a..0000000000 --- a/scripts/testv/stv_IVASMASA_2dir2TC.pcm +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5d6c264295987b7db2a9a6a1352dd0b9c91a824fcc37c5631e0ba39e92df33f8 -size 576000 diff --git a/scripts/testv/test_FOA.wav b/scripts/testv/test_FOA.wav deleted file mode 100644 index fd654bb7ed..0000000000 --- a/scripts/testv/test_FOA.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9299bbe0637a72ab5419febfff4614066bda4ed8a58ffed19d068d17d4df46e0 -size 7680330 diff --git a/scripts/testv/test_HOA2.wav b/scripts/testv/test_HOA2.wav deleted file mode 100644 index e076c35ab8..0000000000 --- a/scripts/testv/test_HOA2.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:daa96c69bcf085746add3c41db6e2082e1c691c1bf5ad85a8a815b0155caffe4 -size 17280580 diff --git a/scripts/testv/test_HOA3.wav b/scripts/testv/test_HOA3.wav deleted file mode 100644 index 811f8b5803..0000000000 --- a/scripts/testv/test_HOA3.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fef816a7ca44d528ff6d56c431fbd81a82b4cae5c7bd86c7770493427e9d3ffc -size 30720930 diff --git a/scripts/testv/test_ISM_1obj.wav b/scripts/testv/test_ISM_1obj.wav deleted file mode 100644 index b75df181b2..0000000000 --- a/scripts/testv/test_ISM_1obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6ecc1d851c8c7f7ecf41e1b16abf01d35d37389584128537181add6f55530a9f -size 2880106 diff --git a/scripts/testv/test_ISM_2obj.wav b/scripts/testv/test_ISM_2obj.wav deleted file mode 100644 index a185618ec7..0000000000 --- a/scripts/testv/test_ISM_2obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:41825bb3378c8a9657bc3ae4dbebda7a54591f5a7aae6de7f4c6cf077e9c8df0 -size 5760106 diff --git a/scripts/testv/test_ISM_3obj.wav b/scripts/testv/test_ISM_3obj.wav deleted file mode 100644 index 2ce3343535..0000000000 --- a/scripts/testv/test_ISM_3obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:235749b6b4f6e76c4dccbd8d9ece32bf979ce8b77b7ca4402bb5ca8c159f8acc -size 8640130 diff --git a/scripts/testv/test_ISM_4obj.wav b/scripts/testv/test_ISM_4obj.wav deleted file mode 100644 index e50b2d5cbd..0000000000 --- a/scripts/testv/test_ISM_4obj.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:98bfb96a3b238a3e4004c07644932d35571f42d566f3278a6cf4bf6b080c1d1a -size 11520130 diff --git a/scripts/testv/test_MASA_1dir1TC.met b/scripts/testv/test_MASA_1dir1TC.met deleted file mode 100644 index f2ce23bd20..0000000000 --- a/scripts/testv/test_MASA_1dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6349efe3448d28979b80744bcdc29d57f1c025704939b42d7b913d7fc3f23ccc -size 102300 diff --git a/scripts/testv/test_MASA_1dir1TC.wav b/scripts/testv/test_MASA_1dir1TC.wav deleted file mode 100644 index 9291feeee3..0000000000 --- a/scripts/testv/test_MASA_1dir1TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:54ea4543e4d6d43c312f1e461a75a3d8ce18e34bfb5777f15f2e494dd277d2e5 -size 288106 diff --git a/scripts/testv/test_MASA_1dir2TC.met b/scripts/testv/test_MASA_1dir2TC.met deleted file mode 100644 index 00acdae539..0000000000 --- a/scripts/testv/test_MASA_1dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5a1f87bfe360dbd221a94583aa68a58ef050e968a63351730d643f2dc2cac4e1 -size 204600 diff --git a/scripts/testv/test_MASA_1dir2TC.wav b/scripts/testv/test_MASA_1dir2TC.wav deleted file mode 100644 index aefec77efe..0000000000 --- a/scripts/testv/test_MASA_1dir2TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ab7437cdf41e56338c93f5e593118a112a48bae5138be2cdd301eff5da59bb06 -size 1152106 diff --git a/scripts/testv/test_MASA_2dir1TC.met b/scripts/testv/test_MASA_2dir1TC.met deleted file mode 100644 index 6468877408..0000000000 --- a/scripts/testv/test_MASA_2dir1TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d125a4c4e3989ac55f9c2617f464431feae4ede9b2e15d087d3271c0a4a56303 -size 319800 diff --git a/scripts/testv/test_MASA_2dir1TC.wav b/scripts/testv/test_MASA_2dir1TC.wav deleted file mode 100644 index c80192b76b..0000000000 --- a/scripts/testv/test_MASA_2dir1TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b45ecb01efdc7a5d9877c9adcee2aad632ffde326dbc76554cb0452a78e3954d -size 576106 diff --git a/scripts/testv/test_MASA_2dir2TC.met b/scripts/testv/test_MASA_2dir2TC.met deleted file mode 100644 index 1b62022af5..0000000000 --- a/scripts/testv/test_MASA_2dir2TC.met +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2eb412d646d7a32c77413dea54dc44cf45dc49e6d8c2de19abe4f4b93a91fa4a -size 159900 diff --git a/scripts/testv/test_MASA_2dir2TC.wav b/scripts/testv/test_MASA_2dir2TC.wav deleted file mode 100644 index 0f72267ea0..0000000000 --- a/scripts/testv/test_MASA_2dir2TC.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a5a0379965053087ef1ce4775c85384e8c06aaa8161f12888f5e5c06d8612c1f -size 576106 diff --git a/scripts/testv/test_MC51.wav b/scripts/testv/test_MC51.wav deleted file mode 100644 index 334d819745..0000000000 --- a/scripts/testv/test_MC51.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3a077210fb3ab4f4a8f04ab37a7813e474f3dfb3dbd927b71484e03986cb042a -size 11520130 diff --git a/scripts/testv/test_MC51p2.wav b/scripts/testv/test_MC51p2.wav deleted file mode 100644 index e696a7dae6..0000000000 --- a/scripts/testv/test_MC51p2.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d056d0c1b412c1e8507872212f18bf333a91aac17358eae6a59c7a76f1bb0aaf -size 2304130 diff --git a/scripts/testv/test_MC51p4.wav b/scripts/testv/test_MC51p4.wav deleted file mode 100644 index 3d1c7812a4..0000000000 --- a/scripts/testv/test_MC51p4.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eddaf145410ca04daba554a719c58ed391159c7d73e6ea140d2b5de250929366 -size 2880130 diff --git a/scripts/testv/test_MC71.wav b/scripts/testv/test_MC71.wav deleted file mode 100644 index 2a0b012ab0..0000000000 --- a/scripts/testv/test_MC71.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d0ac38ddb16b2ce9cbca27965c5aedaf1af857a6fdce340bc01322794311e92d -size 2304130 diff --git a/scripts/testv/test_MC71p4.wav b/scripts/testv/test_MC71p4.wav deleted file mode 100644 index 9d0c1e594e..0000000000 --- a/scripts/testv/test_MC71p4.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e1f3fa943f86082be69a774280379f179f4bd51f221ee7aad6471c0310a9f4ab -size 3456130 diff --git a/scripts/testv/test_mono.wav b/scripts/testv/test_mono.wav deleted file mode 100644 index b841d174c3..0000000000 --- a/scripts/testv/test_mono.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5daeac3fb92d487fc7ded7d1a4a9e6295d2f2f27f59f19dcdaeebaae01908a86 -size 1920106 diff --git a/scripts/testv/test_stereo.wav b/scripts/testv/test_stereo.wav deleted file mode 100644 index 70dc46062e..0000000000 --- a/scripts/testv/test_stereo.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e0de400200071a7b26de03eaef88b49efce7a5df813b971336ed17b90ba02aa2 -size 3840106 -- GitLab From 18cfa9274cb9cedda5b00f5867b6785ae5f567fc Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Feb 2023 15:42:46 +0100 Subject: [PATCH 05/45] harmonization of core decoder set-up --- lib_com/ivas_prot.h | 2 +- lib_dec/ivas_dec.c | 4 +-- lib_dec/ivas_ism_dtx_dec.c | 62 ++++++++++----------------------- lib_dec/ivas_ism_metadata_dec.c | 14 ++++---- lib_dec/ivas_sce_dec.c | 17 --------- lib_dec/ivas_stat_dec.h | 7 ++-- 6 files changed, 33 insertions(+), 73 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9df513e4e1..4ece1a03b8 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -879,7 +879,7 @@ ivas_error ivas_ism_metadata_dec( int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ #ifdef DISCRETE_ISM_DTX_CNG - int16_t *ism_dtx_hangover_cnt, /* i/o: DTX hangover counter */ + ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ #endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ); diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 2098e1f157..d09ca85ad2 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -152,7 +152,7 @@ ivas_error ivas_dec( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { #ifdef DISCRETE_ISM_DTX_CNG - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, &( st_ivas->ism_dtx_hangover_cnt ), st_ivas->hDirAC->hParamIsm ); + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); #else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); #endif @@ -160,7 +160,7 @@ ivas_error ivas_dec( else /* ISM_MODE_DISC */ { #ifdef DISCRETE_ISM_DTX_CNG - ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, &( st_ivas->ism_dtx_hangover_cnt ), NULL ); + ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ); #else ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, NULL ); #endif diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 5ca201eec2..8862a38d28 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -61,9 +61,11 @@ static void ivas_ism_preprocessing( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifndef DISCRETE_ISM_DTX_CNG if ( ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) +#endif { - /* reset the bitstream to atleast read the cng type and bandwidth for non transmitted SCE */ + /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; if ( sce_id == st_ivas->hISMDTX.sce_id_dtx ) @@ -77,10 +79,12 @@ static void ivas_ism_preprocessing( st->cng_paramISM_flag = 1; } +#ifndef DISCRETE_ISM_DTX_CNG else { st->cng_paramISM_flag = 0; } +#endif return; } @@ -101,7 +105,7 @@ ivas_error ivas_ism_dtx_dec( int32_t ivas_total_brate; #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; - int16_t flag_noisy_speech, sce_id; + int16_t flag_noisy_speech, sce_id_dtx; #endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -159,30 +163,16 @@ ivas_error ivas_ism_dtx_dec( /* Metadata decoding and dequantization */ #ifdef DISCRETE_ISM_DTX_CNG ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, - &flag_noisy_speech, &sce_id, st_ivas->hIsmMetaData, nb_bits_metadata ); + &flag_noisy_speech, &sce_id_dtx, st_ivas->hIsmMetaData, nb_bits_metadata ); if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + if ( st_ivas->hDirAC != NULL ) { st_ivas->hDirAC->hParamIsm->flag_noisy_speech = flag_noisy_speech; } - } - if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) - { - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - st_ivas->hISMDTX.sce_id_dtx = sce_id; - } - else /* ism_mode == ISM_MODE_DISC */ - { - for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) - { - st_ivas->hSCE[ch]->hCoreCoder[0]->read_sid_info = 0; - } - st_ivas->hSCE[sce_id]->hCoreCoder[0]->read_sid_info = 1; - } + st_ivas->hISMDTX.sce_id_dtx = sce_id_dtx; } #else ivas_param_ism_metadata_dtx_dec( st_ivas ); @@ -202,44 +192,30 @@ ivas_error ivas_ism_dtx_dec( update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); - st_ivas->ism_dtx_hangover_cnt = 0; - - if ( st_ivas->ism_mode != ISM_MODE_PARAM ) // VE!!!!! - { - /* set core_brate for all channels */ - for ( ch = 0; ch < num_obj; ch++ ) - { - st_ivas->hSCE[ch]->hCoreCoder[0]->core_brate = FRAME_NO_DATA; - } - - if ( ivas_total_brate == IVAS_SID_5k2 ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->core_brate = SID_2k40; - } - } + st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; #endif for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { +#ifdef DISCRETE_ISM_DTX_CNG + nb_bits_metadata[ch] = nb_bits_metadata[sce_id_dtx]; +#else nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; +#endif } +#ifdef DISCRETE_ISM_DTX_CNG + if ( !st_ivas->bfi ) +#else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) +#endif { for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { ivas_ism_preprocessing( st_ivas, ch ); } } -#ifdef DISCRETE_ISM_DTX_CNG - else - { - for ( ch = 1; ch < st_ivas->nchan_transport; ch++ ) - { - nb_bits_metadata[ch] = nb_bits_metadata[0]; - } - } -#endif + return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 6d53b3b5dc..d9db83cdab 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -141,7 +141,7 @@ ivas_error ivas_ism_metadata_dec( int16_t nb_bits_metadata[], /* o : number of metadata bits */ ISM_MODE ism_mode, /* i : ISM mode */ #ifdef DISCRETE_ISM_DTX_CNG - int16_t *ism_dtx_hangover_cnt, /* i/o: DTX hangover counter */ + ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ #endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ) @@ -545,14 +545,14 @@ ivas_error ivas_ism_metadata_dec( } #ifdef DISCRETE_ISM_DTX_CNG - if ( *ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) + if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { #ifdef MD_SMOOTH_PARAM_BE if ( ism_mode != ISM_MODE_PARAM ) #endif ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); } - *ism_dtx_hangover_cnt = min( ( *ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); + hISMDTX.ism_dtx_hangover_cnt = min( ( hISMDTX.ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); #endif /*----------------------------------------------------------------* @@ -668,7 +668,7 @@ ivas_error create_ism_metadata_dec( ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ); #ifdef DISCRETE_ISM_DTX_CNG - st_ivas->ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; + st_ivas->hISMDTX.ism_dtx_hangover_cnt = IVAS_ISM_DTX_HO_MAX; #endif return IVAS_ERR_OK; @@ -797,9 +797,6 @@ ivas_error ivas_ism_metadata_sid_dec( if ( !bfi ) { - /* take into account padding bits as metadata bits to keep later bitrate checks valid */ - nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; - /*----------------------------------------------------------------* * ISm common signaling *----------------------------------------------------------------*/ @@ -948,6 +945,9 @@ ivas_error ivas_ism_metadata_sid_dec( } } + /* take into account padding bits as metadata bits to keep later bitrate checks valid */ + nb_bits_metadata[*sce_id_dtx] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index cdf6cbb875..7afbe5dc03 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -82,23 +82,6 @@ ivas_error ivas_sce_dec( { st->cng_type = FD_CNG; /* TODO: move to init if possible */ } - -#ifdef DISCRETE_ISM_DTX_CNG - // VE!!!!! - if ( st_ivas->ivas_format == ISM_FORMAT && st_ivas->ism_mode == ISM_MODE_DISC && st_ivas->nchan_transport > 1 ) // VE!!!!! keep bitexactness for 1ISM case for now - { - if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) - { - /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ - st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; - st->cng_paramISM_flag = 1; - } - else - { - st->cng_paramISM_flag = 0; - } - } -#endif #endif /*------------------------------------------------------------------* diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 3b0e99c4c2..a6b3f975c5 100755 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -424,6 +424,10 @@ typedef struct int16_t dtx_flag; int16_t sce_id_dtx; +#ifdef DISCRETE_ISM_DTX_CNG + int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ +#endif + } ISM_DTX_DATA_DEC; #endif @@ -1968,9 +1972,6 @@ typedef struct Decoder_Struct int16_t sba_planar; /* Ambisonic (SBA) planar flag */ int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t sba_dirac_stereo_flag; /* flag indicating stereo output for SBA DirAC modes with 1 TC */ -#ifdef DISCRETE_ISM_DTX_CNG - int16_t ism_dtx_hangover_cnt; /* hangover counter for ISM DTX decoder */ -#endif /* rendering modules */ RENDERER_TYPE renderer_type; /* renderer type */ -- GitLab From f9152c1a0a7615c76b7fcd39c241f2196973a551 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 20 Feb 2023 15:59:20 +0100 Subject: [PATCH 06/45] changes and cleaning under DTX_PARAM_BE --- lib_com/ivas_prot.h | 4 ---- lib_dec/ivas_ism_dtx_dec.c | 1 - lib_enc/ivas_ism_dtx_enc.c | 11 ----------- lib_enc/ivas_ism_enc.c | 23 ++++++++++------------- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4ece1a03b8..a52cb8723a 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -968,10 +968,6 @@ int16_t ivas_ism_dtx_enc_COMMON( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ -#ifdef MD_Q_PARAM_BE - , - const ISM_MODE ism_mode -#endif ); #endif /*! r: indication of DTX frame */ diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 8862a38d28..85a0ee085c 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -216,7 +216,6 @@ ivas_error ivas_ism_dtx_dec( } } - return IVAS_ERR_OK; } #endif diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index fc8867a5b0..bd276f2206 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -113,10 +113,6 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ -#ifdef MD_Q_PARAM_BE - , - const ISM_MODE ism_mode -#endif ) { int16_t ch, dtx_flag; @@ -184,13 +180,6 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end md_diff_flag[ch] = 1; } -#ifdef MD_Q_PARAM_BE - if ( ism_mode == ISM_MODE_PARAM ) - { - md_diff_flag[ch] = 1; - } -#endif - /* estimate SID metadata bit-budget */ nBits++; /* number of objects */ nBits++; /* SID metadata flag */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index b2dfde3782..3cca1e4099 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -196,12 +196,6 @@ ivas_error ivas_ism_enc( } vad_flag[sce_id] = st->vad_flag; -#ifdef DTX_PARAM_BE - if ( st_ivas->ism_mode == ISM_MODE_PARAM ) - { - vad_flag[sce_id] = vad_flag_dtx[sce_id][0]; - } -#endif } #ifdef PARAM_ISM_DTX_CNG @@ -219,19 +213,22 @@ ivas_error ivas_ism_enc( ivas_ism_get_sce_id_dtx( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); /* analysis and decision about DTX */ -#ifdef DISCRETE_ISM_DTX_CNG // VE!!!!! to be harmonized +#ifdef DISCRETE_ISM_DTX_CNG +#ifdef DTX_PARAM_BE if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { - dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag -#ifdef MD_Q_PARAM_BE - , - st_ivas->ism_mode #endif - ); + dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); +#ifdef DTX_PARAM_BE } else -#endif + { dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); + } +#endif +#else + dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); +#endif if ( sid_flag ) { -- GitLab From 76e479a8d1d2429cc3ee445c8bf0f5505edef771 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Feb 2023 10:25:12 +0100 Subject: [PATCH 07/45] debugging files under DEBUG_MODE_PARAM_ISM --- lib_com/options.h | 4 ++-- lib_enc/ivas_ism_enc.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fc8b89be6e..537a4c854f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -67,7 +67,7 @@ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ -/*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ +#define DEBUG_MODE_PARAM_ISM /* output Parametric ISM paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_INFO_TWEAK*/ /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ /*#define DEBUG_MODE_INFO_PLC */ /* define to output PLC related parameters */ /*#define DEBUG_MODE_INFO_ALLRAD*/ /* define to output generated HOA decoding mtx */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3cca1e4099..3bae42eeaa 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -240,6 +240,8 @@ ivas_error ivas_ism_enc( if ( st_ivas->hDirAC != NULL ) dbgwrite( &( st_ivas->hDirAC->hParamIsm->flag_noisy_speech ), sizeof( int16_t ), 1, 1, "./res/ParamISM_noisy_speech_flag_enc.dat" ); dbgwrite( &( st_ivas->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); + dbgwrite( &( st_ivas->hISMDTX->sce_id_dtx ), sizeof( int16_t ), 1, input_frame, "./res/sce_id_dtx" ); + dbgwrite( &( dtx_flag ), sizeof( int16_t ), 1, input_frame, "./res/dtx_flag" ); #endif } #endif -- GitLab From ba9f036823a23998e00983098ac6bc2f859f3fa9 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Feb 2023 17:49:24 +0100 Subject: [PATCH 08/45] =?UTF-8?q?-=20for=20DTX=20decision,=20use=20?= =?UTF-8?q?=E2=80=98vad=5Fflag=5Fdtx=E2=80=99=20instead=20of=20=E2=80=98va?= =?UTF-8?q?d=5Fflag=E2=80=99;=20under=20DISCRETE=5FISM=5FDTX=5FCNG;=20BE?= =?UTF-8?q?=20for=20paramISM,=20non-BE=20for=20discISM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib_enc/ivas_ism_enc.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3bae42eeaa..aca2fa9f1b 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -195,7 +195,16 @@ ivas_error ivas_ism_enc( return error; } - vad_flag[sce_id] = st->vad_flag; +#ifdef DISCRETE_ISM_DTX_CNG + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) + { + vad_flag[sce_id] = vad_flag_dtx[sce_id][0]; + } + else +#endif + { + vad_flag[sce_id] = st->vad_flag; + } } #ifdef PARAM_ISM_DTX_CNG -- GitLab From 918014bcfeaf1aac1d84739824ca67ea13de0aed Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Feb 2023 18:15:53 +0100 Subject: [PATCH 09/45] deactivate DTX_PARAM_BE; non-BE for paramISM --- lib_com/ivas_prot.h | 6 ++++++ lib_com/options.h | 2 +- lib_enc/ivas_ism_dtx_enc.c | 10 +++++++--- lib_enc/ivas_ism_enc.c | 5 +++-- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index c248646213..9cf3f0cfca 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -929,7 +929,11 @@ ivas_error ivas_ism_dtx_open( #ifdef DISCRETE_ISM_DTX_CNG /*! r: indication of DTX frame */ +#ifdef DTX_PARAM_BE int16_t ivas_ism_dtx_enc_COMMON( +#else +int16_t ivas_ism_dtx_enc( +#endif ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int16_t num_obj, /* i : number of objects */ @@ -940,11 +944,13 @@ int16_t ivas_ism_dtx_enc_COMMON( int16_t *sid_flag /* o : indication of SID frame */ ); #endif +#if ( !defined DISCRETE_ISM_DTX_CNG || defined DTX_PARAM_BE ) /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ int16_t *sid_flag /* o : indication of SID frame */ ); +#endif ivas_error ivas_ism_dtx_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_com/options.h b/lib_com/options.h index 73af6cd45a..e6156d6f9e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -184,7 +184,7 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define MD_Q_PARAM_BE #define MD_SMOOTH_PARAM_BE -#define DTX_PARAM_BE +/*#define DTX_PARAM_BE*/ /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 7b94e84dc0..aac58ff1cf 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -104,7 +104,11 @@ ivas_error ivas_ism_dtx_open( *-------------------------------------------------------------------*/ /*! r: indication of DTX frame */ -int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end +#ifdef DTX_PARAM_BE +int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end +#else +int16_t ivas_ism_dtx_enc( +#endif ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int16_t num_obj, /* i : number of objects */ @@ -276,7 +280,7 @@ int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end } #endif - +#if ( !defined DISCRETE_ISM_DTX_CNG || defined DTX_PARAM_BE ) /*-------------------------------------------------------------------* * ivas_ism_dtx_enc() * @@ -411,7 +415,7 @@ int16_t ivas_ism_dtx_enc( return dtx_flag; } - +#endif /*-------------------------------------------------------------------* * ivas_ism_get_sce_id_dtx() diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index aca2fa9f1b..8a0a97aab0 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -226,15 +226,16 @@ ivas_error ivas_ism_enc( #ifdef DTX_PARAM_BE if ( st_ivas->ism_mode != ISM_MODE_PARAM ) { -#endif dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#ifdef DTX_PARAM_BE } else { dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); } +#else + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); #endif + #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); #endif -- GitLab From 605e13eec0bc79a6d5eca34ea8a9aef4d09126cc Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Feb 2023 20:16:11 +0100 Subject: [PATCH 10/45] introduce UNIFY_MD_QUANTIZER --- lib_com/ivas_cnst.h | 11 +++++ lib_com/ivas_ism_config.c | 88 +++++++++++++++++++++++++++++++-- lib_com/ivas_prot.h | 21 ++++++++ lib_com/options.h | 1 + lib_dec/ivas_ism_metadata_dec.c | 34 +++++++++++-- lib_dec/ivas_ism_param_dec.c | 5 ++ lib_enc/ivas_ism_dtx_enc.c | 7 +++ lib_enc/ivas_ism_metadata_enc.c | 30 ++++++++++- lib_enc/ivas_ism_param_enc.c | 8 +++ 9 files changed, 197 insertions(+), 8 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index c45b4e6275..787ba95e27 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -340,9 +340,20 @@ typedef enum #else #define PARAM_ISM_DTX_COH_SCA_BITS 4 #endif +#if (defined DISCRETE_ISM_DTX_CNG && defined UNIFY_MD_QUANTIZER ) +#define ISM_DTX_AZI_BITS_HIGH 8 +#define ISM_DTX_ELE_BITS_HIGH 7 +#define ISM_Q_STEP_HIGH (ISM_Q_STEP / 2) +#define ISM_Q_STEP_BORDER_HIGH (ISM_Q_STEP_BORDER / 2) +#define ISM_DTX_AZI_BITS_LOW 6 +#define ISM_DTX_ELE_BITS_LOW 5 +#define ISM_Q_STEP_LOW (ISM_Q_STEP * 2) +#define ISM_Q_STEP_BORDER_LOW (ISM_Q_STEP_BORDER * 2) +#else #define PARAM_ISM_DTX_AZI_BITS 5 #define PARAM_ISM_DTX_ELE_BITS 4 #endif +#endif #ifdef DISCRETE_ISM_DTX_CNG #define ISM_DTX_ENER_BITS 4 #define ISM_DTX_COH_SCA_BITS 4 diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 16c6c9243a..30d16a04f2 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -359,12 +359,36 @@ int16_t ism_quant_meta( const float val, /* i : scalar value to quantize */ float *valQ, /* o : quantized value */ const float borders[], /* i : level borders */ - const int16_t cbsize /* i : codebook size */ +#ifdef UNIFY_MD_QUANTIZER + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ +#endif + const int16_t cbsize /* i : codebook size */ ) { int16_t idx, idx_start; float qlow, step; +#ifdef UNIFY_MD_QUANTIZER + if ( val <= borders[1] ) + { + qlow = borders[0]; + idx_start = 0; + step = q_step_border; + } + else if ( val <= borders[2] ) + { + qlow = borders[1]; + idx_start = (int16_t) ( ( borders[1] - borders[0] ) / q_step_border ); + step = q_step; + } + else + { + qlow = borders[2]; + idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); + step = q_step_border; + } +#else if ( val <= borders[1] ) { qlow = borders[0]; @@ -383,6 +407,7 @@ int16_t ism_quant_meta( idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP_BORDER; } +#endif idx = idx_start + (int16_t) max( 0.f, min( cbsize - 1, ( ( val - qlow ) / step + 0.5f ) ) ); *valQ = ( idx - idx_start ) * step + qlow; @@ -401,12 +426,36 @@ int16_t ism_quant_meta( float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ - const int16_t cbsize /* i : codebook size */ +#ifdef UNIFY_MD_QUANTIZER + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ +#endif + const int16_t cbsize /* i : codebook size */ ) { int16_t idx_start; float qlow, step, valQ; +#ifdef UNIFY_MD_QUANTIZER + if ( idx <= ( borders[1] - borders[0] ) / q_step_border ) + { + qlow = borders[0]; + idx_start = 0; + step = q_step_border; + } + else if ( idx <= cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ) + { + qlow = borders[1]; + idx_start = (int16_t) ( ( borders[1] - borders[0] ) / q_step_border ); + step = q_step; + } + else + { + qlow = borders[2]; + idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); + step = q_step_border; + } +#else if ( idx <= ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ) { qlow = borders[0]; @@ -425,6 +474,7 @@ float ism_dequant_meta( idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP_BORDER; } +#endif valQ = ( idx - idx_start ) * step + qlow; @@ -439,8 +489,7 @@ float ism_dequant_meta( * ---------------------------------------------------------------*/ void ivas_param_ism_config( - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ -) + PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ ) { int16_t i, num_obj; @@ -526,6 +575,36 @@ void update_last_metadata( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ +#ifdef UNIFY_MD_QUANTIZER +void ivas_get_ism_sid_quan_bitbudget( + const int16_t num_obj, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + float *q_step, /* o : quantization step */ + float *q_step_border, /* o : quantization step at the border */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +) +{ + *nBits_azimuth = ISM_DTX_AZI_BITS_HIGH; + *nBits_elevation = ISM_DTX_ELE_BITS_HIGH; + *q_step = ISM_Q_STEP_HIGH; + *q_step_border = ISM_Q_STEP_BORDER_HIGH; + *nBits_coh = ISM_DTX_COH_SCA_BITS; + *nBits_sce_id = 1; + + if ( num_obj >= 3 ) + { + *nBits_azimuth = ISM_DTX_AZI_BITS_LOW; + *nBits_elevation = ISM_DTX_ELE_BITS_LOW; + *q_step = ISM_Q_STEP_LOW; + *q_step_border = ISM_Q_STEP_BORDER_LOW; + *nBits_sce_id = 2; + } + + return; +} +#else /*! r: low resolution flag */ int16_t ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ @@ -554,3 +633,4 @@ int16_t ivas_get_ism_sid_quan_bitbudget( return low_res_q; } #endif +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9cf3f0cfca..380a945d86 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -793,6 +793,10 @@ int16_t ism_quant_meta( const float val, /* i : scalar value to quantize */ float *valQ, /* o : quantized value */ const float borders[], /* i : level borders */ +#ifdef UNIFY_MD_QUANTIZER + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ +#endif const int16_t cbsize /* i : codebook size */ ); @@ -800,6 +804,10 @@ int16_t ism_quant_meta( float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ +#ifdef UNIFY_MD_QUANTIZER + const float q_step, /* i : quantization step */ + const float q_step_border, /* i : quantization step at the border */ +#endif const int16_t cbsize /* i : codebook size */ ); @@ -1023,6 +1031,18 @@ void update_last_metadata( const int16_t updt_flag[] /* i : last metadata update flag */ ); +#ifdef UNIFY_MD_QUANTIZER +/*! r: low resolution flag */ +void ivas_get_ism_sid_quan_bitbudget( + const int16_t num_obj, /* i : number of objects */ + int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ + int16_t *nBits_elevation, /* o : number of Q bits for elevation */ + float *q_step, /* o : quantization step */ + float *q_step_border, /* o : quantization step at the border */ + int16_t *nBits_coh, /* o : number of Q bits for coherence */ + int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ +); +#else /*! r: low resolution flag */ int16_t ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ @@ -1033,6 +1053,7 @@ int16_t ivas_get_ism_sid_quan_bitbudget( ); #endif #endif +#endif /*----------------------------------------------------------------------------------* * DFT Stereo prototypes diff --git a/lib_com/options.h b/lib_com/options.h index e6156d6f9e..ceb443d363 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -185,6 +185,7 @@ #define MD_Q_PARAM_BE #define MD_SMOOTH_PARAM_BE /*#define DTX_PARAM_BE*/ +#define UNIFY_MD_QUANTIZER /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index d9db83cdab..dc453f678a 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -376,7 +376,11 @@ ivas_error ivas_ism_metadata_dec( } else /* ISM_MODE_DISC */ { +#ifdef UNIFY_MD_QUANTIZER + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); +#else hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); +#endif } /*----------------------------------------------------------------* @@ -438,7 +442,11 @@ ivas_error ivas_ism_metadata_dec( } else /* ISM_MODE_DISC */ { +#ifdef UNIFY_MD_QUANTIZER + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#endif } /*----------------------------------------------------------------* @@ -611,7 +619,7 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG /*----------------------------------------------------------------* - * Updates + * Updates *----------------------------------------------------------------*/ set_s( md_diff_flag, 1, num_obj ); @@ -676,6 +684,7 @@ ivas_error create_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG +#ifndef UNIFY_MD_QUANTIZER /*-------------------------------------------------------------------* * ivas_ism_dec_dequantize_DOA_dtx() * @@ -737,7 +746,7 @@ static void ivas_ism_dec_dequantize_DOA_dtx( return; } - +#endif /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_dec() @@ -758,7 +767,12 @@ ivas_error ivas_ism_metadata_sid_dec( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { +#ifdef UNIFY_MD_QUANTIZER + int16_t i, ch, nb_bits_start, last_bit_pos; + float q_step, q_step_border; +#else int16_t i, ch, nb_bits_start, last_bit_pos, low_res_q; +#endif int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; int16_t md_diff_flag[MAX_NUM_OBJECTS]; @@ -815,7 +829,11 @@ ivas_error ivas_ism_metadata_sid_dec( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ +#ifdef UNIFY_MD_QUANTIZER + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); +#else low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); +#endif /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -881,6 +899,7 @@ ivas_error ivas_ism_metadata_sid_dec( if ( md_diff_flag[ch] == 1 ) { +#ifndef UNIFY_MD_QUANTIZER if ( low_res_q ) { idx_azimuth = get_next_indice( st0, nBits_azimuth ); @@ -889,10 +908,12 @@ ivas_error ivas_ism_metadata_sid_dec( ivas_ism_dec_dequantize_DOA_dtx( nBits_azimuth, nBits_elevation, idx_azimuth, idx_elevation, &( hIsmMetaData->azimuth ), &( hIsmMetaData->elevation ) ); } else +#endif { /* Azimuth decoding */ idx_azimuth = get_next_indice( st0, nBits_azimuth ); +#ifndef UNIFY_MD_QUANTIZER // VE!!!!! TBV /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) { @@ -916,9 +937,13 @@ ivas_error ivas_ism_metadata_sid_dec( } hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); +#else + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << nBits_azimuth ); +#endif /* Elevation decoding */ idx_elevation = get_next_indice( st0, nBits_elevation ); +#ifndef UNIFY_MD_QUANTIZER /* sanity check in case of FER or BER */ if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) @@ -928,9 +953,12 @@ ivas_error ivas_ism_metadata_sid_dec( /* Elevation dequantization */ hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#else + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << nBits_elevation ); +#endif } - // VE: ToDo: this would not work well for switching from low_res_q to active frame coding + // VE!!!!! verify for switching from low_res_q to active frame coding #ifdef MD_Q_PARAM_BE if ( ism_mode != ISM_MODE_PARAM ) #endif diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index f8672e4abf..d08618e9cd 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -63,8 +63,13 @@ static void ivas_param_ism_dec_dequant_DOA( /* Get the azimuth and elevation values */ for ( i = 0; i < hParamIsm->num_obj; i++ ) { +#ifdef UNIFY_MD_QUANTIZER + hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); + hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#endif } return; diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index aac58ff1cf..a37820264b 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -123,6 +123,9 @@ int16_t ivas_ism_dtx_enc( int16_t nBits, nBits_MD_max; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; +#ifdef UNIFY_MD_QUANTIZER + float tmp1, tmp2; +#endif /*------------------------------------------------------------------* * compute global ISM DTX flag @@ -167,7 +170,11 @@ int16_t ivas_ism_dtx_enc( if ( dtx_flag ) { +#ifdef UNIFY_MD_QUANTIZER + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); +#else ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); +#endif nBits = 0; for ( ch = 0; ch < num_obj; ch++ ) diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index dd57403d1e..f44088ea6c 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -215,8 +215,13 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { /* send metadata even in inactive segments when noise is audible and metadata are changing */ +#ifdef UNIFY_MD_QUANTIZER + diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ) ); + diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ) ) ); +#else diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); +#endif if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) { @@ -324,7 +329,11 @@ ivas_error ivas_ism_metadata_enc( /* Azimuth quantization (quantize azimuth to the AZIMUTH_NBITS-bit index */ if ( ism_mode == ISM_MODE_DISC ) { +#ifdef UNIFY_MD_QUANTIZER + idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); +#else idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); +#endif } else if ( ism_mode == ISM_MODE_PARAM ) { @@ -430,7 +439,11 @@ ivas_error ivas_ism_metadata_enc( /* Elevation quantization (quantize azimuth to the ELEVATION_NBITS-bit index */ if ( ism_mode == ISM_MODE_DISC ) { +#ifdef UNIFY_MD_QUANTIZER + idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#endif } else /* ISM_MODE_PARAM */ { @@ -778,6 +791,7 @@ ivas_error create_ism_metadata_enc( #ifdef DISCRETE_ISM_DTX_CNG +#ifndef UNIFY_MD_QUANTIZER /*-------------------------------------------------------------------* * ivas_ism_quantize_DOA_dtx() * @@ -842,7 +856,7 @@ static void ivas_ism_quantize_DOA_dtx( return; } - +#endif /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_enc() @@ -863,7 +877,12 @@ void ivas_ism_metadata_sid_enc( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { +#ifdef UNIFY_MD_QUANTIZER + int16_t i, ch, nBits, nBits_start, nBits_unused; + float q_step, q_step_border; +#else int16_t i, ch, nBits, nBits_start, nBits_unused, low_res_q; +#endif int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float valQ; @@ -896,7 +915,11 @@ void ivas_ism_metadata_sid_enc( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ +#ifdef UNIFY_MD_QUANTIZER + ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); +#else low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); +#endif /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -951,6 +974,10 @@ void ivas_ism_metadata_sid_enc( { hIsmMetaData = hIsmMeta[ch]; +#ifdef UNIFY_MD_QUANTIZER + idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); + idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); +#else if ( low_res_q ) { ivas_ism_quantize_DOA_dtx( hIsmMetaData->azimuth, hIsmMetaData->elevation, nBits_azimuth, nBits_elevation, &idx_azimuth, &idx_elevation ); @@ -960,6 +987,7 @@ void ivas_ism_metadata_sid_enc( idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); } +#endif push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 09383db54b..be8c8135bd 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -162,10 +162,18 @@ static void ivas_param_ism_enc_quantize_DOA( for ( i = 0; i < num_obj; i++ ) { /* Quantize the elevation and obtain quantized elevation value and index */ +#ifdef UNIFY_MD_QUANTIZER + ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); +#else ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); +#endif /* Obtain the index of quantized azimuth values */ +#ifdef UNIFY_MD_QUANTIZER + azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); +#else azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); +#endif /*Replace azimuth with quantized values */ hIsmMetaData[i]->azimuth = valQ; -- GitLab From 1f1ddfbbe4c933e1dd4056267861ff2466d2cea1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 09:15:25 +0100 Subject: [PATCH 11/45] deactivate MD_Q_PARAM_BE and MD_SMOOTH_PARAM_BE; not BE for paramISM --- lib_com/options.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index ceb443d363..c7b99b4a7e 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -182,8 +182,8 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define MD_Q_PARAM_BE -#define MD_SMOOTH_PARAM_BE +/*#define MD_Q_PARAM_BE*/ +/*#define MD_SMOOTH_PARAM_BE*/ /*#define DTX_PARAM_BE*/ #define UNIFY_MD_QUANTIZER -- GitLab From 7625d3be4c6230d04b19b46dc782f9ac0df2e8d6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 11:38:37 +0100 Subject: [PATCH 12/45] fixes + tuning in MD quantization --- lib_dec/ivas_ism_metadata_dec.c | 27 ++++++++++++++++++++------- lib_enc/ivas_ism_dtx_enc.c | 4 ++-- lib_enc/ivas_ism_metadata_enc.c | 14 ++++++++++++++ 3 files changed, 36 insertions(+), 9 deletions(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index dc453f678a..f884981cad 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -53,8 +53,8 @@ #define IVAS_ISM_DTX_HO_MAX 5 -#define CNG_MD_MAX_DIFF_AZIMUTH 8 -#define CNG_MD_MAX_DIFF_ELEVATION 8 +#define CNG_MD_MAX_DIFF_AZIMUTH 5 +#define CNG_MD_MAX_DIFF_ELEVATION 5 /*-------------------------------------------------------------------* @@ -72,7 +72,7 @@ static void ism_metadata_smooth( ISM_METADATA_HANDLE hIsmMetaData; int16_t ch; float diff; - + return; for ( ch = 0; ch < num_obj; ch++ ) { hIsmMetaData = hIsmMeta[ch]; @@ -913,7 +913,7 @@ ivas_error ivas_ism_metadata_sid_dec( /* Azimuth decoding */ idx_azimuth = get_next_indice( st0, nBits_azimuth ); -#ifndef UNIFY_MD_QUANTIZER // VE!!!!! TBV +#ifndef UNIFY_MD_QUANTIZER /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) { @@ -938,7 +938,7 @@ ivas_error ivas_ism_metadata_sid_dec( hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); #else - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << nBits_azimuth ); + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); #endif /* Elevation decoding */ @@ -954,17 +954,30 @@ ivas_error ivas_ism_metadata_sid_dec( /* Elevation dequantization */ hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); #else - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << nBits_elevation ); + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); #endif } - // VE!!!!! verify for switching from low_res_q to active frame coding #ifdef MD_Q_PARAM_BE if ( ism_mode != ISM_MODE_PARAM ) #endif { +#ifdef UNIFY_MD_QUANTIZER + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + { + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + } + else + { + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); + } +#else hIsmMetaData->last_azimuth_idx = idx_azimuth; hIsmMetaData->last_elevation_idx = idx_elevation; +#endif } /* save for smoothing metadata evolution */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index a37820264b..830dfae810 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -48,8 +48,8 @@ * Local constants *-----------------------------------------------------------------------*/ -#define MD_MAX_DIFF_AZIMUTH 15 -#define MD_MAX_DIFF_ELEVATION 15 +#define MD_MAX_DIFF_AZIMUTH 10 +#define MD_MAX_DIFF_ELEVATION 10 #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index f44088ea6c..3d34debc51 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -996,8 +996,22 @@ void ivas_ism_metadata_sid_enc( if ( ism_mode != ISM_MODE_PARAM ) #endif { +#ifdef UNIFY_MD_QUANTIZER + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + { + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + } + else + { + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); + } +#else hIsmMetaData->last_azimuth_idx = idx_azimuth; hIsmMetaData->last_elevation_idx = idx_elevation; +#endif } } } -- GitLab From 8364fb0dd9f11bec5d916157c029880cbb9882ff Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 11:42:31 +0100 Subject: [PATCH 13/45] remove "return" leftover --- lib_dec/ivas_ism_metadata_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index f884981cad..04cf53574a 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -72,7 +72,7 @@ static void ism_metadata_smooth( ISM_METADATA_HANDLE hIsmMetaData; int16_t ch; float diff; - return; + for ( ch = 0; ch < num_obj; ch++ ) { hIsmMetaData = hIsmMeta[ch]; -- GitLab From a128918ee2bcca2c0173174943c7ba75a7c6149c Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 11:50:10 +0100 Subject: [PATCH 14/45] address two VE comments --- lib_dec/ivas_dec.c | 6 +++--- lib_enc/ivas_ism_dtx_enc.c | 6 +++--- lib_enc/ivas_stat_enc.h | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 1e4dd9c4c7..a0c3e4a650 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -400,9 +400,9 @@ ivas_error ivas_dec( } else /* SBA_MODE_SPAR */ if ( !st_ivas->sba_dirac_stereo_flag ) - { - ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ - } + { + ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ + } } else if ( st_ivas->ivas_format == MC_FORMAT ) { diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 830dfae810..f7d6fc52c7 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -79,9 +79,9 @@ ivas_error ivas_ism_dtx_open( hISMDTX->sce_id_dtx = 0; #ifdef DISCRETE_ISM_DTX_CNG hISMDTX->cnt_SID_ISM = -1; -#endif - +#else set_s( hISMDTX->dtx_speech_buffer_enc, 0, PARAM_ISM_HYS_BUF_SIZE ); +#endif for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { @@ -105,7 +105,7 @@ ivas_error ivas_ism_dtx_open( /*! r: indication of DTX frame */ #ifdef DTX_PARAM_BE -int16_t ivas_ism_dtx_enc_COMMON( // VE!!!!! to be renamed at the end +int16_t ivas_ism_dtx_enc_COMMON( #else int16_t ivas_ism_dtx_enc( #endif diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 60dc09fb11..5943591ee1 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -562,8 +562,9 @@ typedef struct #ifdef DISCRETE_ISM_DTX_CNG int16_t cnt_SID_ISM; -#endif // VE!!!!! +#else int16_t dtx_speech_buffer_enc[PARAM_ISM_HYS_BUF_SIZE]; +#endif float long_term_energy_stereo_dmx_enc[MAX_NUM_OBJECTS][PARAM_ISM_HYS_BUF_SIZE]; float coh[MAX_NUM_OBJECTS]; -- GitLab From eed45821f3ac89f01329b464e6d21378ab7436ac Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 12:19:31 +0100 Subject: [PATCH 15/45] enable DTX for 1ISM; under DISCRETE_ISM_DTX_CNG --- lib_dec/ivas_ism_dtx_dec.c | 2 ++ lib_dec/ivas_ism_metadata_dec.c | 2 ++ lib_enc/ivas_ism_enc.c | 12 ++++++------ lib_enc/ivas_ism_metadata_enc.c | 2 ++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 85a0ee085c..c4d35cbf9d 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -110,12 +110,14 @@ ivas_error ivas_ism_dtx_dec( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifndef DISCRETE_ISM_DTX_CNG if ( st_ivas->nchan_transport == 1 ) { nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; return IVAS_ERR_OK; } +#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 04cf53574a..64f8ea926a 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -167,6 +167,7 @@ ivas_error ivas_ism_metadata_dec( push_wmops( "ism_meta_dec" ); +#ifndef DISCRETE_ISM_DTX_CNG if ( ism_total_brate == IVAS_SID_5k2 || ism_total_brate == FRAME_NO_DATA ) { /* no metadata decoding in CNG */ @@ -189,6 +190,7 @@ ivas_error ivas_ism_metadata_dec( pop_wmops(); return error; } +#endif /* initialization */ st0 = hSCE[0]->hCoreCoder[0]; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 8a0a97aab0..4fcf96e629 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -85,7 +85,9 @@ ivas_error ivas_ism_enc( float Etot_LR[1]; /* total energy; correlation shift */ float lf_E[1][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ int16_t localVAD_HE_SAD[1]; /* local HE VAD */ +#ifndef DISCRETE_ISM_DTX_CNG int16_t i, nBits; +#endif #ifdef PARAM_ISM_DTX_CNG #ifdef DISCRETE_ISM_DTX_CNG int16_t num_obj, dtx_flag, sid_flag, flag_noisy_speech; @@ -213,7 +215,7 @@ ivas_error ivas_ism_enc( *-----------------------------------------------------------------*/ #ifdef DISCRETE_ISM_DTX_CNG - if ( st_ivas->hEncoderConfig->Opt_DTX_ON && num_obj > 1 ) // VE!!!!! keep bitexactness for 1ISM case for now + if ( st_ivas->hEncoderConfig->Opt_DTX_ON ) #else if ( st_ivas->hEncoderConfig->Opt_DTX_ON && st_ivas->ism_mode == ISM_MODE_PARAM ) #endif @@ -334,19 +336,16 @@ ivas_error ivas_ism_enc( st = st_ivas->hSCE[0]->hCoreCoder[0]; #ifdef DISCRETE_ISM_DTX_CNG - if ( st->core_brate == SID_2k40 || sid_flag ) // VE!!!!! to be simplified + if ( sid_flag ) #else if ( st->core_brate == SID_2k40 ) #endif { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); +#ifndef DISCRETE_ISM_DTX_CNG #ifdef PARAM_ISM_DTX_CNG -#ifdef DISCRETE_ISM_DTX_CNG - if ( num_obj == 1 ) // VE!!!!! keep bitexactness for 1ISM case for now -#else if ( st_ivas->ism_mode != ISM_MODE_PARAM ) -#endif #endif { /* write unused bits */ @@ -358,6 +357,7 @@ ivas_error ivas_ism_enc( nBits -= i; } } +#endif } /*------------------------------------------------------------------* diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 3d34debc51..99aba8b0b0 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -184,6 +184,7 @@ ivas_error ivas_ism_metadata_enc( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); } +#ifndef DISCRETE_ISM_DTX_CNG if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ism_mode == ISM_MODE_DISC ) { /* no metadata encoding in CNG */ @@ -191,6 +192,7 @@ ivas_error ivas_ism_metadata_enc( return error; } +#endif /* initialization */ ism_metadata_flag_global = 0; -- GitLab From 9ec0c0f4207e6c968339cfde9e33a546f468407e Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 22 Feb 2023 14:34:34 +0100 Subject: [PATCH 16/45] fixes for bitrate switching in DTX; changes are within DISCRETE_ISM_DTX_CNG; BE in non-switching conditions --- lib_com/ivas_prot.h | 3 +++ lib_dec/ivas_init_dec.c | 4 ++++ lib_dec/ivas_ism_dec.c | 29 ++++++++++++++++++++++++++++- lib_dec/ivas_ism_dtx_dec.c | 26 +++++++++++++++++++++++++- lib_dec/ivas_ism_metadata_dec.c | 6 +----- lib_enc/ivas_ism_dtx_enc.c | 2 ++ 6 files changed, 63 insertions(+), 7 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f7024fa0c0..431a4e09ec 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -886,6 +886,9 @@ ivas_error ivas_ism_enc_config( ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ +#ifdef DISCRETE_ISM_DTX_CNG + const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ +#endif const int16_t num_obj /* i : number of objects in the bitstream */ ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 64e72e0625..df6e4cb6e8 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -109,7 +109,11 @@ ivas_error ivas_dec_setup( k--; } +#ifdef DISCRETE_ISM_DTX_CNG + ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, num_obj ); +#else ivas_ism_dec_config( st_ivas, num_obj ); +#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 6f07130d1d..a26b25153e 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -207,11 +207,16 @@ static ivas_error ivas_ism_bitrate_switching( /*! r : ISM format mode */ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - const int16_t num_obj /* i : number of objects in the bitstream */ +#ifdef DISCRETE_ISM_DTX_CNG + const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ +#endif + const int16_t num_obj /* i : number of objects in the bitstream */ ) { int32_t ivas_total_brate; +#ifndef DISCRETE_ISM_DTX_CNG ISM_MODE last_ism_mode; +#endif ivas_error error; int16_t nchan_transport_old; @@ -219,8 +224,10 @@ ivas_error ivas_ism_dec_config( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; +#ifndef DISCRETE_ISM_DTX_CNG /* store last frame ISM mode */ last_ism_mode = st_ivas->ism_mode; +#endif /* Assumes that num of input objects are constant */ nchan_transport_old = num_obj; @@ -248,7 +255,9 @@ ivas_error ivas_ism_dec_config( if ( st_ivas->ini_active_frame != 0 ) { /* ISM bit-rate switching */ +#ifndef DISCRETE_ISM_DTX_CNG if ( st_ivas->hDecoderConfig->last_ivas_total_brate != IVAS_SID_5k2 && st_ivas->hDecoderConfig->last_ivas_total_brate != FRAME_NO_DATA ) +#endif { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { @@ -259,6 +268,23 @@ ivas_error ivas_ism_dec_config( } else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { +#ifdef DISCRETE_ISM_DTX_CNG + st_ivas->nchan_transport = num_obj; + if ( st_ivas->ism_mode == ISM_MODE_PARAM ) + { + st_ivas->nchan_transport = 2; + if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) + { + st_ivas->hDecoderConfig->nchan_out = num_obj; + } + } + + /* ISM mode switching */ + if ( st_ivas->ism_mode != last_ism_mode ) + { + ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ); + } +#else #ifdef PARAM_ISM_DTX_CNG if ( last_ism_mode == ISM_MODE_PARAM ) { @@ -269,6 +295,7 @@ ivas_error ivas_ism_dec_config( { st_ivas->nchan_transport = num_obj; } +#endif } switch ( num_obj ) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index c4d35cbf9d..dbf7462e41 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -67,6 +67,9 @@ static void ivas_ism_preprocessing( { /* reset the bitstream to at least read the cng type and bandwidth for non transmitted SCE */ st->bit_stream = st_ivas->hSCE[0]->hCoreCoder[0]->bit_stream; +#ifdef DISCRETE_ISM_DTX_CNG + st->next_bit_pos = 0; /* note: needed in paramISM -> discISM switching */ +#endif if ( sce_id == st_ivas->hISMDTX.sce_id_dtx ) { @@ -106,6 +109,7 @@ ivas_error ivas_ism_dtx_dec( #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; int16_t flag_noisy_speech, sce_id_dtx; + ISM_MODE last_ism_mode; #endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -128,9 +132,9 @@ ivas_error ivas_ism_dtx_dec( num_obj_prev = st_ivas->nchan_transport; } - /* read number of objects */ if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { + /* read number of objects */ num_obj = 1; pos = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); @@ -139,6 +143,9 @@ ivas_error ivas_ism_dtx_dec( ( num_obj )++; pos--; } +#ifdef DISCRETE_ISM_DTX_CNG + pos--; +#endif if ( num_obj != num_obj_prev ) { @@ -146,6 +153,22 @@ ivas_error ivas_ism_dtx_dec( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); } +#ifdef DISCRETE_ISM_DTX_CNG + last_ism_mode = st_ivas->ism_mode; + + /* read ism_mode */ + if ( num_obj > 2 ) + { + pos -= num_obj; /* SID metadata flags */ + + short idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); + + ISM_MODE ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + st_ivas->ism_mode = ism_mode_bstr; + } + + ivas_ism_dec_config( st_ivas, last_ism_mode, num_obj ); +#else ivas_ism_dec_config( st_ivas, num_obj ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) @@ -156,6 +179,7 @@ ivas_error ivas_ism_dtx_dec( { st_ivas->nchan_transport = num_obj; } +#endif } else { diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 64f8ea926a..e9d5638763 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -849,11 +849,7 @@ ivas_error ivas_ism_metadata_sid_dec( { idx = get_next_indice( st0, 1 ); ism_mode_bstr = (ISM_MODE) ( idx + 1 ); - - if ( ism_mode_bstr != ism_mode ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "\n!!! Error: Switching ISM mode in CNG not verified yet. Exiting.\n\n" ); - } + /* note: ISM mode was already read and used for configuration in in ivas_ism_dtx_dec() */ if ( ism_mode_bstr == ISM_MODE_PARAM ) { diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index f7d6fc52c7..7a37ee9df3 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -239,6 +239,7 @@ int16_t ivas_ism_dtx_enc( for ( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->core_brate = -1; + set_bw( IVAS_SCE, hSCE[ch]->element_brate, hSCE[ch]->hCoreCoder[0], MODE1 ); } hISMDTX->cnt_SID_ISM = -1; @@ -246,6 +247,7 @@ int16_t ivas_ism_dtx_enc( /* IVAS format signaling was erased in dtx() */ if ( hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot == 0 ) { + /* replicate ivas_write_format() */ push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, 2 /* == ISM format */, IVAS_FORMAT_SIGNALING_NBITS ); } } -- GitLab From ef8999bc85726342126de60c9f68a4ccb5369fbb Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Thu, 23 Feb 2023 22:40:05 +0100 Subject: [PATCH 17/45] CNG fixes (force noise estimation for active frames, force FD_CNG for DiscISM) under DISC_CNG. --- lib_com/options.h | 1 + lib_dec/fd_cng_dec.c | 12 ++++++++++++ lib_dec/ivas_sce_dec.c | 4 ++++ lib_dec/ivas_tcx_core_dec.c | 4 ++++ 4 files changed, 21 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index f3ca408f40..83f7fb2123 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -164,6 +164,7 @@ /*#define MD_SMOOTH_PARAM_BE*/ /*#define DTX_PARAM_BE*/ #define UNIFY_MD_QUANTIZER +#define DISC_CNG /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 39b09921e9..4cf3b3c12b 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -414,6 +414,7 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ +#ifndef DISC_CNG if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && @@ -423,6 +424,17 @@ void ApplyFdCng( !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) +#else /* ensure that the noise estimation is always performed outside of a CNG part (ISM only) */ + if ( concealWholeFrame == 0 && + ( timeDomainInput == NULL || + ( *timeDomainInput( -FLT_MAX ) && + *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && + *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && + ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || !st->cng_paramISM_flag ) && + !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || + ( st->element_mode == IVAS_CPE_TD ) ) && + ( !st->BER_detect ) ) +#endif { /* Perform noise estimation at the decoder */ perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 7afbe5dc03..7d887fed87 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -78,7 +78,11 @@ ivas_error ivas_sce_dec( last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; #ifdef PARAM_ISM_DTX_CNG +#ifdef DISC_CNG + if ( st_ivas->ivas_format == ISM_FORMAT ) +#else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) +#endif { st->cng_type = FD_CNG; /* TODO: move to init if possible */ } diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 378ddec9aa..fcca5f53dc 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -730,7 +730,11 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { #ifdef PARAM_ISM_DTX_CNG +#ifndef DISC_CNG if ( ivas_format == ISM_FORMAT && ism_mode == ISM_MODE_PARAM ) +#else + if ( ivas_format == ISM_FORMAT ) +#endif { float buffer[L_FRAME16k]; lerp( signal_outFB, buffer, st->L_frame, hTcxDec->L_frameTCX ); -- GitLab From 74b62091888f0d05aa9b9546740feffd8cc9487b Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Fri, 24 Feb 2023 12:01:52 +0100 Subject: [PATCH 18/45] Missing declaration of flag_noisy_speech when DISCRETE_ISM_DTX_CNG is inactive. --- lib_enc/ivas_ism_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 4fcf96e629..02456f2d03 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -93,7 +93,7 @@ ivas_error ivas_ism_enc( int16_t num_obj, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; #else - int16_t dtx_flag, sid_flag; + int16_t dtx_flag, sid_flag, flag_noisy_speech; #endif #endif ivas_error error; -- GitLab From a4dabfe686f2d73ac3808412c6630bf51380a32d Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Feb 2023 16:19:20 +0100 Subject: [PATCH 19/45] fix compilation with DISC_CNG being disabled --- lib_com/ivas_prot.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 02777f4290..f8177afc39 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -509,8 +509,8 @@ void stereo_tcx_core_dec( , const IVAS_FORMAT ivas_format /* i : IVAS format */ #ifndef DISC_CNG - const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ - #endif + ,const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ +#endif #endif ); -- GitLab From 3a833e96bca6fb5c3da5046ac35334b4a3226f13 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Mon, 27 Feb 2023 18:13:11 +0100 Subject: [PATCH 20/45] Fix non-BE issues by removing cng_paramISM_flag from ApplyFdCng(). --- lib_dec/fd_cng_dec.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 4cf3b3c12b..39b09921e9 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -414,7 +414,6 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ -#ifndef DISC_CNG if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && @@ -424,17 +423,6 @@ void ApplyFdCng( !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) -#else /* ensure that the noise estimation is always performed outside of a CNG part (ISM only) */ - if ( concealWholeFrame == 0 && - ( timeDomainInput == NULL || - ( *timeDomainInput( -FLT_MAX ) && - *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && - *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && - ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || !st->cng_paramISM_flag ) && - !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || - ( st->element_mode == IVAS_CPE_TD ) ) && - ( !st->BER_detect ) ) -#endif { /* Perform noise estimation at the decoder */ perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); -- GitLab From 874a29c85cf6bdc3fb042517c6d6f6a754cf69ad Mon Sep 17 00:00:00 2001 From: vaclav Date: Sun, 5 Mar 2023 14:54:12 +0100 Subject: [PATCH 21/45] - add TUNE_360_OBJECT_WITH_NOISE (switch under development) --- lib_com/options.h | 5 ++++- lib_enc/ivas_core_enc.c | 2 ++ lib_enc/ivas_ism_dtx_enc.c | 7 +++++++ lib_enc/ivas_ism_enc.c | 37 +++++++++++++++++++++++++++++++++ lib_enc/ivas_ism_metadata_enc.c | 6 ++++++ 5 files changed, 56 insertions(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 43483973b3..fbb764cae6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ +#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -168,6 +168,9 @@ #define UNIFY_MD_QUANTIZER #define DISC_CNG +#define TUNE_360_OBJECT_WITH_NOISE // VA: issue 360: consider objects being speech+noise for active speech coding */ + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ #endif diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index e53033ab98..002e499f4b 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -448,6 +448,8 @@ ivas_error ivas_core_enc( dbgwrite( &st->sp_aud_decision1, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision1", n, id, ENC ) ); dbgwrite( &st->sp_aud_decision2, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "sp_aud_decision2", n, id, ENC ) ); + dbgwrite( &st->lp_noise, sizeof( float ), 1, input_frame, fname( debug_dir, "lp_noise", n, id, ENC ) ); + #if ( defined DEBUG_MODE_ACELP ) || ( defined DEBUG_MODE_TCX ) if ( st->coder_type == INACTIVE || st->coder_type == UNVOICED ) { diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 7a37ee9df3..353145fcd5 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -127,6 +127,13 @@ int16_t ivas_ism_dtx_enc( float tmp1, tmp2; #endif +#ifdef TUNE_360_OBJECT_WITH_NOISE + for ( ch = 0; ch < nchan_transport; ch++ ) + { + hSCE[ch]->hCoreCoder[0]->low_rate_mode = 0; + } +#endif + /*------------------------------------------------------------------* * compute global ISM DTX flag *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 02456f2d03..e3a8227a3f 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -434,6 +434,43 @@ ivas_error ivas_ism_enc( } #endif + +#ifdef PARAM_ISM_DTX_CNG +#ifdef DEBUG_MODE_INFO + if ( dtx_flag ) + { + float tmpF; + int16_t id, n; + + n = 0; + for ( sce_id = 0; sce_id < st_ivas->nchan_transport; sce_id++ ) + { + if ( sce_id != st_ivas->hISMDTX->sce_id_dtx ) + { + st = st_ivas->hSCE[sce_id]->hCoreCoder[0]; + id = st->id_element; + + dbgwrite( &st->core, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "core", n, id, ENC ) ); + dbgwrite( &st->extl, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "extl", n, id, ENC ) ); + dbgwrite( &st->bwidth, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "bwidth", n, id, ENC ) ); + tmpF = st->total_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "total_brate", n, id, ENC ) ); + tmpF = st->core_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "core_brate", n, id, ENC ) ); + tmpF = st->extl_brate / 1000.0f; + dbgwrite( &tmpF, sizeof( float ), 1, input_frame, fname( debug_dir, "extl_brate", n, id, ENC ) ); + + dbgwrite( &st->coder_type, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type", n, id, ENC ) ); + dbgwrite( &st->coder_type_raw, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "coder_type_raw", n, id, ENC ) ); + dbgwrite( &st->vad_flag, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "vad_flag", n, id, ENC ) ); + dbgwrite( &st->localVAD, sizeof( int16_t ), 1, input_frame, fname( debug_dir, "localVAD", n, id, ENC ) ); + + dbgwrite( &st->lp_noise, sizeof( float ), 1, input_frame, fname( debug_dir, "lp_noise", n, id, ENC ) ); + } + } + } +#endif +#endif pop_wmops(); return error; diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 99aba8b0b0..851ffc65c2 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -212,6 +212,9 @@ ivas_error ivas_ism_metadata_enc( } else if ( ism_mode == ISM_MODE_DISC ) { +#ifdef TUNE_360_OBJECT_WITH_NOISE + hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; +#else hIsmMeta[ch]->ism_metadata_flag = localVAD[ch]; if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) @@ -230,6 +233,7 @@ ivas_error ivas_ism_metadata_enc( hIsmMeta[ch]->ism_metadata_flag = 1; } } +#endif if ( hSCE[ch]->hCoreCoder[0]->tcxonly ) { @@ -245,6 +249,7 @@ ivas_error ivas_ism_metadata_enc( rate_ism_importance( nchan_transport, hIsmMeta, hSCE, ism_imp ); +#ifndef TUNE_360_OBJECT_WITH_NOISE /* relax the importance decision in "stereo" coding for noisy audio */ if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) { @@ -264,6 +269,7 @@ ivas_error ivas_ism_metadata_enc( } } } +#endif /*----------------------------------------------------------------* * Write ISm common signaling -- GitLab From 043ba83ed4304e17da70b68990be8ddbfed197c3 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Mon, 6 Mar 2023 16:43:05 +0100 Subject: [PATCH 22/45] Rename cng_paramISM_flag to cng_ism_flag. BE. --- lib_dec/acelp_core_dec.c | 6 +++--- lib_dec/fd_cng_dec.c | 12 ++++++------ lib_dec/init_dec.c | 2 +- lib_dec/ivas_ism_dtx_dec.c | 4 ++-- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/stat_dec.h | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index 571311ed12..9608d03002 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -534,7 +534,7 @@ ivas_error acelp_core_dec( } #ifdef PARAM_ISM_DTX_CNG if ( !st->read_sid_info ) - // if (!st->read_sid_info && st->cng_paramISM_flag) /* read_sid_info can only be 0 in ParamISM mode */ + // if (!st->read_sid_info && st->cng_ism_flag) /* read_sid_info can only be 0 in ParamISM mode */ { float noise_lvl_highest; @@ -1132,7 +1132,7 @@ ivas_error acelp_core_dec( } #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode != IVAS_CPE_TD && !st->cng_paramISM_flag ) + if ( st->element_mode != IVAS_CPE_TD && !st->cng_ism_flag ) #else if ( st->element_mode != IVAS_CPE_TD ) #endif @@ -1312,7 +1312,7 @@ ivas_error acelp_core_dec( if ( ( st->core_brate == FRAME_NO_DATA || st->core_brate == SID_2k40 ) && ( st->cng_type == FD_CNG ) && ( st->hFdCngDec->hFdCngCom->numCoreBands < st->cldfbSyn->no_channels ) ) { #ifdef PARAM_ISM_DTX_CNG - generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom, st->cng_paramISM_flag ); + generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom, st->cng_ism_flag ); #else generate_comfort_noise_dec_hf( realBuffer, imagBuffer, st->hFdCngDec->hFdCngCom ); #endif diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 39b09921e9..0e2cea8acb 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1086,7 +1086,7 @@ void generate_comfort_noise_dec( seed2 = &( hFdCngCom->seed2 ); #ifdef PARAM_ISM_DTX_CNG - if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT && st->idchan == 1 ) #endif @@ -1100,7 +1100,7 @@ void generate_comfort_noise_dec( if ( hFdCngCom->startBand == 0 ) { #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif @@ -1129,7 +1129,7 @@ void generate_comfort_noise_dec( { /* Real part in FFT bins */ #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif @@ -1147,7 +1147,7 @@ void generate_comfort_noise_dec( /* Imaginary part in FFT bins */ #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif @@ -1229,7 +1229,7 @@ void generate_comfort_noise_dec( { /* Real part in CLDFB band */ #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif @@ -1246,7 +1246,7 @@ void generate_comfort_noise_dec( /* Imaginary part in CLDFB band */ #ifdef PARAM_ISM_DTX_CNG - if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_paramISM_flag ) ) + if ( st->element_mode == IVAS_CPE_MDCT || ( st->element_mode == IVAS_SCE && st->cng_ism_flag ) ) #else if ( st->element_mode == IVAS_CPE_MDCT ) #endif diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 402fdc78f5..af8c938b0f 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -739,7 +739,7 @@ ivas_error init_decoder( st->cna_dirac_flag = 0; st->cng_sba_flag = 0; #ifdef PARAM_ISM_DTX_CNG - st->cng_paramISM_flag = 0; + st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ #endif diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index dbf7462e41..6dc9b9845d 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -80,12 +80,12 @@ static void ivas_ism_preprocessing( st->read_sid_info = 0; /* do not read the sid info from bitstream but use the estimated noise */ } - st->cng_paramISM_flag = 1; + st->cng_ism_flag = 1; } #ifndef DISCRETE_ISM_DTX_CNG else { - st->cng_paramISM_flag = 0; + st->cng_ism_flag = 0; } #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e9d5638763..fdd5f61e81 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -631,7 +631,7 @@ ivas_error ivas_ism_metadata_dec( #ifdef PARAM_ISM_DTX_CNG for ( ch = 0; ch < *nchan_transport; ch++ ) { - hSCE[ch]->hCoreCoder[0]->cng_paramISM_flag = 0; + hSCE[ch]->hCoreCoder[0]->cng_ism_flag = 0; } #endif diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 0950b529f6..65e4e362ef 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1346,7 +1346,7 @@ typedef struct Decoder_State MCT_CHAN_MODE mct_chan_mode; #ifdef PARAM_ISM_DTX_CNG - int16_t cng_paramISM_flag; /* CNG in Param-ISM flag */ + int16_t cng_ism_flag; /* CNG in Param-ISM flag */ int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ #endif -- GitLab From c9b5b081103dff63d1e72d312f355879a301635a Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Mar 2023 18:55:09 +0100 Subject: [PATCH 23/45] - accept UNIFY_MD_QUANTIZER - remove MD_Q_PARAM_BE, MD_SMOOTH_PARAM_BE, and DTX_PARAM_BE --- lib_com/ivas_cnst.h | 2 +- lib_com/ivas_ism_config.c | 90 ++-------------- lib_com/ivas_prot.h | 22 +--- lib_com/options.h | 10 +- lib_dec/ivas_ism_metadata_dec.c | 184 +++----------------------------- lib_dec/ivas_ism_param_dec.c | 5 - lib_enc/ivas_ism_dtx_enc.c | 14 +-- lib_enc/ivas_ism_enc.c | 12 --- lib_enc/ivas_ism_metadata_enc.c | 128 ++-------------------- lib_enc/ivas_ism_param_enc.c | 8 -- 10 files changed, 39 insertions(+), 436 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index f93872a707..905a01ef2b 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -340,7 +340,7 @@ typedef enum #else #define PARAM_ISM_DTX_COH_SCA_BITS 4 #endif -#if (defined DISCRETE_ISM_DTX_CNG && defined UNIFY_MD_QUANTIZER ) +#ifdef DISCRETE_ISM_DTX_CNG #define ISM_DTX_AZI_BITS_HIGH 8 #define ISM_DTX_ELE_BITS_HIGH 7 #define ISM_Q_STEP_HIGH (ISM_Q_STEP / 2) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 30d16a04f2..f762d4d88b 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -356,20 +356,17 @@ void ivas_ism_reset_metadata_API( /*! r: index of the winning codeword */ int16_t ism_quant_meta( - const float val, /* i : scalar value to quantize */ - float *valQ, /* o : quantized value */ - const float borders[], /* i : level borders */ -#ifdef UNIFY_MD_QUANTIZER + const float val, /* i : scalar value to quantize */ + float *valQ, /* o : quantized value */ + const float borders[], /* i : level borders */ const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ -#endif - const int16_t cbsize /* i : codebook size */ + const int16_t cbsize /* i : codebook size */ ) { int16_t idx, idx_start; float qlow, step; -#ifdef UNIFY_MD_QUANTIZER if ( val <= borders[1] ) { qlow = borders[0]; @@ -388,26 +385,6 @@ int16_t ism_quant_meta( idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); step = q_step_border; } -#else - if ( val <= borders[1] ) - { - qlow = borders[0]; - idx_start = 0; - step = ISM_Q_STEP_BORDER; - } - else if ( val <= borders[2] ) - { - qlow = borders[1]; - idx_start = (int16_t) ( ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP; - } - else - { - qlow = borders[2]; - idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP_BORDER; - } -#endif idx = idx_start + (int16_t) max( 0.f, min( cbsize - 1, ( ( val - qlow ) / step + 0.5f ) ) ); *valQ = ( idx - idx_start ) * step + qlow; @@ -424,19 +401,16 @@ int16_t ism_quant_meta( /*! r: dequantized value */ float ism_dequant_meta( - const int16_t idx, /* i : quantizer index */ - const float borders[], /* i : level borders */ -#ifdef UNIFY_MD_QUANTIZER + const int16_t idx, /* i : quantizer index */ + const float borders[], /* i : level borders */ const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ -#endif - const int16_t cbsize /* i : codebook size */ + const int16_t cbsize /* i : codebook size */ ) { int16_t idx_start; float qlow, step, valQ; -#ifdef UNIFY_MD_QUANTIZER if ( idx <= ( borders[1] - borders[0] ) / q_step_border ) { qlow = borders[0]; @@ -455,26 +429,6 @@ float ism_dequant_meta( idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); step = q_step_border; } -#else - if ( idx <= ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ) - { - qlow = borders[0]; - idx_start = 0; - step = ISM_Q_STEP_BORDER; - } - else if ( idx <= cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ) - { - qlow = borders[1]; - idx_start = (int16_t) ( ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP; - } - else - { - qlow = borders[2]; - idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / ISM_Q_STEP_BORDER ); - step = ISM_Q_STEP_BORDER; - } -#endif valQ = ( idx - idx_start ) * step + qlow; @@ -575,7 +529,6 @@ void update_last_metadata( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ -#ifdef UNIFY_MD_QUANTIZER void ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ @@ -604,33 +557,4 @@ void ivas_get_ism_sid_quan_bitbudget( return; } -#else -/*! r: low resolution flag */ -int16_t ivas_get_ism_sid_quan_bitbudget( - const int16_t num_obj, /* i : number of objects */ - int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ - int16_t *nBits_elevation, /* o : number of Q bits for elevation */ - int16_t *nBits_coh, /* o : number of Q bits for coherence */ - int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ -) -{ - int16_t low_res_q; - - low_res_q = 0; - *nBits_azimuth = ISM_AZIMUTH_NBITS; - *nBits_elevation = ISM_ELEVATION_NBITS; - *nBits_coh = ISM_DTX_COH_SCA_BITS; - *nBits_sce_id = 1; - - if ( num_obj >= 3 ) - { - low_res_q = 1; - *nBits_azimuth = PARAM_ISM_DTX_AZI_BITS; - *nBits_elevation = PARAM_ISM_DTX_ELE_BITS; - *nBits_sce_id = 2; - } - - return low_res_q; -} -#endif #endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index f8177afc39..abf5400b76 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -777,10 +777,8 @@ int16_t ism_quant_meta( const float val, /* i : scalar value to quantize */ float *valQ, /* o : quantized value */ const float borders[], /* i : level borders */ -#ifdef UNIFY_MD_QUANTIZER const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ -#endif const int16_t cbsize /* i : codebook size */ ); @@ -788,10 +786,8 @@ int16_t ism_quant_meta( float ism_dequant_meta( const int16_t idx, /* i : quantizer index */ const float borders[], /* i : level borders */ -#ifdef UNIFY_MD_QUANTIZER const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ -#endif const int16_t cbsize /* i : codebook size */ ); @@ -924,11 +920,7 @@ ivas_error ivas_ism_dtx_open( #ifdef DISCRETE_ISM_DTX_CNG /*! r: indication of DTX frame */ -#ifdef DTX_PARAM_BE -int16_t ivas_ism_dtx_enc_COMMON( -#else int16_t ivas_ism_dtx_enc( -#endif ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int16_t num_obj, /* i : number of objects */ @@ -938,8 +930,7 @@ int16_t ivas_ism_dtx_enc( int16_t md_diff_flag[], /* o : metadata differential flag */ int16_t *sid_flag /* o : indication of SID frame */ ); -#endif -#if ( !defined DISCRETE_ISM_DTX_CNG || defined DTX_PARAM_BE ) +#else /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ @@ -1018,7 +1009,6 @@ void update_last_metadata( const int16_t updt_flag[] /* i : last metadata update flag */ ); -#ifdef UNIFY_MD_QUANTIZER /*! r: low resolution flag */ void ivas_get_ism_sid_quan_bitbudget( const int16_t num_obj, /* i : number of objects */ @@ -1029,16 +1019,6 @@ void ivas_get_ism_sid_quan_bitbudget( int16_t *nBits_coh, /* o : number of Q bits for coherence */ int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ ); -#else -/*! r: low resolution flag */ -int16_t ivas_get_ism_sid_quan_bitbudget( - const int16_t num_obj, /* i : number of objects */ - int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ - int16_t *nBits_elevation, /* o : number of Q bits for elevation */ - int16_t *nBits_coh, /* o : number of Q bits for coherence */ - int16_t *nBits_sce_id /* o : number of Q bits for sce_id_dtx */ -); -#endif #endif #endif diff --git a/lib_com/options.h b/lib_com/options.h index fbb764cae6..de1517b668 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -58,7 +58,7 @@ #ifdef DEBUGGING -#define DEBUG_MODE_INFO /* output most important parameters to the subdirectory "res/" */ +/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */ #ifdef DEBUG_MODE_INFO /*#define DEBUG_MODE_ACELP*/ /* output most important ACELP core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ @@ -67,7 +67,7 @@ /*#define DEBUG_MODE_DIRAC*/ /* output most important DIRAC parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_MDCT*/ /* output most important MDCT parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_PARAM_MC */ /* output Parametric MC paramters to the subdirectory "res/" */ -#define DEBUG_MODE_PARAM_ISM /* output Parametric ISM paramters to the subdirectory "res/" */ +/*#define DEBUG_MODE_PARAM_ISM*/ /* output Parametric ISM paramters to the subdirectory "res/" */ /*#define DEBUG_MODE_INFO_TWEAK*/ /* enable command line switch to specify subdirectory for debug info output inside "./res/" */ /*#define DEBUG_MODE_INFO_PLC */ /* define to output PLC related parameters */ /*#define DEBUG_MODE_INFO_ALLRAD*/ /* define to output generated HOA decoding mtx */ @@ -160,15 +160,11 @@ #define SMOOTH_WITH_TRANS_DET #endif +#define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -/*#define MD_Q_PARAM_BE*/ -/*#define MD_SMOOTH_PARAM_BE*/ -/*#define DTX_PARAM_BE*/ -#define UNIFY_MD_QUANTIZER #define DISC_CNG -#define TUNE_360_OBJECT_WITH_NOISE // VA: issue 360: consider objects being speech+noise for active speech coding */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e9d5638763..9ba2254f4f 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -378,11 +378,7 @@ ivas_error ivas_ism_metadata_dec( } else /* ISM_MODE_DISC */ { -#ifdef UNIFY_MD_QUANTIZER hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); -#else - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); -#endif } /*----------------------------------------------------------------* @@ -444,11 +440,7 @@ ivas_error ivas_ism_metadata_dec( } else /* ISM_MODE_DISC */ { -#ifdef UNIFY_MD_QUANTIZER hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#endif } /*----------------------------------------------------------------* @@ -557,10 +549,7 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { -#ifdef MD_SMOOTH_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); } hISMDTX.ism_dtx_hangover_cnt = min( ( hISMDTX.ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); #endif @@ -686,70 +675,6 @@ ivas_error create_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG -#ifndef UNIFY_MD_QUANTIZER -/*-------------------------------------------------------------------* - * ivas_ism_dec_dequantize_DOA_dtx() - * - * - *-------------------------------------------------------------------*/ - -static void ivas_ism_dec_dequantize_DOA_dtx( - const int16_t azi_bits, - const int16_t ele_bits, - const int16_t azi_idx, - const int16_t ele_idx, - float *azi_val, - float *ele_val ) -{ - int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha, tmp_alpha; - - /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ - nbits = min( azi_bits, ele_bits ); - - if ( nbits == ISM_ELEVATION_NBITS ) - { - angle_spacing = 5; - } - else - { - angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); - } - - npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); - - /* sanity check */ - if ( angle_spacing == 360 ) - { - assert( azi_idx == 0 ); - assert( ele_idx == 0 ); - - *azi_val = 0.f; - *ele_val = 0.f; - return; - } - - /* Get the azimuth and elevation values */ - ele_alpha = 2 * npoints - 1; - assert( ( 0 <= ele_idx ) && ( ele_idx < ele_alpha ) ); - *ele_val = (float) ( ( ele_idx - npoints ) * angle_spacing ); - - az_alpha = 4 * npoints - 1; - assert( ( 0 <= azi_idx ) && ( azi_idx < az_alpha ) ); - tmp_alpha = (int16_t) ( azi_idx * ( 360.f / az_alpha ) ); - - if ( tmp_alpha > 180.0f ) - { - *azi_val = ( (float) tmp_alpha ) - 360.0f; - } - else - { - *azi_val = (float) tmp_alpha; - } - - return; -} -#endif - /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_dec() * @@ -769,12 +694,8 @@ ivas_error ivas_ism_metadata_sid_dec( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { -#ifdef UNIFY_MD_QUANTIZER int16_t i, ch, nb_bits_start, last_bit_pos; float q_step, q_step_border; -#else - int16_t i, ch, nb_bits_start, last_bit_pos, low_res_q; -#endif int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; int16_t md_diff_flag[MAX_NUM_OBJECTS]; @@ -786,10 +707,7 @@ ivas_error ivas_ism_metadata_sid_dec( if ( ism_total_brate == FRAME_NO_DATA ) { -#ifdef MD_SMOOTH_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); return IVAS_ERR_OK; } @@ -831,11 +749,7 @@ ivas_error ivas_ism_metadata_sid_dec( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ -#ifdef UNIFY_MD_QUANTIZER ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); -#else - low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); -#endif /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -897,85 +811,24 @@ ivas_error ivas_ism_metadata_sid_dec( if ( md_diff_flag[ch] == 1 ) { -#ifndef UNIFY_MD_QUANTIZER - if ( low_res_q ) - { - idx_azimuth = get_next_indice( st0, nBits_azimuth ); - idx_elevation = get_next_indice( st0, nBits_elevation ); + /* Azimuth decoding */ + idx_azimuth = get_next_indice( st0, nBits_azimuth ); + hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); - ivas_ism_dec_dequantize_DOA_dtx( nBits_azimuth, nBits_elevation, idx_azimuth, idx_elevation, &( hIsmMetaData->azimuth ), &( hIsmMetaData->elevation ) ); - } - else -#endif - { - /* Azimuth decoding */ - idx_azimuth = get_next_indice( st0, nBits_azimuth ); + /* Elevation decoding */ + idx_elevation = get_next_indice( st0, nBits_elevation ); + hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); -#ifndef UNIFY_MD_QUANTIZER - /* azimuth is on a circle - check for diff coding for -180° -> 180° and vice versa changes */ - if ( idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth -= ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* +180° -> -180° */ - } - else if ( idx_azimuth < 0 ) - { - idx_azimuth += ( 1 << ISM_AZIMUTH_NBITS ) - 1; /* -180° -> +180° */ - } - - /* +180° == -180° */ - if ( idx_azimuth == ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = 0; - } - - /* sanity check in case of FER or BER */ - if ( idx_azimuth < 0 || idx_azimuth > ( 1 << ISM_AZIMUTH_NBITS ) - 1 ) - { - idx_azimuth = hIsmMetaData->last_azimuth_idx; - } - - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); -#else - hIsmMetaData->azimuth = ism_dequant_meta( idx_azimuth, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); -#endif - - /* Elevation decoding */ - idx_elevation = get_next_indice( st0, nBits_elevation ); -#ifndef UNIFY_MD_QUANTIZER - - /* sanity check in case of FER or BER */ - if ( idx_elevation < 0 || idx_elevation > ( 1 << ISM_ELEVATION_NBITS ) - 1 ) - { - idx_elevation = hIsmMetaData->last_elevation_idx; - } - - /* Elevation dequantization */ - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#else - hIsmMetaData->elevation = ism_dequant_meta( idx_elevation, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); -#endif + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) + { + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); } - -#ifdef MD_Q_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif + else { -#ifdef UNIFY_MD_QUANTIZER - /* update last indexes to correspond to active frames coding */ - if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) - { - hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); - } - else - { - hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); - } -#else - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; -#endif + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); } /* save for smoothing metadata evolution */ @@ -993,10 +846,7 @@ ivas_error ivas_ism_metadata_sid_dec( } /* smooth the metadata evolution */ -#ifdef MD_SMOOTH_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index d08618e9cd..4c15a93a53 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -63,13 +63,8 @@ static void ivas_param_ism_dec_dequant_DOA( /* Get the azimuth and elevation values */ for ( i = 0; i < hParamIsm->num_obj; i++ ) { -#ifdef UNIFY_MD_QUANTIZER hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); - hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#endif } return; diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 353145fcd5..064754783d 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -104,11 +104,7 @@ ivas_error ivas_ism_dtx_open( *-------------------------------------------------------------------*/ /*! r: indication of DTX frame */ -#ifdef DTX_PARAM_BE -int16_t ivas_ism_dtx_enc_COMMON( -#else int16_t ivas_ism_dtx_enc( -#endif ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int16_t num_obj, /* i : number of objects */ @@ -123,9 +119,7 @@ int16_t ivas_ism_dtx_enc( int16_t nBits, nBits_MD_max; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; -#ifdef UNIFY_MD_QUANTIZER float tmp1, tmp2; -#endif #ifdef TUNE_360_OBJECT_WITH_NOISE for ( ch = 0; ch < nchan_transport; ch++ ) @@ -177,11 +171,7 @@ int16_t ivas_ism_dtx_enc( if ( dtx_flag ) { -#ifdef UNIFY_MD_QUANTIZER ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); -#else - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); -#endif nBits = 0; for ( ch = 0; ch < num_obj; ch++ ) @@ -294,9 +284,7 @@ int16_t ivas_ism_dtx_enc( return dtx_flag; } -#endif - -#if ( !defined DISCRETE_ISM_DTX_CNG || defined DTX_PARAM_BE ) +#else /*-------------------------------------------------------------------* * ivas_ism_dtx_enc() * diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index e3a8227a3f..3c6f4c1e5b 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -225,19 +225,7 @@ ivas_error ivas_ism_enc( /* analysis and decision about DTX */ #ifdef DISCRETE_ISM_DTX_CNG -#ifdef DTX_PARAM_BE - if ( st_ivas->ism_mode != ISM_MODE_PARAM ) - { - dtx_flag = ivas_ism_dtx_enc_COMMON( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); - } - else - { - dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); - } -#else dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#endif - #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 851ffc65c2..070f6ba7d0 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -220,13 +220,8 @@ ivas_error ivas_ism_metadata_enc( if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { /* send metadata even in inactive segments when noise is audible and metadata are changing */ -#ifdef UNIFY_MD_QUANTIZER diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ) ); diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ) ) ); -#else - diff = (int16_t) fabsf( hIsmMeta[ch]->azimuth - ism_dequant_meta( hIsmMeta[ch]->last_azimuth_idx, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ) ); - diff = max( diff, (int16_t) fabsf( hIsmMeta[ch]->elevation - ism_dequant_meta( hIsmMeta[ch]->last_elevation_idx, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ) ) ); -#endif if ( hSCE[ch]->hCoreCoder[0]->lp_noise > 15 && diff >= 10 ) { @@ -337,11 +332,7 @@ ivas_error ivas_ism_metadata_enc( /* Azimuth quantization (quantize azimuth to the AZIMUTH_NBITS-bit index */ if ( ism_mode == ISM_MODE_DISC ) { -#ifdef UNIFY_MD_QUANTIZER idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); -#else - idx_azimuth_abs = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); -#endif } else if ( ism_mode == ISM_MODE_PARAM ) { @@ -447,11 +438,7 @@ ivas_error ivas_ism_metadata_enc( /* Elevation quantization (quantize azimuth to the ELEVATION_NBITS-bit index */ if ( ism_mode == ISM_MODE_DISC ) { -#ifdef UNIFY_MD_QUANTIZER idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - idx_elevation_abs = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#endif } else /* ISM_MODE_PARAM */ { @@ -799,73 +786,6 @@ ivas_error create_ism_metadata_enc( #ifdef DISCRETE_ISM_DTX_CNG -#ifndef UNIFY_MD_QUANTIZER -/*-------------------------------------------------------------------* - * ivas_ism_quantize_DOA_dtx() - * - * - *-------------------------------------------------------------------*/ - -static void ivas_ism_quantize_DOA_dtx( - const float azimuth, - const float elevation, - const int16_t azi_bits, - const int16_t ele_bits, - int16_t *azi_idx, - int16_t *ele_idx ) -{ - int16_t nbits, npoints, angle_spacing, az_alpha, ele_alpha; - float azi_val; - - /* Step 1: Determine angle spacing/n_points based on minimum value among elevation/azimuth bits */ - nbits = min( azi_bits, ele_bits ); - - if ( nbits == ISM_ELEVATION_NBITS ) - { - angle_spacing = 5; - } - else - { - angle_spacing = (int16_t) ( ( 180.f / (float) ( 1 << nbits ) ) + 0.5f ); - } - - npoints = (int16_t) ( ( 90 / angle_spacing ) + 0.5f ); - - /* Step 2: Quantize Elevation */ - ele_alpha = 2 * npoints - 1; - *ele_idx = (int16_t) ( ( elevation / angle_spacing ) + 0.5f ) + npoints; - if ( *ele_idx >= ele_alpha ) - { - *ele_idx = ele_alpha - 1; - } - assert( ( 0 <= *ele_idx ) && ( *ele_idx < ele_alpha ) ); - - /* Step 3: Quantize Azimuth */ - az_alpha = 4 * npoints - 1; - - /* Convert azimuth in {-180,180} into {0,360} before quantization */ - if ( azimuth >= 0 ) - { - azi_val = azimuth; - } - else - { - azi_val = azimuth + 360.f; - } - - /* Obtain the index of quantized azimuth values */ - *azi_idx = (int16_t) ( ( ( azi_val / 360.f ) * az_alpha ) + 0.5f ); - if ( *azi_idx == az_alpha ) - { - /*wrap around the azimuth angle*/ - *azi_idx = 0; - } - assert( ( 0 <= *azi_idx ) && ( *azi_idx < az_alpha ) ); - - return; -} -#endif - /*-------------------------------------------------------------------* * ivas_ism_metadata_sid_enc() * @@ -885,12 +805,8 @@ void ivas_ism_metadata_sid_enc( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { -#ifdef UNIFY_MD_QUANTIZER int16_t i, ch, nBits, nBits_start, nBits_unused; float q_step, q_step_border; -#else - int16_t i, ch, nBits, nBits_start, nBits_unused, low_res_q; -#endif int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float valQ; @@ -923,11 +839,7 @@ void ivas_ism_metadata_sid_enc( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ -#ifdef UNIFY_MD_QUANTIZER ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); -#else - low_res_q = ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &nBits_coh, &nBits_sce_id ); -#endif /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -982,44 +894,22 @@ void ivas_ism_metadata_sid_enc( { hIsmMetaData = hIsmMeta[ch]; -#ifdef UNIFY_MD_QUANTIZER idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, q_step, q_step_border, 1 << nBits_azimuth ); idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, q_step, q_step_border, 1 << nBits_elevation ); -#else - if ( low_res_q ) - { - ivas_ism_quantize_DOA_dtx( hIsmMetaData->azimuth, hIsmMetaData->elevation, nBits_azimuth, nBits_elevation, &idx_azimuth, &idx_elevation ); - } - else - { - idx_azimuth = ism_quant_meta( hIsmMetaData->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); - idx_elevation = ism_quant_meta( hIsmMetaData->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); - } -#endif push_indice( hBstr, IND_ISM_AZIMUTH, idx_azimuth, nBits_azimuth ); push_indice( hBstr, IND_ISM_ELEVATION, idx_elevation, nBits_elevation ); -#ifdef MD_Q_PARAM_BE - if ( ism_mode != ISM_MODE_PARAM ) -#endif + /* update last indexes to correspond to active frames coding */ + if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef UNIFY_MD_QUANTIZER - /* update last indexes to correspond to active frames coding */ - if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) - { - hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); - hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); - } - else - { - hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); - hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); - } -#else - hIsmMetaData->last_azimuth_idx = idx_azimuth; - hIsmMetaData->last_elevation_idx = idx_elevation; -#endif + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); + } + else + { + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); } } } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index be8c8135bd..6a950f7046 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -162,18 +162,10 @@ static void ivas_param_ism_enc_quantize_DOA( for ( i = 0; i < num_obj; i++ ) { /* Quantize the elevation and obtain quantized elevation value and index */ -#ifdef UNIFY_MD_QUANTIZER ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); -#else - ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, 1 << ISM_ELEVATION_NBITS ); -#endif /* Obtain the index of quantized azimuth values */ -#ifdef UNIFY_MD_QUANTIZER azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); -#else - azi_idx = ism_quant_meta( hIsmMetaData[i]->azimuth, &valQ, ism_azimuth_borders, 1 << ISM_AZIMUTH_NBITS ); -#endif /*Replace azimuth with quantized values */ hIsmMetaData[i]->azimuth = valQ; -- GitLab From 41d3661c95739a625fc31061011d55c222b0b05a Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 6 Mar 2023 19:04:17 +0100 Subject: [PATCH 24/45] resolve comments --- lib_dec/ivas_sce_dec.c | 2 +- lib_enc/ivas_ism_dtx_enc.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index afa7bbac3e..4e9afe9a82 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -84,7 +84,7 @@ ivas_error ivas_sce_dec( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) #endif { - st->cng_type = FD_CNG; /* TODO: move to init if possible */ + st->cng_type = FD_CNG; } #endif diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 064754783d..55c8edd835 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -149,9 +149,9 @@ int16_t ivas_ism_dtx_enc( lp_noise_variation = var( lp_noise, num_obj ); lp_noise_mean = mean( lp_noise, num_obj ); - if ( lp_noise_mean > 50 || ( lp_noise_mean > 10 && lp_noise_variation > 2 ) ) + if ( lp_noise_mean > 50 || ( lp_noise_mean > 25 && lp_noise_variation > 32 ) ) { - // dtx_flag = 0; // VE!!!!! + dtx_flag = 0; } /*------------------------------------------------------------------* -- GitLab From 1e32cf7b88f691fa82cfde38e0d3bed496f299d9 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Tue, 7 Mar 2023 16:26:16 +0100 Subject: [PATCH 25/45] Merge DISC_CNG into DISCRETE_ISM_DTX_CNG. --- lib_com/ivas_prot.h | 2 +- lib_com/options.h | 1 - lib_dec/ivas_core_dec.c | 2 +- lib_dec/ivas_sce_dec.c | 2 +- lib_dec/ivas_tcx_core_dec.c | 4 ++-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index abf5400b76..05d8c65021 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -508,7 +508,7 @@ void stereo_tcx_core_dec( #ifdef PARAM_ISM_DTX_CNG , const IVAS_FORMAT ivas_format /* i : IVAS format */ -#ifndef DISC_CNG +#ifndef DISCRETE_ISM_DTX_CNG ,const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ #endif #endif diff --git a/lib_com/options.h b/lib_com/options.h index 5ae1b00642..cf48509f6a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -168,7 +168,6 @@ #define TUNE_360_OBJECT_WITH_NOISE /* VA: issue 360: consider objects being speech+noise for active speech coding */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define DISC_CNG diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index 258be15b02..cb2244504f 100755 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -347,7 +347,7 @@ ivas_error ivas_core_dec( /* TCX decoder */ #ifdef PARAM_ISM_DTX_CNG stereo_tcx_core_dec( st, frameMode[n], output[n], synth[n], pitch_buf[n], sba_dirac_stereo_flag, hStereoTD, last_element_mode, flag_sec_CNA, hCPE == NULL ? NULL : hCPE->hStereoCng, nchan_out, st_ivas == NULL ? 0 : st_ivas->ivas_format -#ifndef DISC_CNG +#ifndef DISCRETE_ISM_DTX_CNG , st_ivas == NULL ? 0 : st_ivas->ism_mode #endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 4e9afe9a82..02601d1ba1 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -78,7 +78,7 @@ ivas_error ivas_sce_dec( last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate; #ifdef PARAM_ISM_DTX_CNG -#ifdef DISC_CNG +#ifdef DISCRETE_ISM_DTX_CNG if ( st_ivas->ivas_format == ISM_FORMAT ) #else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index e91c910781..e2c2229a21 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -164,7 +164,7 @@ void stereo_tcx_core_dec( #ifdef PARAM_ISM_DTX_CNG , const IVAS_FORMAT ivas_format /* i : IVAS format */ -#ifndef DISC_CNG +#ifndef DISCRETE_ISM_DTX_CNG , const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ #endif @@ -733,7 +733,7 @@ void stereo_tcx_core_dec( if ( st->element_mode != IVAS_CPE_TD ) { #ifdef PARAM_ISM_DTX_CNG -#ifndef DISC_CNG +#ifndef DISCRETE_ISM_DTX_CNG if ( ivas_format == ISM_FORMAT && ism_mode == ISM_MODE_PARAM ) #else if ( ivas_format == ISM_FORMAT ) -- GitLab From 79ec90400233721adfc202e858e4820685681d97 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 8 Mar 2023 14:54:28 +0100 Subject: [PATCH 26/45] fix crash at highest DTX bitrates --- lib_enc/ivas_ism_enc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 3c6f4c1e5b..ae55f4879c 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -417,6 +417,7 @@ ivas_error ivas_ism_enc( { st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_core = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->last_core; st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_core_brate = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->core_brate; + st_ivas->hSCE[sce_id]->hCoreCoder[0]->last_L_frame = st_ivas->hSCE[st_ivas->hISMDTX->sce_id_dtx]->hCoreCoder[0]->last_L_frame; } } } -- GitLab From 7f797b83dc8e2185955d585bff871c344764778d Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 11:57:57 +0100 Subject: [PATCH 27/45] limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats; under FIX_DTX_BRATE_LIMIT --- lib_com/ivas_prot.h | 3 +++ lib_com/options.h | 2 +- lib_enc/ivas_ism_dtx_enc.c | 25 +++++++++++++++++++++++-- lib_enc/ivas_ism_enc.c | 4 ++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 05d8c65021..e3fcf0696d 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -923,6 +923,9 @@ ivas_error ivas_ism_dtx_open( int16_t ivas_ism_dtx_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ +#ifdef FIX_DTX_BRATE_LIMIT + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ +#endif const int16_t num_obj, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ diff --git a/lib_com/options.h b/lib_com/options.h index 4f1a1d42ba..fdfd92f70a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -170,7 +170,7 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ - +#define FIX_DTX_BRATE_LIMIT /* VA: limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 0dc1cce8a8..93c45d6eea 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -105,8 +105,11 @@ ivas_error ivas_ism_dtx_open( /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ +#ifdef FIX_DTX_BRATE_LIMIT + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ +#endif const int16_t num_obj, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ @@ -119,6 +122,9 @@ int16_t ivas_ism_dtx_enc( int16_t nBits, nBits_MD_max; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; +#ifdef FIX_DTX_BRATE_LIMIT + float lp_noise_max; +#endif float tmp1, tmp2; /* initialization */ @@ -153,6 +159,21 @@ int16_t ivas_ism_dtx_enc( dtx_flag = 0; } + +#ifdef FIX_DTX_BRATE_LIMIT + /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ + maximum( lp_noise, num_obj, &lp_noise_max ); + + if ( !( ( num_obj == 1 && ivas_total_brate <= IVAS_24k4 ) || + ( num_obj == 2 && ivas_total_brate <= IVAS_48k ) || + ( num_obj == 3 && ivas_total_brate <= IVAS_80k ) || + ( num_obj == 4 && ivas_total_brate <= IVAS_96k ) || + lp_noise_max < 15 ) ) + { + dtx_flag = 0; + } +#endif + /*------------------------------------------------------------------* * Reset the bitstream *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index ae55f4879c..f51db8ceb6 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -225,7 +225,11 @@ ivas_error ivas_ism_enc( /* analysis and decision about DTX */ #ifdef DISCRETE_ISM_DTX_CNG +#ifdef FIX_DTX_BRATE_LIMIT + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); +#else dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); +#endif #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); #endif -- GitLab From b6de7037e3977b01a16324ca3718ac9dbc1d7e91 Mon Sep 17 00:00:00 2001 From: Andrea Eichenseer Date: Thu, 9 Mar 2023 18:17:24 +0100 Subject: [PATCH 28/45] Force ACELP noise estimation to run for first 100 frames to avoid all-zero CNG. Switch FORCE_EST, affects ISM modes. --- lib_com/options.h | 3 +++ lib_dec/fd_cng_dec.c | 12 ++++++++++++ lib_dec/init_dec.c | 3 +++ lib_dec/ivas_sce_dec.c | 6 ++++++ lib_dec/stat_dec.h | 3 +++ 5 files changed, 27 insertions(+) diff --git a/lib_com/options.h b/lib_com/options.h index fdfd92f70a..e72b0eb958 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,6 +171,9 @@ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define FIX_DTX_BRATE_LIMIT /* VA: limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats */ +#ifdef DISCRETE_ISM_DTX_CNG +#define FORCE_EST /* FhG: force ACELP noise estimation in ISM mode for first 100 frames to prevent all-zero CNG */ +#endif /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index a715618f11..de51d3e522 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -413,6 +413,7 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ +#ifndef FORCE_EST if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && @@ -422,6 +423,17 @@ void ApplyFdCng( !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) +#else + if ( concealWholeFrame == 0 && + ( timeDomainInput == NULL || + ( *timeDomainInput( -FLT_MAX ) && + *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && + *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && + ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_mode ) ) && + !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || + ( st->element_mode == IVAS_CPE_TD ) ) && + ( !st->BER_detect ) ) +#endif { /* Perform noise estimation at the decoder */ perform_noise_estimation_dec( timeDomainInput, powerSpectrum, hFdCngDec, st->element_mode, st->bwidth, L_frame, last_L_frame, st->last_core_brate, st->VAD ); diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index af8c938b0f..523d505acd 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -742,6 +742,9 @@ ivas_error init_decoder( st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ #endif +#ifdef FORCE_EST + st->is_ism_mode = 0; +#endif return error; diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 02601d1ba1..805c83e6e8 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -374,6 +374,12 @@ ivas_error create_sce_dec( { return error; } +#ifdef FORCE_EST + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + st->is_ism_mode = 1; + } +#endif if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) { diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 65e4e362ef..7c6972b7f5 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1349,6 +1349,9 @@ typedef struct Decoder_State int16_t cng_ism_flag; /* CNG in Param-ISM flag */ int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ #endif +#ifdef FORCE_EST + int16_t is_ism_mode; /* Indicator if codec operates in ISM mode */ +#endif } Decoder_State, *DEC_CORE_HANDLE; -- GitLab From e9b0928220c987d570c36e9fc5f2844ceee49bd0 Mon Sep 17 00:00:00 2001 From: vaclav Date: Thu, 9 Mar 2023 22:42:18 +0100 Subject: [PATCH 29/45] fix parameters declarations as reported by Ericsson --- lib_dec/ivas_ism_dtx_dec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 6dc9b9845d..1e7323ff70 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -109,7 +109,8 @@ ivas_error ivas_ism_dtx_dec( #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; int16_t flag_noisy_speech, sce_id_dtx; - ISM_MODE last_ism_mode; + ISM_MODE last_ism_mode, ism_mode_bstr; + int16_t idx; #endif ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; @@ -161,9 +162,8 @@ ivas_error ivas_ism_dtx_dec( { pos -= num_obj; /* SID metadata flags */ - short idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); - - ISM_MODE ism_mode_bstr = (ISM_MODE) ( idx + 1 ); + idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); + ism_mode_bstr = (ISM_MODE) ( idx + 1 ); st_ivas->ism_mode = ism_mode_bstr; } -- GitLab From ab2dd41ffc8468bba120efe90317fb5597f1d6d1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 10 Mar 2023 10:49:42 +0100 Subject: [PATCH 30/45] avoid allocation of TD-CNG handle at the encoder --- lib_enc/init_enc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 683356c6c0..2dda2b4a78 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -467,7 +467,11 @@ ivas_error init_encoder( *-----------------------------------------------------------------*/ #ifdef PARAM_ISM_DTX_CNG +#ifdef DISCRETE_ISM_DTX_CNG + if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) && !( ism_mode == ISM_MODE_PARAM || ism_mode == ISM_MODE_DISC ) ) +#else if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) && !( ism_mode == ISM_MODE_PARAM ) ) +#endif #else if ( ( ( idchan == 0 && st->Opt_DTX_ON && st->element_mode != IVAS_CPE_MDCT ) || st->element_mode == EVS_MONO ) ) #endif -- GitLab From 5925dc7100cd0dd56ce35885f8eb06011298d64d Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 11:00:15 +0100 Subject: [PATCH 31/45] make 'nchan_ism' parameter part of st_ivas/hEncoderConfig; under NCHAN_ISM_PARAMETER --- lib_com/ivas_ism_config.c | 45 ++++++++++------ lib_com/ivas_prot.h | 35 +++++++++---- lib_com/ivas_stat_com.h | 2 + lib_com/options.h | 1 + lib_dec/ivas_dec.c | 13 +++++ lib_dec/ivas_init_dec.c | 20 +++++--- lib_dec/ivas_ism_dec.c | 53 +++++++++++++++++-- lib_dec/ivas_ism_dtx_dec.c | 45 ++++++++++------ lib_dec/ivas_ism_metadata_dec.c | 68 ++++++++++++++---------- lib_dec/ivas_ism_param_dec.c | 67 ++++++++++++++++++++++++ lib_dec/ivas_ism_renderer.c | 12 +++-- lib_dec/ivas_sba_rendering_internal.c | 4 +- lib_dec/ivas_stat_dec.h | 3 ++ lib_enc/ivas_ism_dtx_enc.c | 22 ++++---- lib_enc/ivas_ism_enc.c | 32 ++++++++---- lib_enc/ivas_ism_metadata_enc.c | 59 ++++++++++++--------- lib_enc/ivas_ism_param_enc.c | 74 +++++++++++++++++++++++++++ lib_enc/ivas_stat_enc.h | 3 ++ lib_enc/lib_enc.c | 6 +++ 19 files changed, 433 insertions(+), 131 deletions(-) diff --git a/lib_com/ivas_ism_config.c b/lib_com/ivas_ism_config.c index 15c1d32da3..e8ffa3b228 100644 --- a/lib_com/ivas_ism_config.c +++ b/lib_com/ivas_ism_config.c @@ -87,15 +87,15 @@ static void bitbudget_to_brate( *-------------------------------------------------------------------*/ ivas_error ivas_ism_config( - const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t num_obj, /* i : number of objects */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ - const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ - const int16_t ism_imp[], /* i : ISM importance flags */ - int32_t element_brate[], /* o : element bitrate per object */ - int32_t total_brate[], /* o : total bitrate per object */ - int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ + const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ + const int16_t ism_imp[], /* i : ISM importance flags */ + int32_t element_brate[], /* o : element bitrate per object */ + int32_t total_brate[], /* o : total bitrate per object */ + int16_t nb_bits_metadata[] /* i/o: number of metadata bits */ ) { int16_t ch; @@ -137,7 +137,7 @@ ivas_error ivas_ism_config( nb_bits_metadata[0] += ISM_EXTENDED_METADATA_BITS; } #endif - nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + num_obj; + nb_bits_metadata[0] += n_ISms * ISM_METADATA_FLAG_BITS + nchan_ism; for ( ch = 0; ch < n_ISms; ch++ ) { @@ -453,12 +453,23 @@ float ism_dequant_meta( * ---------------------------------------------------------------*/ void ivas_param_ism_config( - PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ ) + PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ +#ifdef NCHAN_ISM_PARAMETER + , + const int16_t nchan_obj /* i : number of ISM channels */ +#endif +) { +#ifdef NCHAN_ISM_PARAMETER + int16_t i; + + hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; +#else int16_t i, num_obj; hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; num_obj = hParamIsm->num_obj; +#endif for ( i = 0; i < hParamIsm->nbands; i++ ) { @@ -466,7 +477,11 @@ void ivas_param_ism_config( } /* for elevation zero compute the max azi quantization indices */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_obj; i++ ) +#else for ( i = 0; i < num_obj; i++ ) +#endif { hParamIsm->last_az_diff[i] = 0; hParamIsm->last_az_sgn[i] = 1; @@ -513,14 +528,14 @@ ISM_MODE ivas_ism_mode_select( *-------------------------------------------------------------------*/ void update_last_metadata( - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t updt_flag[] /* i : last metadata update flag */ ) { int16_t ch; - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { if ( updt_flag[ch] == 1 ) { @@ -540,7 +555,7 @@ void update_last_metadata( *----------------------------------------------------------------*/ void ivas_get_ism_sid_quan_bitbudget( - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ int16_t *nBits_elevation, /* o : number of Q bits for elevation */ float *q_step, /* o : quantization step */ @@ -556,7 +571,7 @@ void ivas_get_ism_sid_quan_bitbudget( *nBits_coh = ISM_DTX_COH_SCA_BITS; *nBits_sce_id = 1; - if ( num_obj >= 3 ) + if ( nchan_ism >= 3 ) { *nBits_azimuth = ISM_DTX_AZI_BITS_LOW; *nBits_elevation = ISM_DTX_ELE_BITS_LOW; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 43b5140a3c..266efebdd9 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -747,8 +747,8 @@ void dtx_read_padding_bits( ivas_error ivas_ism_config( const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t num_trans_ch, /* i : number of trans channels */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ const int16_t ism_imp[], /* i : ISM importance flags */ @@ -818,6 +818,9 @@ ivas_error ivas_ism_enc( ivas_error ivas_ism_metadata_enc( const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -835,6 +838,9 @@ ivas_error ivas_ism_metadata_enc( ivas_error ivas_ism_metadata_dec( const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif int16_t *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ @@ -881,6 +887,10 @@ void ivas_param_ism_stereo_dmx( void ivas_param_ism_config( PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: IVAS Param ISM Config Structure */ +#ifdef NCHAN_ISM_PARAMETER + , + const int16_t nchan_ism /* i : number of ISM channels */ +#endif ); ivas_error ivas_ism_enc_config( @@ -888,11 +898,14 @@ ivas_error ivas_ism_enc_config( ); ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifdef DISCRETE_ISM_DTX_CNG - const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ + , + const ISM_MODE last_ism_mode /* i/o: last ISM mode */ +#endif +#ifndef NCHAN_ISM_PARAMETER + ,const int16_t num_obj /* i : number of objects in the bitstream */ #endif - const int16_t num_obj /* i : number of objects in the bitstream */ ); ivas_error ivas_param_ism_dec_open( @@ -930,7 +943,7 @@ int16_t ivas_ism_dtx_enc( #ifdef FIX_DTX_BRATE_LIMIT const int32_t ivas_total_brate, /* i : IVAS total bitrate */ #endif - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -954,7 +967,7 @@ ivas_error ivas_ism_dtx_dec( void ivas_ism_metadata_sid_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ const int16_t flag_noisy_speech, /* i : noisy speech flag */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ const ISM_MODE ism_mode, /* i : ISM mode */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -977,7 +990,7 @@ void ivas_ism_metadata_sid_dec( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int32_t ism_total_brate, /* i : ISms total bitrate */ const int16_t bfi, /* i : bfi flag */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ const ISM_MODE ism_mode, /* i : ISM mode */ int16_t *flag_noisy_speech, /* o : noisy speech flag */ @@ -1011,13 +1024,13 @@ void ivas_ism_coh_estim_dtx_enc( #ifdef DISCRETE_ISM_DTX_CNG void update_last_metadata( - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t updt_flag[] /* i : last metadata update flag */ ); void ivas_get_ism_sid_quan_bitbudget( - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ int16_t *nBits_azimuth, /* o : number of Q bits for azimuth */ int16_t *nBits_elevation, /* o : number of Q bits for elevation */ float *q_step, /* o : quantization step */ @@ -4709,7 +4722,7 @@ void ivas_ism2sba( float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ - const int16_t num_objects, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order /* i : SBA order */ ); diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index 6a17263696..197927b084 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -155,7 +155,9 @@ typedef struct ivas_param_ism_data_structure int16_t nbands; int16_t nblocks[MAX_PARAM_ISM_NBANDS]; int16_t band_grouping[MAX_PARAM_ISM_NBANDS + 1]; +#ifndef NCHAN_ISM_PARAMETER int16_t num_obj; +#endif int16_t azi_index[MAX_NUM_OBJECTS]; int16_t ele_index[MAX_NUM_OBJECTS]; diff --git a/lib_com/options.h b/lib_com/options.h index d61448db6d..d9eec46fce 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -161,6 +161,7 @@ #ifdef DISCRETE_ISM_DTX_CNG #define FORCE_EST /* FhG: force ACELP noise estimation in ISM mode for first 100 frames to prevent all-zero CNG */ #endif +#define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ /* ################## End DEVELOPMENT switches ######################### */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index a0d31a58c9..ce74c66c39 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -149,8 +149,13 @@ ivas_error ivas_dec( } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { + // VE: call ivas_ism_metadata_dec() with 'st_ivas' - TBD #ifdef DISCRETE_ISM_DTX_CNG +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -161,7 +166,11 @@ ivas_error ivas_dec( else /* ISM_MODE_DISC */ { #ifdef DISCRETE_ISM_DTX_CNG +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, st_ivas->nchan_ism, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_metadata_dec( ivas_total_brate, &( st_ivas->nchan_transport ), st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->bfi, nb_bits_metadata, st_ivas->ism_mode, st_ivas->hISMDTX, NULL ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -220,7 +229,11 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ +#ifdef NCHAN_ISM_PARAMETER + ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_ism, output_frame, st_ivas->hIntSetup.ambisonics_order ); +#else ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_transport, output_frame, st_ivas->hIntSetup.ambisonics_order ); +#endif } /* Binaural rendering */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 3d249949ee..cec550028d 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -66,7 +66,7 @@ ivas_error ivas_dec_setup( ) { int16_t k, idx, num_bits_read; - int16_t num_obj, element_mode_flag; + int16_t nchan_ism, element_mode_flag; Decoder_State *st; int32_t ivas_total_brate; ivas_error error; @@ -102,21 +102,29 @@ ivas_error ivas_dec_setup( { /* read the number of objects */ st_ivas->nchan_transport = 1; - num_obj = 1; + nchan_ism = 1; k = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 ); - while ( st_ivas->bit_stream[k] && num_obj < MAX_NUM_OBJECTS ) + while ( st_ivas->bit_stream[k] && nchan_ism < MAX_NUM_OBJECTS ) { - num_obj++; + nchan_ism++; k--; } +#ifdef NCHAN_ISM_PARAMETER + st_ivas->nchan_ism = nchan_ism; +#endif + #ifdef DISCRETE_ISM_DTX_CNG - if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, num_obj ) ) != IVAS_ERR_OK ) +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nchan_ism ) ) != IVAS_ERR_OK ) +#endif { return error; } #else - ivas_ism_dec_config( st_ivas, num_obj ); + ivas_ism_dec_config( st_ivas, nchan_ism ); #endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 79d7e72f8d..e73cde5d54 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -49,8 +49,11 @@ static ivas_error ivas_ism_bitrate_switching( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ - const ISM_MODE last_ism_mode, /* i : last ISM mode */ - const int16_t num_obj /* i : number of objects in the bitstream */ + const ISM_MODE last_ism_mode /* i : last ISM mode */ +#ifndef NCHAN_ISM_PARAMETER + , + const int16_t num_obj /* i : number of objects in the bitstream */ +#endif ) { ivas_error error; @@ -62,7 +65,11 @@ static ivas_error ivas_ism_bitrate_switching( nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, num_obj, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -242,11 +249,15 @@ static ivas_error ivas_ism_bitrate_switching( /*! r : ISM format mode */ ivas_error ivas_ism_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ #ifdef DISCRETE_ISM_DTX_CNG - const ISM_MODE last_ism_mode, /* i/o: last ISM mode */ + , + const ISM_MODE last_ism_mode /* i/o: last ISM mode */ #endif +#ifndef NCHAN_ISM_PARAMETER + , const int16_t num_obj /* i : number of objects in the bitstream */ +#endif ) { int32_t ivas_total_brate; @@ -266,7 +277,11 @@ ivas_error ivas_ism_dec_config( #endif /* Assumes that num of input objects are constant */ +#ifdef NCHAN_ISM_PARAMETER + nchan_transport_old = st_ivas->nchan_ism; +#else nchan_transport_old = num_obj; +#endif if ( last_ism_mode == ISM_MODE_PARAM ) { @@ -276,15 +291,25 @@ ivas_error ivas_ism_dec_config( if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA ) { /* select ISM format mode */ +#ifdef NCHAN_ISM_PARAMETER + st_ivas->ism_mode = ivas_ism_mode_select( st_ivas->nchan_ism, ivas_total_brate ); + + st_ivas->nchan_transport = st_ivas->nchan_ism; +#else st_ivas->ism_mode = ivas_ism_mode_select( num_obj, ivas_total_brate ); st_ivas->nchan_transport = num_obj; +#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = 2; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism; +#else st_ivas->hDecoderConfig->nchan_out = num_obj; +#endif } } @@ -297,7 +322,11 @@ ivas_error ivas_ism_dec_config( { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -308,20 +337,32 @@ ivas_error ivas_ism_dec_config( else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { #ifdef DISCRETE_ISM_DTX_CNG +#ifdef NCHAN_ISM_PARAMETER + st_ivas->nchan_transport = st_ivas->nchan_ism; +#else st_ivas->nchan_transport = num_obj; +#endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { st_ivas->nchan_transport = 2; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hDecoderConfig->nchan_out = st_ivas->nchan_ism; +#else st_ivas->hDecoderConfig->nchan_out = num_obj; +#endif } } /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, num_obj ) ) != IVAS_ERR_OK ) +#endif { return error; } @@ -338,7 +379,11 @@ ivas_error ivas_ism_dec_config( #endif } +#ifdef NCHAN_ISM_PARAMETER + switch ( st_ivas->nchan_ism ) +#else switch ( num_obj ) +#endif { case 1: st_ivas->transport_config = AUDIO_CONFIG_ISM1; diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 8e022feae1..cb4d1752d2 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -103,7 +103,7 @@ ivas_error ivas_ism_dtx_dec( int16_t *nb_bits_metadata /* o : number of metadata bits */ ) { - int16_t ch, pos, num_obj, num_obj_prev; + int16_t ch, pos, nchan_ism, nchan_ism_prev; int32_t ivas_total_brate; #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; @@ -123,31 +123,38 @@ ivas_error ivas_ism_dtx_dec( } #endif +#ifdef NCHAN_ISM_PARAMETER + nchan_ism_prev = st_ivas->nchan_ism; +#else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - num_obj_prev = st_ivas->hDirAC->hParamIsm->num_obj; + nchan_ism_prev = st_ivas->hDirAC->hParamIsm->num_obj; } else /* ism_mode == ISM_MODE_DISC */ { - num_obj_prev = st_ivas->nchan_transport; + nchan_ism_prev = st_ivas->nchan_transport; } +#endif if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { /* read number of objects */ - num_obj = 1; + nchan_ism = 1; pos = (int16_t) ( ( ivas_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); - while ( get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) + while ( get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ) == 1 && nchan_ism < MAX_NUM_OBJECTS ) { - ( num_obj )++; + ( nchan_ism )++; pos--; } +#ifdef NCHAN_ISM_PARAMETER + st_ivas->nchan_ism = nchan_ism; +#endif #ifdef DISCRETE_ISM_DTX_CNG pos--; #endif - if ( num_obj != num_obj_prev ) + if ( nchan_ism != nchan_ism_prev ) { /* IVAS_fmToDo: more work needed when the number of transported objects is not constant */ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "wrong number of objects signalled!" ); @@ -157,40 +164,44 @@ ivas_error ivas_ism_dtx_dec( last_ism_mode = st_ivas->ism_mode; /* read ism_mode */ - if ( num_obj > 2 ) + if ( nchan_ism > 2 ) { - pos -= num_obj; /* SID metadata flags */ + pos -= nchan_ism; /* SID metadata flags */ idx = get_indice( st_ivas->hSCE[0]->hCoreCoder[0], pos, 1 ); ism_mode_bstr = (ISM_MODE) ( idx + 1 ); st_ivas->ism_mode = ism_mode_bstr; } - if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, num_obj ) ) != IVAS_ERR_OK ) +#ifdef NCHAN_ISM_PARAMETER + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK ) +#else + if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, nchan_ism ) ) != IVAS_ERR_OK ) +#endif { return error; } #else - ivas_ism_dec_config( st_ivas, num_obj ); + ivas_ism_dec_config( st_ivas, nchan_ism ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->hDirAC->hParamIsm->num_obj = num_obj; + st_ivas->hDirAC->hParamIsm->num_obj = nchan_ism; } else /* ism_mode == ISM_MODE_DISC */ { - st_ivas->nchan_transport = num_obj; + st_ivas->nchan_transport = nchan_ism; } #endif } else { - num_obj = num_obj_prev; + nchan_ism = nchan_ism_prev; } /* Metadata decoding and dequantization */ #ifdef DISCRETE_ISM_DTX_CNG - ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, + ivas_ism_metadata_sid_dec( st_ivas->hSCE, ivas_total_brate, st_ivas->bfi, nchan_ism, st_ivas->nchan_transport, st_ivas->ism_mode, &flag_noisy_speech, &sce_id_dtx, st_ivas->hIsmMetaData, nb_bits_metadata ); if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) @@ -207,11 +218,11 @@ ivas_error ivas_ism_dtx_dec( #endif #ifdef DISCRETE_ISM_DTX_CNG - set_s( md_diff_flag, 1, num_obj ); + set_s( md_diff_flag, 1, nchan_ism ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { st_ivas->hDirAC->azimuth_values[ch] = st_ivas->hIsmMetaData[ch]->azimuth; st_ivas->hDirAC->elevation_values[ch] = st_ivas->hIsmMetaData[ch]->elevation; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index ed7338a63e..e636cecc1b 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -74,14 +74,14 @@ int16_t decode_radius( DEC_CORE_HANDLE st0, int16_t *last_radius_idx, int16_t *f static void ism_metadata_smooth( ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int32_t ism_total_brate, /* i : ISms total bitrate */ - const int16_t num_obj /* i : number of objects */ + const int16_t nchan_ism /* i : number of objects */ ) { ISM_METADATA_HANDLE hIsmMetaData; int16_t ch; float diff; - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; @@ -141,7 +141,10 @@ static void ism_metadata_smooth( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif int16_t *nchan_transport, /* o : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_DEC_HANDLE hSCE[], /* i/o: SCE decoder handles */ @@ -178,7 +181,11 @@ ivas_error ivas_ism_metadata_dec( int16_t nchan_transport_prev, ism_metadata_flag_global; int16_t localVAD[MAX_NUM_OBJECTS]; int16_t ism_imp[MAX_NUM_OBJECTS]; - int16_t num_obj = 0, nbands, nblocks; +#ifdef NCHAN_ISM_PARAMETER + int16_t nbands, nblocks; +#else + int16_t nchan_ism = 0, nbands, nblocks; +#endif #ifdef DISCRETE_ISM_DTX_CNG int16_t md_diff_flag[MAX_NUM_OBJECTS]; #endif @@ -238,22 +245,31 @@ ivas_error ivas_ism_metadata_dec( * Read ISm common signaling *----------------------------------------------------------------*/ +#ifdef NCHAN_ISM_PARAMETER + /* number of objects was read in ivas_dec_setup() */ + st0->next_bit_pos += nchan_ism; +#else /* read number of objects */ - num_obj = 1; - while ( get_next_indice( st0, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) + nchan_ism = 1; + while ( get_next_indice( st0, 1 ) == 1 && nchan_ism < MAX_NUM_OBJECTS ) { - ( num_obj )++; + ( nchan_ism )++; } +#endif - ism_mode = ivas_ism_mode_select( num_obj, ism_total_brate ); + ism_mode = ivas_ism_mode_select( nchan_ism, ism_total_brate ); if ( ism_mode == ISM_MODE_PARAM ) { - hParamIsm->num_obj = num_obj; +#ifdef NCHAN_ISM_PARAMETER + *nchan_transport = MAX_PARAM_ISM_WAVE; +#else + hParamIsm->num_obj = nchan_ism; +#endif } else if ( ism_mode == ISM_MODE_DISC ) { - *nchan_transport = num_obj; + *nchan_transport = nchan_ism; } if ( *nchan_transport != nchan_transport_prev ) @@ -284,7 +300,7 @@ ivas_error ivas_ism_metadata_dec( ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } - for ( ; ch < num_obj; ch++ ) + for ( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->ism_metadata_flag = 1; ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; @@ -317,7 +333,7 @@ ivas_error ivas_ism_metadata_dec( nb_bits_start = st0->next_bit_pos; } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; if ( ism_mode == ISM_MODE_DISC ) @@ -587,7 +603,7 @@ ivas_error ivas_ism_metadata_dec( { hIsmMeta[ch]->ism_metadata_flag = hIsmMeta[ch]->last_ism_metadata_flag; } - for ( ; ch < num_obj; ch++ ) + for ( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -596,7 +612,7 @@ ivas_error ivas_ism_metadata_dec( if ( ism_mode == ISM_MODE_PARAM ) { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] + hParamIsm->last_az_sgn[ch] * hParamIsm->last_az_diff[ch]; /*hParamIsm->azi_index[ch] = hParamIsm->azi_index[ch] % hParamIsm->az_alpha[ch];*/ @@ -618,7 +634,7 @@ ivas_error ivas_ism_metadata_dec( #ifdef DISCRETE_ISM_DTX_CNG if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); } hISMDTX.ism_dtx_hangover_cnt = min( ( hISMDTX.ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); #endif @@ -629,7 +645,7 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { - if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; } @@ -651,7 +667,7 @@ ivas_error ivas_ism_metadata_dec( hSCE[ch]->hCoreCoder[0]->total_brate = total_brate[ch]; } - for ( ; ch < num_obj; ch++ ) + for ( ; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -685,7 +701,7 @@ ivas_error ivas_ism_metadata_dec( * Updates *----------------------------------------------------------------*/ - set_s( md_diff_flag, 1, num_obj ); + set_s( md_diff_flag, 1, nchan_ism ); update_last_metadata( *nchan_transport, hIsmMeta, md_diff_flag ); #endif @@ -976,7 +992,7 @@ void ivas_ism_metadata_sid_dec( SCE_DEC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ const int32_t ism_total_brate, /* i : ISms total bitrate */ const int16_t bfi, /* i : bfi flag */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels*/ const ISM_MODE ism_mode, /* i : ISM mode */ int16_t *flag_noisy_speech, /* o : noisy speech flag */ @@ -998,7 +1014,7 @@ void ivas_ism_metadata_sid_dec( if ( ism_total_brate == FRAME_NO_DATA ) { - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); return; } @@ -1028,10 +1044,10 @@ void ivas_ism_metadata_sid_dec( /* number of objects was already read in ivas_ism_get_dtx_dec() */ /* update the position in the bitstream */ - st0->next_bit_pos += num_obj; + st0->next_bit_pos += nchan_ism; /* read SID metadata flag( one per object ) */ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { md_diff_flag[ch] = get_next_indice( st0, 1 ); } @@ -1040,7 +1056,7 @@ void ivas_ism_metadata_sid_dec( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 @@ -1050,7 +1066,7 @@ void ivas_ism_metadata_sid_dec( *sce_id_dtx = 0; /* write ISM mode flag to explicitly signal number of spatial parameters */ - if ( num_obj > 2 ) + if ( nchan_ism > 2 ) { idx = get_next_indice( st0, 1 ); ism_mode_bstr = (ISM_MODE) ( idx + 1 ); @@ -1096,7 +1112,7 @@ void ivas_ism_metadata_sid_dec( * Metadata decoding and dequantization, loop over all objects *----------------------------------------------------------------*/ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; @@ -1137,7 +1153,7 @@ void ivas_ism_metadata_sid_dec( } /* smooth the metadata evolution */ - ism_metadata_smooth( hIsmMeta, ism_total_brate, num_obj ); + ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); return; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 693249b699..f772e31b4a 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -51,6 +51,10 @@ static void ivas_param_ism_dec_dequant_DOA( DIRAC_DEC_HANDLE hDirAC /* i/o: decoder DirAC handle */ +#ifdef NCHAN_ISM_PARAMETER + , + const int16_t nchan_ism /* i : number of ISM channels */ +#endif ) { int16_t i; @@ -58,10 +62,18 @@ static void ivas_param_ism_dec_dequant_DOA( hParamIsm = hDirAC->hParamIsm; +#ifdef NCHAN_ISM_PARAMETER + assert( nchan_ism <= MAX_NUM_OBJECTS ); +#else assert( hParamIsm->num_obj <= MAX_NUM_OBJECTS ); +#endif /* Get the azimuth and elevation values */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < hParamIsm->num_obj; i++ ) +#endif { hDirAC->azimuth_values[i] = ism_dequant_meta( hParamIsm->azi_index[i], ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); hDirAC->elevation_values[i] = ism_dequant_meta( hParamIsm->ele_index[i], ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); @@ -157,6 +169,9 @@ static void ivas_ism_get_proto_matrix( static void ivas_param_ism_compute_mixing_matrix( +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ ISM_DTX_DATA_DEC hISMDTX, /* i : ISM DTX handle */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], @@ -183,12 +198,20 @@ static void ivas_param_ism_compute_mixing_matrix( proto_matrix = hDirAC->hParamIsmRendering->proto_matrix; +#ifdef NCHAN_ISM_PARAMETER + assert( ( nchan_ism == 3 ) || ( nchan_ism == 4 ) ); +#else assert( ( hDirAC->hParamIsm->num_obj == 3 ) || ( hDirAC->hParamIsm->num_obj == 4 ) ); +#endif assert( nchan_transport == 2 ); if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { +#ifdef NCHAN_ISM_PARAMETER + num_wave = nchan_ism; +#else num_wave = hDirAC->hParamIsm->num_obj; +#endif } else { @@ -249,7 +272,11 @@ static void ivas_param_ism_compute_mixing_matrix( { if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) { +#ifdef NCHAN_ISM_PARAMETER + direct_power[w] = ( 1.0f / nchan_ism ) * ref_power; +#else direct_power[w] = ( 1.0f / hDirAC->hParamIsm->num_obj ) * ref_power; +#endif } else { @@ -426,6 +453,9 @@ ivas_error ivas_param_ism_dec_open( output_config = st_ivas->hDecoderConfig->output_config; nchan_out = st_ivas->hDecoderConfig->nchan_out; +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->nchan_ism ); +#else if ( output_config == AUDIO_CONFIG_EXTERNAL ) { hDirAC->hParamIsm->num_obj = nchan_out; @@ -435,6 +465,7 @@ ivas_error ivas_param_ism_dec_open( hDirAC->hParamIsm->num_obj = MAX_NUM_OBJECTS; } ivas_param_ism_config( hDirAC->hParamIsm ); +#endif /*-----------------------------------------------------------------* * set input parameters @@ -466,7 +497,11 @@ ivas_error ivas_param_ism_dec_open( if ( output_config == AUDIO_CONFIG_EXTERNAL ) { /* nchan_out is essential for memory initialization for CLDFB Synthesis */ +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hIntSetup.nchan_out_woLFE = st_ivas->nchan_ism; +#else st_ivas->hIntSetup.nchan_out_woLFE = hDirAC->hParamIsm->num_obj; +#endif st_ivas->hIntSetup.is_loudspeaker_setup = 1; } @@ -828,7 +863,11 @@ void ivas_param_ism_dec( nchan_transport = st_ivas->nchan_transport; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { +#ifdef NCHAN_ISM_PARAMETER + nchan_out = st_ivas->nchan_ism; +#else nchan_out = st_ivas->hDirAC->hParamIsm->num_obj; +#endif nchan_out_woLFE = nchan_out; st_ivas->hDecoderConfig->nchan_out = nchan_out; } @@ -848,7 +887,11 @@ void ivas_param_ism_dec( /* De-quantization */ if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); +#else ivas_param_ism_dec_dequant_DOA( hDirAC ); +#endif ivas_param_ism_dec_dequant_powrat( hDirAC ); st_ivas->hISMDTX.dtx_flag = 0; } @@ -860,7 +903,11 @@ void ivas_param_ism_dec( /* obtain the direct response using EFAP */ if ( !( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) ) { +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < st_ivas->nchan_ism; i++ ) +#else for ( i = 0; i < hDirAC->hParamIsm->num_obj; i++ ) +#endif { efap_determine_gains( st_ivas->hEFAPdata, direct_response[i], hDirAC->azimuth_values[i], hDirAC->elevation_values[i], EFAP_MODE_EFAP ); } @@ -869,7 +916,11 @@ void ivas_param_ism_dec( { int16_t j; +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < st_ivas->nchan_ism; i++ ) +#else for ( i = 0; i < hDirAC->hParamIsm->num_obj; i++ ) +#endif { for ( j = 0; j < nchan_out_woLFE; j++ ) { @@ -918,7 +969,11 @@ void ivas_param_ism_dec( } /* Compute mixing matrix */ +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); +#else ivas_param_ism_compute_mixing_matrix( hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); +#endif /* subframe loop for synthesis*/ for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) @@ -987,7 +1042,11 @@ void ivas_param_ism_dec( ivas_param_ism_update_mixing_matrix( hDirAC, mixing_matrix, nchan_transport, nchan_out_woLFE ); /* store MetaData parameters */ +#ifdef NCHAN_ISM_PARAMETER + for ( ch = 0; ch < st_ivas->nchan_ism; ch++ ) +#else for ( ch = 0; ch < hDirAC->hParamIsm->num_obj; ch++ ) +#endif { if ( st_ivas->hDirAC->azimuth_values[ch] > 180.0f ) { @@ -1033,7 +1092,11 @@ void ivas_param_ism_params_to_masa_param_mapping( if ( !( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) ) { +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_dec_dequant_DOA( hDirAC, st_ivas->nchan_ism ); +#else ivas_param_ism_dec_dequant_DOA( hDirAC ); +#endif ivas_param_ism_dec_dequant_powrat( hDirAC ); st_ivas->hISMDTX.dtx_flag = 0; } @@ -1042,7 +1105,11 @@ void ivas_param_ism_params_to_masa_param_mapping( st_ivas->hISMDTX.dtx_flag = 1; } +#ifdef NCHAN_ISM_PARAMETER + if ( st_ivas->nchan_ism > 1 ) +#else if ( hDirAC->hParamIsm->num_obj > 1 ) +#endif { if ( st_ivas->hISMDTX.dtx_flag ) { diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index a965a0ffed..a5bdcc4100 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -107,11 +107,15 @@ void ivas_ism_render( float tmp_output_f[MAX_OUTPUT_CHANNELS][L_FRAME48k]; float gains[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS]; float g1, g2; - int16_t num_objects, nchan_out_woLFE, lfe_index; + int16_t nchan_ism, nchan_out_woLFE, lfe_index; int16_t azimuth, elevation; float Rmat[3][3]; - num_objects = st_ivas->nchan_transport; +#ifdef NCHAN_ISM_PARAMETER + nchan_ism = st_ivas->nchan_ism; +#else + nchan_ism = st_ivas->nchan_transport; +#endif nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE; lfe_index = 0; @@ -121,7 +125,7 @@ void ivas_ism_render( set_f( tmp_output_f[j], 0.0f, output_frame ); } - for ( i = 0; i < num_objects; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { mvr2r( output_f[i], input_f[i], output_frame ); } @@ -137,7 +141,7 @@ void ivas_ism_render( QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], Rmat ); } - for ( i = 0; i < num_objects; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { if ( st_ivas->intern_config == AUDIO_CONFIG_STEREO ) { diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index bd799f9d5f..a80986b39e 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -282,7 +282,7 @@ void ivas_ism2sba( float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ - const int16_t num_objects, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order /* i : Ambisonic (SBA) order */ ) @@ -304,7 +304,7 @@ void ivas_ism2sba( set_zero( buffer_tmp[j], output_frame ); } - for ( i = 0; i < num_objects; i++ ) + for ( i = 0; i < nchan_ism; i++ ) { // TODO tmu review when #215 is resolved azimuth = (int16_t) floorf( hIsmMetaData[i]->azimuth + 0.5f ); diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 9b8cf1b2df..720fd1c9e4 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1214,6 +1214,9 @@ typedef struct Decoder_Struct LFE_DEC_HANDLE hLFE; /* LFE handle */ ISM_MODE ism_mode; /* ISM format mode */ +#ifdef NCHAN_ISM_PARAMETER + int16_t nchan_ism; /* number of ISM channels */ +#endif SBA_MODE sba_mode; /* SBA format mode */ MC_MODE mc_mode; /* MC format mode */ int16_t sba_order; /* Ambisonic (SBA) order */ diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index f7633c8a9e..23c592ea91 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -109,7 +109,7 @@ int16_t ivas_ism_dtx_enc( #ifdef FIX_DTX_BRATE_LIMIT const int32_t ivas_total_brate, /* i : IVAS total bitrate */ #endif - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -150,8 +150,8 @@ int16_t ivas_ism_dtx_enc( lp_noise[ch] = hSCE[ch]->hCoreCoder[0]->lp_noise; } - lp_noise_variation = var( lp_noise, num_obj ); - lp_noise_mean = mean( lp_noise, num_obj ); + lp_noise_variation = var( lp_noise, nchan_ism ); + lp_noise_mean = mean( lp_noise, nchan_ism ); if ( lp_noise_mean > 50 || ( lp_noise_mean > 25 && lp_noise_variation > 32 ) ) { @@ -161,12 +161,12 @@ int16_t ivas_ism_dtx_enc( #ifdef FIX_DTX_BRATE_LIMIT /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ - maximum( lp_noise, num_obj, &lp_noise_max ); + maximum( lp_noise, nchan_ism, &lp_noise_max ); - if ( !( ( num_obj == 1 && ivas_total_brate <= IVAS_24k4 ) || - ( num_obj == 2 && ivas_total_brate <= IVAS_48k ) || - ( num_obj == 3 && ivas_total_brate <= IVAS_80k ) || - ( num_obj == 4 && ivas_total_brate <= IVAS_96k ) || + if ( !( ( nchan_ism == 1 && ivas_total_brate <= IVAS_24k4 ) || + ( nchan_ism == 2 && ivas_total_brate <= IVAS_48k ) || + ( nchan_ism == 3 && ivas_total_brate <= IVAS_80k ) || + ( nchan_ism == 4 && ivas_total_brate <= IVAS_96k ) || lp_noise_max < 15 ) ) { dtx_flag = 0; @@ -190,10 +190,10 @@ int16_t ivas_ism_dtx_enc( if ( dtx_flag ) { - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &tmp1, &tmp2, &nBits_coh, &nBits_sce_id ); nBits = 0; - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { /* check difference between current and last metadata */ md_diff_flag[ch] = 0; @@ -230,7 +230,7 @@ int16_t ivas_ism_dtx_enc( nBits_MD_max -= nBits_coh; /* coherence */ } - if ( num_obj > 3 ) + if ( nchan_ism > 3 ) { nBits_MD_max--; /* ism_mode flag */ } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 6c68b300ec..fa5e6115f1 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -86,7 +86,7 @@ ivas_error ivas_ism_enc( float lf_E[1][2 * VOIC_BINS]; /* per bin spectrum energy in lf */ int16_t localVAD_HE_SAD[1]; /* local HE VAD */ #ifdef DISCRETE_ISM_DTX_CNG - int16_t num_obj, dtx_flag, sid_flag, flag_noisy_speech; + int16_t nchan_ism, dtx_flag, sid_flag, flag_noisy_speech; int16_t md_diff_flag[MAX_NUM_OBJECTS]; #else int16_t dtx_flag, sid_flag, flag_noisy_speech; @@ -107,16 +107,19 @@ ivas_error ivas_ism_enc( flag_noisy_speech = 0; #ifdef DISCRETE_ISM_DTX_CNG +#ifdef NCHAN_ISM_PARAMETER + nchan_ism = st_ivas->hEncoderConfig->nchan_ism; +#else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - num_obj = st_ivas->hDirAC->hParamIsm->num_obj; + nchan_ism = st_ivas->hDirAC->hParamIsm->num_obj; } else /* ism_mode == ISM_MODE_DISC */ { - num_obj = st_ivas->nchan_transport; + nchan_ism = st_ivas->nchan_transport; } - - set_s( md_diff_flag, 1, num_obj ); +#endif + set_s( md_diff_flag, 1, nchan_ism ); #endif /*------------------------------------------------------------------* @@ -211,9 +214,9 @@ ivas_error ivas_ism_enc( /* analysis and decision about DTX */ #ifdef DISCRETE_ISM_DTX_CNG #ifdef FIX_DTX_BRATE_LIMIT - dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); #else - dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, num_obj, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); + dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); #endif #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); @@ -250,7 +253,7 @@ ivas_error ivas_ism_enc( if ( dtx_flag ) { #ifdef DISCRETE_ISM_DTX_CNG - ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, num_obj, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); + ivas_ism_metadata_sid_enc( st_ivas->hISMDTX, flag_noisy_speech, nchan_ism, st_ivas->nchan_transport, st_ivas->ism_mode, st_ivas->hIsmMetaData, sid_flag, md_diff_flag, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata ); #else if ( sid_flag ) { @@ -260,8 +263,13 @@ ivas_error ivas_ism_enc( } else if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { + // VE: call ivas_ism_metadata_enc() with 'st_ivas' - TBD #ifdef TD5 - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hEncoderConfig->nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); #endif @@ -269,7 +277,11 @@ ivas_error ivas_ism_enc( else /* ISM_MODE_DISC */ { #ifdef TD5 - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hEncoderConfig->nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 664e2270f4..e8beca67b5 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -172,7 +172,10 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISms total bitrate */ + const int32_t ism_total_brate, /* i : ISms total bitrate */ +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif const int16_t nchan_transport, /* i : number of transport channels */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ SCE_ENC_HANDLE hSCE[], /* i/o: SCE encoder handles */ @@ -208,28 +211,34 @@ ivas_error ivas_ism_metadata_enc( int32_t element_brate[MAX_NUM_OBJECTS], total_brate[MAX_NUM_OBJECTS]; int16_t ism_metadata_flag_global; int16_t ism_imp[MAX_NUM_OBJECTS]; - int16_t num_obj, nbands, nblocks; +#ifdef NCHAN_ISM_PARAMETER + int16_t nbands, nblocks; +#else + int16_t nchan_ism, nbands, nblocks; +#endif ivas_error error; error = IVAS_ERR_OK; push_wmops( "ism_meta_enc" ); +#ifndef NCHAN_ISM_PARAMETER if ( ism_mode == ISM_MODE_PARAM ) { - num_obj = hParamIsm->num_obj; + nchan_ism = hParamIsm->num_obj; } else if ( ism_mode == ISM_MODE_DISC ) { - num_obj = nchan_transport; + nchan_ism = nchan_transport; } else { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); } +#endif #ifndef DISCRETE_ISM_DTX_CNG - if ( num_obj == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ism_mode == ISM_MODE_DISC ) + if ( nchan_ism == 1 && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) && ism_mode == ISM_MODE_DISC ) { /* no metadata encoding in CNG */ pop_wmops(); @@ -241,11 +250,11 @@ ivas_error ivas_ism_metadata_enc( /* initialization */ ism_metadata_flag_global = 0; set_s( nb_bits_metadata, 0, nchan_transport ); - set_s( flag_abs_azimuth, 0, num_obj ); - set_s( flag_abs_elevation, 0, num_obj ); + set_s( flag_abs_azimuth, 0, nchan_ism ); + set_s( flag_abs_elevation, 0, nchan_ism ); #ifdef TD5 - set_s( flag_abs_azimuth_orientation, 0, num_obj ); - set_s( flag_abs_radius, 0, num_obj ); + set_s( flag_abs_azimuth_orientation, 0, nchan_ism ); + set_s( flag_abs_radius, 0, nchan_ism ); #endif @@ -253,7 +262,7 @@ ivas_error ivas_ism_metadata_enc( * Set Metadata presence / importance flag *----------------------------------------------------------------*/ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { if ( ism_mode == ISM_MODE_PARAM ) { @@ -329,13 +338,13 @@ ivas_error ivas_ism_metadata_enc( #ifndef TUNE_360_OBJECT_WITH_NOISE /* relax the importance decision in "stereo" coding for noisy audio */ - if ( ism_mode == ISM_MODE_DISC && num_obj == 2 ) + if ( ism_mode == ISM_MODE_DISC && nchan_ism == 2 ) { float diff_F; if ( hIsmMeta[0]->ism_metadata_flag ^ hIsmMeta[1]->ism_metadata_flag ) { - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { diff_F = hSCE[ch]->hCoreCoder[0]->lp_speech - hSCE[ch]->hCoreCoder[0]->lp_noise; @@ -354,7 +363,7 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ /* write number of objects - unary coding */ - for ( ch = 1; ch < num_obj; ch++ ) + for ( ch = 1; ch < nchan_ism; ch++ ) { push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); } @@ -371,7 +380,7 @@ ivas_error ivas_ism_metadata_enc( push_indice( hBstr, IND_ISM_METADATA_FLAG, ism_imp[ch], ISM_METADATA_FLAG_BITS ); } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { ism_metadata_flag_global |= hIsmMeta[ch]->ism_metadata_flag; } @@ -403,7 +412,7 @@ ivas_error ivas_ism_metadata_enc( nb_bits_start = hBstr->nb_bits_tot; } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMetaData = hIsmMeta[ch]; if ( ism_mode == ISM_MODE_DISC ) @@ -700,7 +709,7 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ i = 0; - while ( i == 0 || i < num_obj / INTER_OBJECT_PARAM_CHECK ) + while ( i == 0 || i < nchan_ism / INTER_OBJECT_PARAM_CHECK ) { int16_t num, abs_num, abs_first, abs_next, pos_zero; #ifdef TD5 @@ -709,7 +718,7 @@ ivas_error ivas_ism_metadata_enc( int16_t abs_matrice[INTER_OBJECT_PARAM_CHECK * 2]; #endif - num = min( INTER_OBJECT_PARAM_CHECK, num_obj - i * INTER_OBJECT_PARAM_CHECK ); + num = min( INTER_OBJECT_PARAM_CHECK, nchan_ism - i * INTER_OBJECT_PARAM_CHECK ); i++; set_s( abs_matrice, 0, INTER_OBJECT_PARAM_CHECK * ISM_NUM_PARAM ); @@ -831,12 +840,12 @@ ivas_error ivas_ism_metadata_enc( * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ - if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, num_obj, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) + if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) { return error; } - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; } @@ -1292,7 +1301,7 @@ static void encode_angle_indices( void ivas_ism_metadata_sid_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ const int16_t flag_noisy_speech, /* i : noisy speech flag */ - const int16_t num_obj, /* i : number of objects */ + const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ const ISM_MODE ism_mode, /* i : ISM mode */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ @@ -1320,14 +1329,14 @@ void ivas_ism_metadata_sid_enc( *----------------------------------------------------------------*/ /* write number of objects - unary coding */ - for ( ch = 1; ch < num_obj; ch++ ) + for ( ch = 1; ch < nchan_ism; ch++ ) { push_indice( hBstr, IND_ISM_NUM_OBJECTS, 1, 1 ); } push_indice( hBstr, IND_ISM_NUM_OBJECTS, 0, 1 ); /* write SID metadata flag (one per object) */ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { push_indice( hBstr, IND_ISM_METADATA_FLAG, md_diff_flag[ch], 1 ); } @@ -1336,14 +1345,14 @@ void ivas_ism_metadata_sid_enc( * Set quantization bits based on the number of coded objects *----------------------------------------------------------------*/ - ivas_get_ism_sid_quan_bitbudget( num_obj, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); + ivas_get_ism_sid_quan_bitbudget( nchan_ism, &nBits_azimuth, &nBits_elevation, &q_step, &q_step_border, &nBits_coh, &nBits_sce_id ); /*----------------------------------------------------------------* * Spatial parameters, loop over TCs - 1 *----------------------------------------------------------------*/ /* write ISM mode flag to explicitly signal number of spatial parameters */ - if ( num_obj > 2 ) + if ( nchan_ism > 2 ) { if ( ism_mode == ISM_MODE_DISC ) { @@ -1385,7 +1394,7 @@ void ivas_ism_metadata_sid_enc( * Metadata quantization and coding, loop over all objects *----------------------------------------------------------------*/ - for ( ch = 0; ch < num_obj; ch++ ) + for ( ch = 0; ch < nchan_ism; ch++ ) { if ( md_diff_flag[ch] == 1 ) { diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index f76646fdca..16f234b839 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -47,16 +47,27 @@ static void ivas_param_ism_compute_obj_parameters( +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif float reference_power_obj[MAX_NUM_OBJECTS][PARAM_ISM_MDFT_NO_SLOTS][DIRAC_NO_FB_BANDS_MAX], /* i : Reference power */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: Param ISM Enc Handle */ ) { +#ifdef NCHAN_ISM_PARAMETER + int16_t i, b, m, br, mr; +#else int16_t i, b, m, br, mr, num_obj; +#endif int16_t brange_start, brange_end, mrange_start, mrange_end, time_merge_fac; float power_ratios_m[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS]; +#ifdef NCHAN_ISM_PARAMETER + assert( nchan_ism == 3 || nchan_ism == 4 ); +#else num_obj = hParamIsm->num_obj; assert( num_obj == 3 || num_obj == 4 ); +#endif for ( b = 0; b < hParamIsm->nbands; b++ ) { @@ -81,7 +92,11 @@ static void ivas_param_ism_compute_obj_parameters( /* for each object, sum up reference power within current T/F tile */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < num_obj; i++ ) +#endif { for ( mr = mrange_start; mr < mrange_end; mr++ ) { @@ -103,7 +118,12 @@ static void ivas_param_ism_compute_obj_parameters( index_1 = 1; index_2 = 0; } + +#ifdef NCHAN_ISM_PARAMETER + for ( i = 2; i < nchan_ism; i++ ) +#else for ( i = 2; i < num_obj; i++ ) +#endif { if ( ref_power_local[i] > ref_power_local[index_1] ) { @@ -149,17 +169,30 @@ static void ivas_param_ism_compute_obj_parameters( static void ivas_param_ism_enc_quantize_DOA( +#ifdef NCHAN_ISM_PARAMETER + const int16_t nchan_ism, /* i : number of ISM channels */ +#endif ISM_METADATA_HANDLE hIsmMetaData[MAX_NUM_OBJECTS], /* i : ISM metadata */ PARAM_ISM_CONFIG_HANDLE hParamIsm /* i/o: Param ISM encoder handle */ ) { +#ifdef NCHAN_ISM_PARAMETER + int16_t i, azi_idx, ele_idx; +#else int16_t i, azi_idx, ele_idx, num_obj; +#endif float valQ; +#ifndef NCHAN_ISM_PARAMETER num_obj = hParamIsm->num_obj; +#endif /* Loop over objects */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < num_obj; i++ ) +#endif { /* Quantize the elevation and obtain quantized elevation value and index */ ele_idx = ism_quant_meta( hIsmMetaData[i]->elevation, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); @@ -191,7 +224,11 @@ void ivas_param_ism_stereo_dmx( const int16_t input_frame /* i : Length of input frame */ ) { +#ifdef NCHAN_ISM_PARAMETER + int16_t i, j; +#else int16_t i, j, num_obj; +#endif float alpha, azi_shift, tmp, tmp_1; float cardioid_left[MAX_NUM_OBJECTS], cardioid_right[MAX_NUM_OBJECTS]; float stereo_dmx[2][L_FRAME48k]; @@ -202,14 +239,20 @@ void ivas_param_ism_stereo_dmx( /*Initialization*/ alpha = 0.5; azi_shift = 0; +#ifndef NCHAN_ISM_PARAMETER num_obj = st_ivas->hDirAC->hParamIsm->num_obj; +#endif /* Set the stereo dmx to zero */ set_zero( stereo_dmx[0], L_FRAME48k ); set_zero( stereo_dmx[1], L_FRAME48k ); /* Loop over all objects */ +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < st_ivas->hEncoderConfig->nchan_ism; i++ ) +#else for ( i = 0; i < num_obj; i++ ) +#endif { hIsmMetaData = st_ivas->hIsmMetaData[i]; @@ -271,8 +314,10 @@ ivas_error ivas_param_ism_enc_open( input_Fs = st_ivas->hEncoderConfig->input_Fs; +#ifndef NCHAN_ISM_PARAMETER /* Assign the number of objects */ hDirAC->hParamIsm->num_obj = st_ivas->hEncoderConfig->nchan_inp; +#endif /* set FB config. */ if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, SBA_MODE_NONE, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs ) ) != IVAS_ERR_OK ) @@ -286,7 +331,11 @@ ivas_error ivas_param_ism_enc_open( return error; } +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->hEncoderConfig->nchan_inp ); +#else ivas_param_ism_config( hDirAC->hParamIsm ); +#endif /* Assign memories for Band and Block grouping */ hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -347,6 +396,9 @@ void ivas_param_ism_enc( ) { int16_t i, j, ts, l_ts; +#ifdef NCHAN_ISM_PARAMETER + int16_t nchan_ism; +#endif int16_t num_time_slots; float *pcm_in[MAX_NUM_OBJECTS]; float fb_RealBuffer[MAX_NUM_OBJECTS][DIRAC_NO_FB_BANDS_MAX]; @@ -357,6 +409,9 @@ void ivas_param_ism_enc( DIRAC_ENC_HANDLE hDirAC; PARAM_ISM_CONFIG_HANDLE hParamIsm; +#ifdef NCHAN_ISM_PARAMETER + nchan_ism = st_ivas->hEncoderConfig->nchan_ism; +#endif hDirAC = st_ivas->hDirAC; hParamIsm = hDirAC->hParamIsm; @@ -365,7 +420,11 @@ void ivas_param_ism_enc( l_ts = input_frame / PARAM_ISM_MDFT_NO_SLOTS; num_time_slots = PARAM_ISM_MDFT_NO_SLOTS; +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < hParamIsm->num_obj; i++ ) +#endif { pcm_in[i] = &data[i][0]; @@ -374,12 +433,18 @@ void ivas_param_ism_enc( p_fb_RealBuffer[i] = &fb_RealBuffer[i][0]; p_fb_ImagBuffer[i] = &fb_ImagBuffer[i][0]; } + for ( ts = 0; ts < num_time_slots; ts++ ) { ivas_fb_mixer_get_windowed_fr( hDirAC->hFbMixer, pcm_in, p_fb_RealBuffer, p_fb_ImagBuffer, l_ts, l_ts ); + ivas_fb_mixer_update_prior_input( hDirAC->hFbMixer, pcm_in, l_ts ); +#ifdef NCHAN_ISM_PARAMETER + for ( i = 0; i < nchan_ism; i++ ) +#else for ( i = 0; i < hParamIsm->num_obj; i++ ) +#endif { pcm_in[i] += l_ts; for ( j = 0; j < DIRAC_NO_FB_BANDS_MAX; j++ ) @@ -388,11 +453,20 @@ void ivas_param_ism_enc( } } } + /* Quantize DOAs */ +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_enc_quantize_DOA( nchan_ism, st_ivas->hIsmMetaData, hParamIsm ); +#else ivas_param_ism_enc_quantize_DOA( st_ivas->hIsmMetaData, hParamIsm ); +#endif /* Compute object indices and power ratios */ +#ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_compute_obj_parameters( nchan_ism, reference_power_obj, hParamIsm ); +#else ivas_param_ism_compute_obj_parameters( reference_power_obj, hParamIsm ); +#endif pop_wmops(); return; diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index fc7c0b76a6..e81c967ad9 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1014,6 +1014,9 @@ typedef struct encoder_config_structure int16_t element_mode_init; /* element mode used at initialization */ int16_t stereo_dmx_evs; /* flag to indicate that stereo downmix for EVS encoder */ +#ifdef NCHAN_ISM_PARAMETER + int16_t nchan_ism; /* number of ISM channels */ +#endif int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ MC_LS_SETUP mc_input_setup; /* multichannel input ls setup */ diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index fbb87cf056..b249f85317 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -391,6 +391,9 @@ ivas_error IVAS_ENC_ConfigureForObjects( st_ivas->hEncoderConfig->ivas_format = ISM_FORMAT; st_ivas->hEncoderConfig->element_mode_init = IVAS_SCE; st_ivas->hEncoderConfig->nchan_inp = numObjects; +#ifdef NCHAN_ISM_PARAMETER + st_ivas->hEncoderConfig->nchan_ism = numObjects; +#endif #ifdef TD5 st_ivas->hEncoderConfig->ism_extended_metadata_flag = ism_extended_metadata; #endif @@ -2280,6 +2283,9 @@ static void init_encoder_config( hEncoderConfig->var_SID_rate_flag = 1; hEncoderConfig->mc_input_setup = MC_LS_SETUP_INVALID; hEncoderConfig->stereo_dmx_evs = 0; +#ifdef NCHAN_ISM_PARAMETER + hEncoderConfig->nchan_ism = 0; +#endif hEncoderConfig->sba_order = 0; hEncoderConfig->sba_planar = 0; #ifdef DEBUGGING -- GitLab From 47c0ea208b3c596a6866f15a2f16b016c5bd26e8 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 11:48:30 +0100 Subject: [PATCH 32/45] - rename parameter under FORCE_EST - replace constant 2 by MAX_PARAM_ISM_WAVE --- lib_dec/fd_cng_dec.c | 2 +- lib_dec/init_dec.c | 2 +- lib_dec/ivas_init_dec.c | 8 ++++++-- lib_dec/ivas_ism_dec.c | 4 ++-- lib_dec/ivas_sce_dec.c | 6 ------ lib_dec/stat_dec.h | 6 +++--- lib_enc/ivas_ism_enc.c | 2 +- lib_enc/ivas_ism_metadata_enc.c | 2 +- lib_enc/ivas_ism_param_enc.c | 4 ++-- 9 files changed, 17 insertions(+), 19 deletions(-) diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index dcbf58c1dc..9edf92f806 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -436,7 +436,7 @@ void ApplyFdCng( ( *timeDomainInput( -FLT_MAX ) && *( timeDomainInput + hFdCngCom->frameSize - 1 ) < FLT_MAX && *( timeDomainInput + hFdCngCom->frameSize - 1 ) > ( -FLT_MAX ) ) ) && - ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_mode ) ) && + ( ( ( ( st->element_mode != IVAS_CPE_TD && st->element_mode != IVAS_CPE_DFT && hFdCngDec->flag_dtx_mode ) || !st->VAD || ( st->ini_frame < 100 && st->is_ism_format ) ) && !( st->cng_type == LP_CNG && hFdCngDec->flag_dtx_mode ) && ( is_music == 0 ) ) || ( st->element_mode == IVAS_CPE_TD ) ) && ( !st->BER_detect ) ) diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index ff96a8e324..0e9c3c2e50 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -741,7 +741,7 @@ ivas_error init_decoder( st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ #ifdef FORCE_EST - st->is_ism_mode = 0; + st->is_ism_format = 0; #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index cec550028d..188c946323 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -862,8 +862,8 @@ ivas_error ivas_init_decoder( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; - st_ivas->nSCE = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; + st_ivas->nSCE = MAX_PARAM_ISM_WAVE; if ( ( error = ivas_param_ism_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -884,6 +884,10 @@ ivas_error ivas_init_decoder( } reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); + +#ifdef FORCE_EST + st_ivas->hSCE[sce_id]->hCoreCoder[0]->is_ism_format = 1; +#endif } if ( st_ivas->ism_mode == ISM_MODE_PARAM ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index e73cde5d54..31ddc89ccf 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -302,7 +302,7 @@ ivas_error ivas_ism_dec_config( #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { #ifdef NCHAN_ISM_PARAMETER @@ -344,7 +344,7 @@ ivas_error ivas_ism_dec_config( #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { #ifdef NCHAN_ISM_PARAMETER diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index fb0548b0d5..47ee06d466 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -364,12 +364,6 @@ ivas_error create_sce_dec( { return error; } -#ifdef FORCE_EST - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - st->is_ism_mode = 1; - } -#endif if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) { diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 9285e6efb6..5563bfd7f7 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1345,10 +1345,10 @@ typedef struct Decoder_State /* MCT Channel mode indication: LFE, ignore channel? */ MCT_CHAN_MODE mct_chan_mode; - int16_t cng_ism_flag; /* CNG in Param-ISM flag */ - int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ + int16_t cng_ism_flag; /* CNG in Param-ISM flag */ + int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ #ifdef FORCE_EST - int16_t is_ism_mode; /* Indicator if codec operates in ISM mode */ + int16_t is_ism_format; /* Indication whether the codec operates in ISM format */ #endif } Decoder_State, *DEC_CORE_HANDLE; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index fa5e6115f1..57fdb7631e 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -466,7 +466,7 @@ ivas_error ivas_ism_enc_config( /* Reset and Initialize */ if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - st_ivas->nchan_transport = 2; + st_ivas->nchan_transport = MAX_PARAM_ISM_WAVE; } else { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index e8beca67b5..e534bf0704 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -893,7 +893,7 @@ ivas_error ivas_ism_metadata_enc_create( if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { - nchan_transport = 2; + nchan_transport = MAX_PARAM_ISM_WAVE; } else { diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 16f234b839..998c24e691 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -120,9 +120,9 @@ static void ivas_param_ism_compute_obj_parameters( } #ifdef NCHAN_ISM_PARAMETER - for ( i = 2; i < nchan_ism; i++ ) + for ( i = MAX_PARAM_ISM_WAVE; i < nchan_ism; i++ ) #else - for ( i = 2; i < num_obj; i++ ) + for ( i = MAX_PARAM_ISM_WAVE; i < num_obj; i++ ) #endif { if ( ref_power_local[i] > ref_power_local[index_1] ) -- GitLab From cba58af85d4c232e9bcbf337cdb099c915fc368a Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 21 Mar 2023 12:22:13 +0100 Subject: [PATCH 33/45] apply decoder MD smoothing in paramISM also for objects 3 and 4; under FIX_MD_SMOOTH_PARAMISM --- lib_com/options.h | 1 + lib_dec/ivas_ism_dtx_dec.c | 4 ++++ lib_dec/ivas_ism_metadata_dec.c | 4 ++++ lib_enc/ivas_ism_enc.c | 8 ++++++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index d9eec46fce..42ed47d1d6 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,6 +160,7 @@ #define FIX_DTX_BRATE_LIMIT /* VA: limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats */ #ifdef DISCRETE_ISM_DTX_CNG #define FORCE_EST /* FhG: force ACELP noise estimation in ISM mode for first 100 frames to prevent all-zero CNG */ +#define FIX_MD_SMOOTH_PARAMISM /* VA: apply decoder MD smoothing in paramISM also for objects 3 and 4 */ #endif #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index cb4d1752d2..40669be913 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -229,7 +229,11 @@ ivas_error ivas_ism_dtx_dec( } } +#ifdef FIX_MD_SMOOTH_PARAMISM + update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); +#else update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); +#endif st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index e636cecc1b..50594d44ff 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -702,7 +702,11 @@ ivas_error ivas_ism_metadata_dec( *----------------------------------------------------------------*/ set_s( md_diff_flag, 1, nchan_ism ); +#ifdef FIX_MD_SMOOTH_PARAMISM + update_last_metadata( nchan_ism, hIsmMeta, md_diff_flag ); +#else update_last_metadata( *nchan_transport, hIsmMeta, md_diff_flag ); +#endif #endif for ( ch = 0; ch < *nchan_transport; ch++ ) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 57fdb7631e..f887517f9c 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -267,7 +267,7 @@ ivas_error ivas_ism_enc( #ifdef TD5 ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, #ifdef NCHAN_ISM_PARAMETER - st_ivas->hEncoderConfig->nchan_ism, + nchan_ism, #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else @@ -279,7 +279,7 @@ ivas_error ivas_ism_enc( #ifdef TD5 ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, #ifdef NCHAN_ISM_PARAMETER - st_ivas->hEncoderConfig->nchan_ism, + nchan_ism, #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else @@ -288,7 +288,11 @@ ivas_error ivas_ism_enc( } #ifdef DISCRETE_ISM_DTX_CNG +#ifdef FIX_MD_SMOOTH_PARAMISM + update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); +#else update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); +#endif #endif /*----------------------------------------------------------------* -- GitLab From 728022f697b5f358b134af95a888c90e46e27b4f Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 11:27:50 +0100 Subject: [PATCH 34/45] clang-format --- lib_com/prot.h | 8 ++++---- lib_dec/fd_cng_dec.c | 8 ++++---- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_dec/ivas_tcx_core_dec.c | 6 +++--- lib_enc/ivas_ism_metadata_enc.c | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib_com/prot.h b/lib_com/prot.h index 5bcc4c950d..687442cb12 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -2229,7 +2229,7 @@ ivas_error init_encoder( const int16_t var_SID_rate_flag, /* i : flag for variable SID update rate */ const int16_t interval_SID, /* i : interval for SID update */ const int16_t vad_only_flag, /* i : flag to indicate front-VAD structure */ - const ISM_MODE ism_mode /* i : ISM mode */ + const ISM_MODE ism_mode /* i : ISM mode */ ); void LPDmem_enc_init( @@ -8518,10 +8518,10 @@ void generate_comfort_noise_dec( ); void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t cng_flag /* i : CNG Flag */ + const int16_t cng_flag /* i : CNG Flag */ ); void generate_masking_noise( diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 65662e5fa8..b9d1920f39 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1340,10 +1340,10 @@ void generate_comfort_noise_dec( *-------------------------------------------------------------------*/ void generate_comfort_noise_dec_hf( - float **bufferReal, /* o : Real part of input bands */ - float **bufferImag, /* o : Imaginary part of input bands */ - HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ - const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ + float **bufferReal, /* o : Real part of input bands */ + float **bufferImag, /* o : Imaginary part of input bands */ + HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ + const int16_t cng_coh_flag /* i : CNG Flag for coherence handling */ ) { int16_t i, j; diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index bc17d7a6cc..635245fb6f 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -143,7 +143,7 @@ static void ism_metadata_smooth( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_dec( - const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ #ifdef NCHAN_ISM_PARAMETER const int16_t nchan_ism, /* i : number of ISM channels */ #endif diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index 40c562a3b2..56059bd29d 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -160,11 +160,11 @@ void stereo_tcx_core_dec( const int16_t last_element_mode, /* i : last element mode */ const int16_t flag_sec_CNA, /* i : CNA flag for secondary channel */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i : Stereo CNG handle */ - const int16_t nchan_out, /* i : number of output channels */ - const IVAS_FORMAT ivas_format /* i : IVAS format */ + const int16_t nchan_out, /* i : number of output channels */ + const IVAS_FORMAT ivas_format /* i : IVAS format */ #ifndef DISCRETE_ISM_DTX_CNG , - const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM)*/ + const ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM)*/ #endif ) { diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 60b3001087..6e8409e862 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -87,7 +87,7 @@ ivas_error ivas_set_ism_metadata( ISM_METADATA_HANDLE hIsmMeta, /* o : ISM metadata handle */ const float azimuth, /* i : azimuth value */ #ifdef TD5 - const float elevation, /* i : elevation */ + const float elevation, /* i : elevation */ const float radius_meta, /* i : radius */ const float yaw, /* i : yaw */ const float pitch /* i : pitch */ @@ -176,7 +176,7 @@ static void rate_ism_importance( *-------------------------------------------------------------------------*/ ivas_error ivas_ism_metadata_enc( - const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int32_t ism_total_brate, /* i : ISM total bitrate */ #ifdef NCHAN_ISM_PARAMETER const int16_t nchan_ism, /* i : number of ISM channels */ #endif -- GitLab From d96a6fc284f3e7bd178009ad4e7dd88f31387159 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 11:39:46 +0100 Subject: [PATCH 35/45] fix compilation warnings --- lib_dec/ivas_ism_metadata_dec.c | 5 ++--- lib_dec/ivas_ism_param_dec.c | 7 +++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 635245fb6f..f8ee085dc9 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -663,7 +663,7 @@ ivas_error ivas_ism_metadata_dec( { ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); } - hISMDTX.ism_dtx_hangover_cnt = min( ( hISMDTX.ism_dtx_hangover_cnt )++, IVAS_ISM_DTX_HO_MAX ); + hISMDTX.ism_dtx_hangover_cnt = min( hISMDTX.ism_dtx_hangover_cnt++, IVAS_ISM_DTX_HO_MAX ); #endif /*----------------------------------------------------------------* @@ -1039,7 +1039,7 @@ void ivas_ism_metadata_sid_dec( int16_t nb_bits_metadata[] /* o : number of metadata bits */ ) { - int16_t i, ch, nb_bits_start, last_bit_pos; + int16_t i, ch, last_bit_pos; float q_step, q_step_border; int16_t idx, idx_azimuth, idx_elevation; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; @@ -1060,7 +1060,6 @@ void ivas_ism_metadata_sid_dec( /* initialization */ st0 = hSCE[0]->hCoreCoder[0]; - nb_bits_start = 0; last_bit_pos = (int16_t) ( ( ism_total_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); bstr_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index c697275b37..3595ad3261 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -422,7 +422,9 @@ ivas_error ivas_param_ism_dec_open( IVAS_OUTPUT_SETUP hOutSetup; AUDIO_CONFIG output_config; int32_t output_Fs; +#ifndef NCHAN_ISM_PARAMETER int16_t nchan_out; +#endif ivas_error error; error = IVAS_ERR_OK; @@ -451,11 +453,12 @@ ivas_error ivas_param_ism_dec_open( output_Fs = st_ivas->hDecoderConfig->output_Fs; output_config = st_ivas->hDecoderConfig->output_config; - nchan_out = st_ivas->hDecoderConfig->nchan_out; - #ifdef NCHAN_ISM_PARAMETER + ivas_param_ism_config( hDirAC->hParamIsm, st_ivas->nchan_ism ); #else + nchan_out = st_ivas->hDecoderConfig->nchan_out; + if ( output_config == AUDIO_CONFIG_EXTERNAL ) { hDirAC->hParamIsm->num_obj = nchan_out; -- GitLab From 2891b7a7723fe0889671459e298c9ac4c360e524 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 12:25:58 +0100 Subject: [PATCH 36/45] fix compilation warning --- lib_dec/ivas_ism_metadata_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index f8ee085dc9..39467ada1e 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -662,8 +662,8 @@ ivas_error ivas_ism_metadata_dec( if ( hISMDTX.ism_dtx_hangover_cnt < IVAS_ISM_DTX_HO_MAX ) { ism_metadata_smooth( hIsmMeta, ism_total_brate, nchan_ism ); + hISMDTX.ism_dtx_hangover_cnt += 1; } - hISMDTX.ism_dtx_hangover_cnt = min( hISMDTX.ism_dtx_hangover_cnt++, IVAS_ISM_DTX_HO_MAX ); #endif /*----------------------------------------------------------------* -- GitLab From 9cf62c09e7fa765d01cb02a99ad2978664b09134 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 24 Mar 2023 15:26:42 +0100 Subject: [PATCH 37/45] merge FIX_DTX_BRATE_LIMIT, FORCE_EST and FIX_MD_SMOOTH_PARAMISM into DISCRETE_ISM_DTX_CNG --- lib_com/ivas_prot.h | 2 -- lib_com/options.h | 6 ------ lib_dec/fd_cng_dec.c | 2 +- lib_dec/init_dec.c | 2 +- lib_dec/ivas_init_dec.c | 2 +- lib_dec/ivas_ism_dtx_dec.c | 4 ---- lib_dec/ivas_ism_metadata_dec.c | 5 +---- lib_dec/stat_dec.h | 2 +- lib_enc/ivas_ism_dtx_enc.c | 12 +++--------- lib_enc/ivas_ism_enc.c | 8 -------- 10 files changed, 8 insertions(+), 37 deletions(-) diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 6a07bd7835..1b70d43bb5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -943,9 +943,7 @@ ivas_error ivas_ism_dtx_open( int16_t ivas_ism_dtx_enc( ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ -#ifdef FIX_DTX_BRATE_LIMIT const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#endif const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ diff --git a/lib_com/options.h b/lib_com/options.h index eb023f54a7..2ed001b78a 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -159,13 +159,7 @@ #endif #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ - #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define FIX_DTX_BRATE_LIMIT /* VA: limit the DTX usage in background noise to lower bitrates similarly as in other IVAS formats */ -#ifdef DISCRETE_ISM_DTX_CNG -#define FORCE_EST /* FhG: force ACELP noise estimation in ISM mode for first 100 frames to prevent all-zero CNG */ -#define FIX_MD_SMOOTH_PARAMISM /* VA: apply decoder MD smoothing in paramISM also for objects 3 and 4 */ -#endif #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index b9d1920f39..ab9465a93a 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -420,7 +420,7 @@ void ApplyFdCng( hFdCngCom->sid_frame_counter = 0; /* set noise estimation inactive during concealment, as no update with noise generated by concealment should be performed. */ /* set noise estimation inactive when we have bit errors, as no update with noise generated by corrupt frame (biterror) should be performed. */ -#ifndef FORCE_EST +#ifndef DISCRETE_ISM_DTX_CNG if ( concealWholeFrame == 0 && ( timeDomainInput == NULL || ( *timeDomainInput( -FLT_MAX ) && diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 1666e8b304..34ee7a3cec 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -740,7 +740,7 @@ ivas_error init_decoder( st->cng_sba_flag = 0; st->cng_ism_flag = 0; st->read_sid_info = 1; /* by default read the sid info from bitstream */ -#ifdef FORCE_EST +#ifdef DISCRETE_ISM_DTX_CNG st->is_ism_format = 0; #endif diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 1b920609ff..ca20d75b15 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -904,7 +904,7 @@ ivas_error ivas_init_decoder( reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); -#ifdef FORCE_EST +#ifdef DISCRETE_ISM_DTX_CNG st_ivas->hSCE[sce_id]->hCoreCoder[0]->is_ism_format = 1; #endif } diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 40669be913..6834c868d2 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -229,11 +229,7 @@ ivas_error ivas_ism_dtx_dec( } } -#ifdef FIX_MD_SMOOTH_PARAMISM update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); -#else - update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); -#endif st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 39467ada1e..25f500b7fc 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -728,11 +728,8 @@ ivas_error ivas_ism_metadata_dec( *----------------------------------------------------------------*/ set_s( md_diff_flag, 1, nchan_ism ); -#ifdef FIX_MD_SMOOTH_PARAMISM + update_last_metadata( nchan_ism, hIsmMeta, md_diff_flag ); -#else - update_last_metadata( *nchan_transport, hIsmMeta, md_diff_flag ); -#endif #endif for ( ch = 0; ch < *nchan_transport; ch++ ) diff --git a/lib_dec/stat_dec.h b/lib_dec/stat_dec.h index 5563bfd7f7..1a82d45587 100644 --- a/lib_dec/stat_dec.h +++ b/lib_dec/stat_dec.h @@ -1347,7 +1347,7 @@ typedef struct Decoder_State int16_t cng_ism_flag; /* CNG in Param-ISM flag */ int16_t read_sid_info; /* For ParamISM, use the transmitted noise */ -#ifdef FORCE_EST +#ifdef DISCRETE_ISM_DTX_CNG int16_t is_ism_format; /* Indication whether the codec operates in ISM format */ #endif diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 23c592ea91..542519bf7a 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -104,11 +104,9 @@ ivas_error ivas_ism_dtx_open( /*! r: indication of DTX frame */ int16_t ivas_ism_dtx_enc( - ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ - SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ -#ifdef FIX_DTX_BRATE_LIMIT - const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#endif + ISM_DTX_HANDLE hISMDTX, /* i/o: ISM DTX handle */ + SCE_ENC_HANDLE hSCE[MAX_SCE], /* i/o: SCE encoder structure */ + const int32_t ivas_total_brate, /* i : IVAS total bitrate */ const int16_t nchan_ism, /* i : number of objects */ const int16_t nchan_transport, /* i : number of transport channels */ int16_t vad_flag[MAX_NUM_OBJECTS], /* i : VAD flag */ @@ -121,9 +119,7 @@ int16_t ivas_ism_dtx_enc( int16_t nBits, nBits_MD_max; int16_t nBits_azimuth, nBits_elevation, nBits_coh, nBits_sce_id; float lp_noise[MAX_NUM_OBJECTS], lp_noise_variation, lp_noise_mean; -#ifdef FIX_DTX_BRATE_LIMIT float lp_noise_max; -#endif float tmp1, tmp2; /* initialization */ @@ -159,7 +155,6 @@ int16_t ivas_ism_dtx_enc( } -#ifdef FIX_DTX_BRATE_LIMIT /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ maximum( lp_noise, nchan_ism, &lp_noise_max ); @@ -171,7 +166,6 @@ int16_t ivas_ism_dtx_enc( { dtx_flag = 0; } -#endif /*------------------------------------------------------------------* * Reset the bitstream diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index e1d456c9e6..b30919043f 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -213,11 +213,7 @@ ivas_error ivas_ism_enc( /* analysis and decision about DTX */ #ifdef DISCRETE_ISM_DTX_CNG -#ifdef FIX_DTX_BRATE_LIMIT dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->hEncoderConfig->ivas_total_brate, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#else - dtx_flag = ivas_ism_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, nchan_ism, st_ivas->nchan_transport, vad_flag, st_ivas->hIsmMetaData, md_diff_flag, &sid_flag ); -#endif #else dtx_flag = ivas_ism_dtx_enc( st_ivas, &sid_flag ); #endif @@ -288,11 +284,7 @@ ivas_error ivas_ism_enc( } #ifdef DISCRETE_ISM_DTX_CNG -#ifdef FIX_MD_SMOOTH_PARAMISM update_last_metadata( nchan_ism, st_ivas->hIsmMetaData, md_diff_flag ); -#else - update_last_metadata( st_ivas->nchan_transport, st_ivas->hIsmMetaData, md_diff_flag ); -#endif #endif /*----------------------------------------------------------------* -- GitLab From b4c3b563f9e6e18cffdf1b91cc3c7a34a70e06a6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 08:33:43 +0200 Subject: [PATCH 38/45] temporarily deactivate NCHAN_ISM_PARAMETER --- lib_com/options.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/options.h b/lib_com/options.h index 2ed001b78a..e540b74da5 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ #define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ -#define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ +//#define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ /* ################## End DEVELOPMENT switches ######################### */ -- GitLab From 00498e1628136d363327c9a95e8dcea87676568f Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 09:07:40 +0200 Subject: [PATCH 39/45] - activate again DISCRETE_ISM_DTX_CNG + fix compilation warnings when it is not activated --- lib_com/options.h | 2 +- lib_dec/ivas_ism_metadata_dec.c | 2 +- lib_enc/ivas_ism_enc.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 5d88009f73..c054a9b5a7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -160,7 +160,7 @@ #define FIX_380_BFI_PARAMISM /* VA: issue 380 - fix metadata recovery in ParamISM BFI */ #define FIX_MDCT_BASED_BWD /* FhG: fixes for BWD for issues with reaction to transients for MDCT-stereo and MCT */ -//#define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ +#define DISCRETE_ISM_DTX_CNG /* FhG/VA: contribution 15 - DTX/CNG for (discrete) ISM */ #define NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 25f500b7fc..d610af012a 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -216,7 +216,7 @@ ivas_error ivas_ism_metadata_dec( #endif pop_wmops(); - return error; + return IVAS_ERR_OK; } #endif diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 484c56a57f..8aa4d41623 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -90,9 +90,10 @@ ivas_error ivas_ism_enc( int16_t md_diff_flag[MAX_NUM_OBJECTS]; #else #ifdef NCHAN_ISM_PARAMETER - int16_t nchan_ism; -#endif + int16_t nchan_ism, dtx_flag, sid_flag; +#else int16_t dtx_flag, sid_flag, flag_noisy_speech; +#endif int16_t i, nBits; #endif ivas_error error; @@ -107,7 +108,9 @@ ivas_error ivas_ism_enc( dtx_flag = 0; sid_flag = 0; +#if ( !defined NCHAN_ISM_PARAMETER || defined DISCRETE_ISM_DTX_CNG ) flag_noisy_speech = 0; +#endif #ifdef NCHAN_ISM_PARAMETER nchan_ism = st_ivas->hEncoderConfig->nchan_ism; -- GitLab From 958f8709c143becd0c50c07ffd5411d824c452bb Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 09:18:49 +0200 Subject: [PATCH 40/45] - temporarily disable TD5 and TD5_FIX_INVALID_MEMORY_ACCESS +fix compilation when they are disabled --- lib_com/options.h | 4 ++-- lib_dec/ivas_ism_metadata_dec.c | 10 ++++++++++ lib_enc/ivas_ism_enc.c | 12 ++++++++++-- lib_enc/ivas_ism_metadata_enc.c | 10 ++++++++++ lib_rend/ivas_objectRenderer.c | 3 +++ 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c054a9b5a7..c4a191657f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,8 +149,8 @@ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ -#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ -#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ +//#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ +//#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ #define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index d610af012a..bc563a64da 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -1163,13 +1163,23 @@ void ivas_ism_metadata_sid_dec( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { +#ifdef MD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#else + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#endif } else { +#ifdef MD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#else + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#endif } /* save for smoothing metadata evolution */ diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 8aa4d41623..230f0b8da1 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -277,7 +277,11 @@ ivas_error ivas_ism_enc( #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, st_ivas->hDirAC->hParamIsm ); #endif } else /* ISM_MODE_DISC */ @@ -289,7 +293,11 @@ ivas_error ivas_ism_enc( #endif st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL, st_ivas->hEncoderConfig->ism_extended_metadata_flag ); #else - ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); + ivas_ism_metadata_enc( st_ivas->hEncoderConfig->ivas_total_brate, +#ifdef NCHAN_ISM_PARAMETER + nchan_ism, +#endif + st_ivas->nchan_transport, st_ivas->hIsmMetaData, st_ivas->hSCE, st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, nb_bits_metadata, vad_flag, st_ivas->ism_mode, NULL ); #endif } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 6e8409e862..231d32c0aa 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -1425,13 +1425,23 @@ void ivas_ism_metadata_sid_enc( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { +#ifdef MD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#else + hIsmMetaData->last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); + hIsmMetaData->last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); +#endif } else { +#ifdef MD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#else + hIsmMetaData->last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); + hIsmMetaData->last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); +#endif } } } diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 67b73db6a6..67f73fab30 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -612,7 +612,10 @@ ivas_error ivas_td_binaural_open_ext( #ifdef TD5 #ifdef TD5_FIX_INVALID_MEMORY_ACCESS if ( NULL != hRendCfg ) + { directivity = hRendCfg->directivity; + } + return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); #else return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hRendCfg->directivity, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); -- GitLab From 55d6565496dc1a82ac6e4f70581be06b5cf21702 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 09:23:24 +0200 Subject: [PATCH 41/45] activate again TD5 and TD5_FIX_INVALID_MEMORY_ACCESS --- lib_com/options.h | 4 ++-- lib_dec/ivas_ism_metadata_dec.c | 4 ++-- lib_enc/ivas_ism_metadata_enc.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index c4a191657f..c054a9b5a7 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,8 +149,8 @@ #define FIX_350_MASA_DELAY_COMP /* Nokia: Issue 350: MASA audio/meta delay compensation */ #define FIX_372_LIB_REND_VALIDATE_IO /* FhG: Issue 372: IVAS_rend segfaults with unsupported I/O configs - add validation checks of I/O config */ #define FIX_376_SBA_ROTATE /*DLB: Fix for issue 376*/ -//#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ -//#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ +#define TD5 /* Eri: Contribution 17: Extended metadata for 6 DoF rendering in TD renderer */ +#define TD5_FIX_INVALID_MEMORY_ACCESS /* FhG: Resolves segfault in case IVAS_REND_InitConfig gets initialized with rendererConfigEnabled:=false && ISM are being rendered */ #define FIX_371_DELAY_REPORT /* Issue 371: div. by zero with -no_delay_cmp */ #define FIX_373_MASA_DELAY_COMP_MSAN /* Nokia: Issue 373: MASA audio/meta delay compensation. MSAN bugfix */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index bc563a64da..99f94fa536 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -1163,7 +1163,7 @@ void ivas_ism_metadata_sid_dec( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef MD5 +#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); #else @@ -1173,7 +1173,7 @@ void ivas_ism_metadata_sid_dec( } else { -#ifdef MD5 +#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); #else diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 231d32c0aa..1540e35ce4 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -1425,7 +1425,7 @@ void ivas_ism_metadata_sid_enc( /* update last indexes to correspond to active frames coding */ if ( nBits_azimuth > ISM_AZIMUTH_NBITS ) { -#ifdef MD5 +#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth >> ( nBits_azimuth - ISM_AZIMUTH_NBITS ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation >> ( nBits_elevation - ISM_ELEVATION_NBITS ); #else @@ -1435,7 +1435,7 @@ void ivas_ism_metadata_sid_enc( } else { -#ifdef MD5 +#ifdef TD5 hIsmMetaData->angle[0].last_azimuth_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->angle[0].last_elevation_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); #else -- GitLab From ab138199ee23eac747df077c871ae69a9cb529e4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 09:52:02 +0200 Subject: [PATCH 42/45] fix uninitialized error if 'md_diff_flag' --- lib_enc/ivas_ism_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 230f0b8da1..25ce78ff2e 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -125,8 +125,8 @@ ivas_error ivas_ism_enc( nchan_ism = st_ivas->nchan_transport; } #endif - set_s( md_diff_flag, 1, nchan_ism ); #endif + set_s( md_diff_flag, 1, nchan_ism ); /*------------------------------------------------------------------* * Preprocesing -- GitLab From 45da254d6bb8914ac507b238d85260b430e21ce7 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 12:32:38 +0200 Subject: [PATCH 43/45] fix MSAN error --- lib_dec/ivas_ism_dtx_dec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 9faeceb733..1a4325f528 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -242,13 +242,16 @@ ivas_error ivas_ism_dtx_dec( st_ivas->hISMDTX.ism_dtx_hangover_cnt = 0; #endif - for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) + if ( ivas_total_brate == IVAS_SID_5k2 && !st_ivas->bfi ) { + for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) + { #ifdef DISCRETE_ISM_DTX_CNG - nb_bits_metadata[ch] = nb_bits_metadata[sce_id_dtx]; + nb_bits_metadata[ch] = nb_bits_metadata[sce_id_dtx]; #else - nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; + nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; #endif + } } #ifdef DISCRETE_ISM_DTX_CNG -- GitLab From dc332722e0240a9848ba887261bdd5661f11816e Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 12:37:03 +0200 Subject: [PATCH 44/45] comment --- lib_dec/ivas_ism_dtx_dec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 1a4325f528..ef52c082b7 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -262,7 +262,7 @@ ivas_error ivas_ism_dtx_dec( { for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { - ivas_ism_preprocessing( st_ivas, ch ); + ivas_ism_preprocessing( st_ivas, ch ); // VE: after the acceptance of switches, replace the function call by its content } } -- GitLab From a71848d71b2847cece763e7adb790a31e125bbc6 Mon Sep 17 00:00:00 2001 From: vaclav Date: Mon, 27 Mar 2023 13:07:19 +0200 Subject: [PATCH 45/45] fix one more MSAN error --- lib_enc/ivas_ism_dtx_enc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 542519bf7a..3839a42a9d 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -146,8 +146,8 @@ int16_t ivas_ism_dtx_enc( lp_noise[ch] = hSCE[ch]->hCoreCoder[0]->lp_noise; } - lp_noise_variation = var( lp_noise, nchan_ism ); - lp_noise_mean = mean( lp_noise, nchan_ism ); + lp_noise_variation = var( lp_noise, nchan_transport ); + lp_noise_mean = mean( lp_noise, nchan_transport ); if ( lp_noise_mean > 50 || ( lp_noise_mean > 25 && lp_noise_variation > 32 ) ) { @@ -156,7 +156,7 @@ int16_t ivas_ism_dtx_enc( /* default DTX is applied at lower bitrates; otherwise DTX is applied only in silence */ - maximum( lp_noise, nchan_ism, &lp_noise_max ); + maximum( lp_noise, nchan_transport, &lp_noise_max ); if ( !( ( nchan_ism == 1 && ivas_total_brate <= IVAS_24k4 ) || ( nchan_ism == 2 && ivas_total_brate <= IVAS_48k ) || -- GitLab