Loading lib_com/ivas_cnst.h +22 −0 Original line number Diff line number Diff line Loading @@ -341,9 +341,26 @@ 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 #else #define PARAM_ISM_DTX_COH_SCA_BITS 4 #endif #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) #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 typedef enum { Loading @@ -364,8 +381,13 @@ enum IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, #endif IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, #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, /* ------------- loop for objects -------------- */ Loading lib_com/ivas_ism_com.c +104 −21 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ static void bitbudget_to_brate( ivas_error ivas_ism_config( const int32_t ism_total_brate, /* i : ISM total bitrate */ const int16_t nchan_transport, /* i : number of transport channels */ 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 localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ const int16_t ism_imp[], /* i : ISM importance flags */ Loading Loading @@ -138,7 +138,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++ ) { Loading Loading @@ -374,6 +374,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 */ const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ const int16_t cbsize /* i : codebook size */ ) { Loading @@ -384,19 +386,19 @@ int16_t ism_quant_meta( { qlow = borders[0]; idx_start = 0; step = ISM_Q_STEP_BORDER; step = 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; 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] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP_BORDER; idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); step = q_step_border; } idx = idx_start + (int16_t) max( 0.f, min( cbsize - 1, ( ( val - qlow ) / step + 0.5f ) ) ); Loading @@ -416,29 +418,31 @@ int16_t ism_quant_meta( float ism_dequant_meta( 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 */ const int16_t cbsize /* i : codebook size */ ) { int16_t idx_start; float qlow, step, valQ; if ( idx <= ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ) if ( idx <= ( borders[1] - borders[0] ) / q_step_border ) { qlow = borders[0]; idx_start = 0; step = ISM_Q_STEP_BORDER; step = q_step_border; } else if ( idx <= cbsize - 1 - ( borders[3] - borders[2] ) / ISM_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] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP; 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] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP_BORDER; idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); step = q_step_border; } valQ = ( idx - idx_start ) * step + qlow; Loading @@ -455,12 +459,22 @@ float ism_dequant_meta( 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_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++ ) { Loading @@ -468,7 +482,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; Loading Loading @@ -535,3 +553,68 @@ void ivas_ism_metadata_close( return; } #ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------* * update_last_metadata() * * Store last metadata values *-------------------------------------------------------------------*/ void update_last_metadata( 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 < nchan_ism; 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 *----------------------------------------------------------------*/ void ivas_get_ism_sid_quan_bitbudget( 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 */ 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 ( nchan_ism >= 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; } #endif lib_com/ivas_prot.h +125 −33 Original line number Diff line number Diff line Loading @@ -500,8 +500,10 @@ void stereo_tcx_core_dec( 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 ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ 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) */ #endif ); void stereo_tcx_init_dec( Loading Loading @@ -744,8 +746,8 @@ void dtx_read_padding_bits( ivas_error ivas_ism_config( const int32_t ism_total_brate, /* i : ISM 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 */ Loading @@ -767,6 +769,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 */ const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ const int16_t cbsize /* i : codebook size */ ); Loading @@ -774,6 +778,8 @@ int16_t ism_quant_meta( float ism_dequant_meta( 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 */ const int16_t cbsize /* i : codebook size */ ); Loading Loading @@ -811,6 +817,9 @@ ivas_error ivas_ism_enc( ivas_error ivas_ism_metadata_enc( 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 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 */ Loading @@ -828,12 +837,18 @@ ivas_error ivas_ism_metadata_enc( ivas_error ivas_ism_metadata_dec( 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 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 ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ #endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ); Loading Loading @@ -875,6 +890,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( Loading @@ -882,8 +901,14 @@ ivas_error ivas_ism_enc_config( ); 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 */ 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 #ifndef NCHAN_ISM_PARAMETER ,const int16_t num_obj /* i : number of objects in the bitstream */ #endif ); ivas_error ivas_param_ism_dec_open( Loading Loading @@ -913,21 +938,75 @@ ivas_error ivas_ism_dtx_open( 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( 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 */ 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 */ ); #else /*! 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 */ 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 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 */ 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 */ ); #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 */ #ifdef NCHAN_ISM_PARAMETER ,const int16_t nchan_ism /* i : number of ISM channels */ #endif ); #endif #ifdef DISCRETE_ISM_DTX_CNG 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 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 */ 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 */ ); #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 */ Loading @@ -940,12 +1019,6 @@ void ivas_param_ism_compute_noisy_speech_flag( 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 */ Loading @@ -953,6 +1026,25 @@ void ivas_ism_coh_estim_dtx_enc( const int16_t input_frame /* i : input frame length */ ); #ifdef DISCRETE_ISM_DTX_CNG void update_last_metadata( 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 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 */ 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 */ ); #endif /*----------------------------------------------------------------------------------* * DFT Stereo prototypes *----------------------------------------------------------------------------------*/ Loading Loading @@ -4637,7 +4729,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 */ ); Loading lib_com/ivas_stat_com.h +9 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,13 @@ typedef struct int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ #endif #ifdef DISCRETE_ISM_DTX_CNG float last_azimuth; /* MD smoothing in DTX- last Q azimuth value */ float last_elevation; /* MD smoothing in DTX - last Q elevation value */ float last_true_azimuth; /* MD smoothing in DTX- last true Q azimuth value */ float last_true_elevation; /* MD smoothing in DTX- last true Q elevation value */ #endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; Loading Loading @@ -149,7 +156,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]; Loading lib_com/options.h +3 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,8 @@ #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 NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ /* ################## End DEVELOPMENT switches ######################### */ Loading Loading
lib_com/ivas_cnst.h +22 −0 Original line number Diff line number Diff line Loading @@ -341,9 +341,26 @@ 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 #else #define PARAM_ISM_DTX_COH_SCA_BITS 4 #endif #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) #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 typedef enum { Loading @@ -364,8 +381,13 @@ enum IND_ISM_METADATA_FLAG = IND_ISM_NUM_OBJECTS + MAX_NUM_OBJECTS, #endif IND_ISM_VAD_FLAG = IND_ISM_METADATA_FLAG + MAX_NUM_OBJECTS, #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, /* ------------- loop for objects -------------- */ Loading
lib_com/ivas_ism_com.c +104 −21 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ static void bitbudget_to_brate( ivas_error ivas_ism_config( const int32_t ism_total_brate, /* i : ISM total bitrate */ const int16_t nchan_transport, /* i : number of transport channels */ 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 localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ const int16_t ism_imp[], /* i : ISM importance flags */ Loading Loading @@ -138,7 +138,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++ ) { Loading Loading @@ -374,6 +374,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 */ const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ const int16_t cbsize /* i : codebook size */ ) { Loading @@ -384,19 +386,19 @@ int16_t ism_quant_meta( { qlow = borders[0]; idx_start = 0; step = ISM_Q_STEP_BORDER; step = 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; 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] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP_BORDER; idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); step = q_step_border; } idx = idx_start + (int16_t) max( 0.f, min( cbsize - 1, ( ( val - qlow ) / step + 0.5f ) ) ); Loading @@ -416,29 +418,31 @@ int16_t ism_quant_meta( float ism_dequant_meta( 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 */ const int16_t cbsize /* i : codebook size */ ) { int16_t idx_start; float qlow, step, valQ; if ( idx <= ( borders[1] - borders[0] ) / ISM_Q_STEP_BORDER ) if ( idx <= ( borders[1] - borders[0] ) / q_step_border ) { qlow = borders[0]; idx_start = 0; step = ISM_Q_STEP_BORDER; step = q_step_border; } else if ( idx <= cbsize - 1 - ( borders[3] - borders[2] ) / ISM_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] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP; 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] ) / ISM_Q_STEP_BORDER ); step = ISM_Q_STEP_BORDER; idx_start = (int16_t) ( cbsize - 1 - ( borders[3] - borders[2] ) / q_step_border ); step = q_step_border; } valQ = ( idx - idx_start ) * step + qlow; Loading @@ -455,12 +459,22 @@ float ism_dequant_meta( 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_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++ ) { Loading @@ -468,7 +482,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; Loading Loading @@ -535,3 +553,68 @@ void ivas_ism_metadata_close( return; } #ifdef DISCRETE_ISM_DTX_CNG /*-------------------------------------------------------------------* * update_last_metadata() * * Store last metadata values *-------------------------------------------------------------------*/ void update_last_metadata( 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 < nchan_ism; 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 *----------------------------------------------------------------*/ void ivas_get_ism_sid_quan_bitbudget( 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 */ 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 ( nchan_ism >= 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; } #endif
lib_com/ivas_prot.h +125 −33 Original line number Diff line number Diff line Loading @@ -500,8 +500,10 @@ void stereo_tcx_core_dec( 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 ISM_MODE ism_mode /* i : ISM mode (only needed if format is ISM) */ 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) */ #endif ); void stereo_tcx_init_dec( Loading Loading @@ -744,8 +746,8 @@ void dtx_read_padding_bits( ivas_error ivas_ism_config( const int32_t ism_total_brate, /* i : ISM 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 */ Loading @@ -767,6 +769,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 */ const float q_step, /* i : quantization step */ const float q_step_border, /* i : quantization step at the border */ const int16_t cbsize /* i : codebook size */ ); Loading @@ -774,6 +778,8 @@ int16_t ism_quant_meta( float ism_dequant_meta( 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 */ const int16_t cbsize /* i : codebook size */ ); Loading Loading @@ -811,6 +817,9 @@ ivas_error ivas_ism_enc( ivas_error ivas_ism_metadata_enc( 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 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 */ Loading @@ -828,12 +837,18 @@ ivas_error ivas_ism_metadata_enc( ivas_error ivas_ism_metadata_dec( 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 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 ISM_DTX_DATA_DEC hISMDTX, /* i/o: ISM DTX structure */ #endif const PARAM_ISM_CONFIG_HANDLE hParamIsm /* i : Param ISM Config Handle */ ); Loading Loading @@ -875,6 +890,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( Loading @@ -882,8 +901,14 @@ ivas_error ivas_ism_enc_config( ); 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 */ 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 #ifndef NCHAN_ISM_PARAMETER ,const int16_t num_obj /* i : number of objects in the bitstream */ #endif ); ivas_error ivas_param_ism_dec_open( Loading Loading @@ -913,21 +938,75 @@ ivas_error ivas_ism_dtx_open( 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( 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 */ 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 */ ); #else /*! 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 */ 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 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 */ 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 */ ); #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 */ #ifdef NCHAN_ISM_PARAMETER ,const int16_t nchan_ism /* i : number of ISM channels */ #endif ); #endif #ifdef DISCRETE_ISM_DTX_CNG 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 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 */ 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 */ ); #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 */ Loading @@ -940,12 +1019,6 @@ void ivas_param_ism_compute_noisy_speech_flag( 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 */ Loading @@ -953,6 +1026,25 @@ void ivas_ism_coh_estim_dtx_enc( const int16_t input_frame /* i : input frame length */ ); #ifdef DISCRETE_ISM_DTX_CNG void update_last_metadata( 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 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 */ 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 */ ); #endif /*----------------------------------------------------------------------------------* * DFT Stereo prototypes *----------------------------------------------------------------------------------*/ Loading Loading @@ -4637,7 +4729,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 */ ); Loading
lib_com/ivas_stat_com.h +9 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,13 @@ typedef struct int16_t elevation_diff_cnt; /* FEC counter of consecutive differentially elevation coded frames */ #endif #ifdef DISCRETE_ISM_DTX_CNG float last_azimuth; /* MD smoothing in DTX- last Q azimuth value */ float last_elevation; /* MD smoothing in DTX - last Q elevation value */ float last_true_azimuth; /* MD smoothing in DTX- last true Q azimuth value */ float last_true_elevation; /* MD smoothing in DTX- last true Q elevation value */ #endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; Loading Loading @@ -149,7 +156,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]; Loading
lib_com/options.h +3 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,8 @@ #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 NCHAN_ISM_PARAMETER /* VA: make 'nchan_ism' parameter part of st_ivas/hEncoderConfig */ /* ################## End DEVELOPMENT switches ######################### */ Loading