Loading lib_com/ivas_stat_com.h +5 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,11 @@ typedef struct 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 */ #ifdef FIX_387_ISM_MD_FEC int16_t ism_md_fec_cnt_enc; /* counter of continuous frames where MD are not transmitted */ int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */ #endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; Loading lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_DFT*/ /* output most important DFT stereo parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ //#define DEBUG_MODE_DIRAC /* output most important DIRAC parameters to the subdirectory "res/" */ /*#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/" */ Loading Loading @@ -149,6 +149,7 @@ #define SNS_MSVQ /* FhG: contribution 33 - MSVQ for SNS parameters at stereo mid bitrates */ #define FIX_379_GAININTP /* Eri: Adds a gain interpolation for directional/distance gain to handle abrupt changes in metadata (Non BE) */ #define FIX_387_ISM_MD_FEC /* VA: Issue 387: fix MD discontinuity in ISM FEC */ #define FIX_418_SID_BITRATE /* Eri: Issue 418: Using the correct bitrate for unified stereo SID */ #define PARAMMC_SHORT_ENC_MDFT /* FhG: Issue 410: complexity optimization for parametric Multichannel modes */ Loading lib_enc/ivas_ism_metadata_enc.c +77 −8 Original line number Diff line number Diff line Loading @@ -56,6 +56,11 @@ #define ISM_MAX_RADIUS_DIFF_IDX ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ ) #define ISM_FEC_MAX 10 #ifdef FIX_387_ISM_MD_FEC #define ISM_MD_FEC_DIFF 10 #define ISM_MD_INC_DIFF_CNT_MAX 6 #define ISM_MD_FEC_CNT_MAX 25 #endif #define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters) */ Loading Loading @@ -195,7 +200,6 @@ ivas_error ivas_ism_metadata_enc( push_wmops( "ism_meta_enc" ); /* initialization */ ism_metadata_flag_global = 0; set_s( nb_bits_metadata, 0, nchan_transport ); Loading @@ -218,6 +222,37 @@ ivas_error ivas_ism_metadata_enc( else if ( ism_mode == ISM_MODE_DISC ) { hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; #ifdef FIX_387_ISM_MD_FEC /* in inactive frames, send MD 1) in ISM_MD_INC_DIFF_CNT_MAX consecutive frames when MD significantly change, 2) at least every ISM_MD_FEC_DIFF frames */ if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { if ( ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_true_azimuth ) > ISM_MD_FEC_DIFF ) || ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) ) { hIsmMeta[ch]->ism_metadata_flag = 1; hIsmMeta[ch]->ism_md_inc_diff_cnt = 0; } else if ( hIsmMeta[ch]->ism_md_inc_diff_cnt < ISM_MD_INC_DIFF_CNT_MAX ) { hIsmMeta[ch]->ism_metadata_flag = 1; if ( hIsmMeta[ch]->ism_md_inc_diff_cnt % 2 == 0 ) { hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; } else { hIsmMeta[ch]->position_angle.angle2_diff_cnt = ISM_FEC_MAX; } } else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX ) { hIsmMeta[ch]->ism_metadata_flag = 1; hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; } } #endif } } Loading Loading @@ -307,7 +342,9 @@ ivas_error ivas_ism_metadata_enc( idx_angle1_abs = hParamIsm->azi_index[ch]; idx_angle2_abs = hParamIsm->ele_index[ch]; } encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); /*----------------------------------------------------------------* * Quantize and encode radius, yaw, and pitch *----------------------------------------------------------------*/ Loading @@ -317,6 +354,7 @@ ivas_error ivas_ism_metadata_enc( idx_angle1_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); idx_angle2_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); idx_radius_abs = usquant( hIsmMetaData->radius, &valQ, ISM_RADIUS_MIN, ISM_RADIUS_DELTA, 1 << ISM_RADIUS_NBITS ); encode_angle_indices( hBstr, &( hIsmMetaData->orientation_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_yaw[ch], &flag_abs_pitch[ch] ); encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); } Loading @@ -326,6 +364,12 @@ ivas_error ivas_ism_metadata_enc( { nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; } #ifdef FIX_387_ISM_MD_FEC /* Updates */ hIsmMeta[ch]->last_true_azimuth = hIsmMeta[ch]->azimuth; hIsmMeta[ch]->last_true_elevation = hIsmMeta[ch]->elevation; #endif } } Loading Loading @@ -462,6 +506,19 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; #ifdef FIX_387_ISM_MD_FEC if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { hIsmMeta[ch]->ism_md_fec_cnt_enc++; } else { hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; } hIsmMeta[ch]->ism_md_inc_diff_cnt++; hIsmMeta[ch]->ism_md_inc_diff_cnt = min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX ); #endif } for ( ch = 0; ch < nchan_transport; ch++ ) Loading Loading @@ -547,6 +604,13 @@ ivas_error ivas_ism_metadata_enc_create( st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f; st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f; #ifdef FIX_387_ISM_MD_FEC st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0.0f; st_ivas->hIsmMetaData[ch]->last_true_elevation = 0.0f; st_ivas->hIsmMetaData[ch]->ism_md_fec_cnt_enc = 0; st_ivas->hIsmMetaData[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX; #endif } if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) Loading Loading @@ -1032,6 +1096,11 @@ void ivas_ism_metadata_sid_enc( hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); } #ifdef FIX_387_ISM_MD_FEC hIsmMetaData->ism_md_fec_cnt_enc = 0; hIsmMeta[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX; #endif } } Loading Loading
lib_com/ivas_stat_com.h +5 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,11 @@ typedef struct 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 */ #ifdef FIX_387_ISM_MD_FEC int16_t ism_md_fec_cnt_enc; /* counter of continuous frames where MD are not transmitted */ int16_t ism_md_inc_diff_cnt; /* counter of continuous frames where MD are transmitted in inactive segments when MD significantly changes */ #endif } ISM_METADATA_FRAME, *ISM_METADATA_HANDLE; Loading
lib_com/options.h +2 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ /*#define DEBUG_MODE_TCX*/ /* output most important TCX core parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_DFT*/ /* output most important DFT stereo parameters to the subdirectory "res/" */ /*#define DEBUG_MODE_TD*/ /* output most important TD stereo parameters to the subdirectory "res/ */ //#define DEBUG_MODE_DIRAC /* output most important DIRAC parameters to the subdirectory "res/" */ /*#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/" */ Loading Loading @@ -149,6 +149,7 @@ #define SNS_MSVQ /* FhG: contribution 33 - MSVQ for SNS parameters at stereo mid bitrates */ #define FIX_379_GAININTP /* Eri: Adds a gain interpolation for directional/distance gain to handle abrupt changes in metadata (Non BE) */ #define FIX_387_ISM_MD_FEC /* VA: Issue 387: fix MD discontinuity in ISM FEC */ #define FIX_418_SID_BITRATE /* Eri: Issue 418: Using the correct bitrate for unified stereo SID */ #define PARAMMC_SHORT_ENC_MDFT /* FhG: Issue 410: complexity optimization for parametric Multichannel modes */ Loading
lib_enc/ivas_ism_metadata_enc.c +77 −8 Original line number Diff line number Diff line Loading @@ -56,6 +56,11 @@ #define ISM_MAX_RADIUS_DIFF_IDX ( ISM_RADIUS_NBITS - 1 /*zero*/ - 1 /*sign*/ ) #define ISM_FEC_MAX 10 #ifdef FIX_387_ISM_MD_FEC #define ISM_MD_FEC_DIFF 10 #define ISM_MD_INC_DIFF_CNT_MAX 6 #define ISM_MD_FEC_CNT_MAX 25 #endif #define INTER_OBJECT_PARAM_CHECK ( ( ISM_FEC_MAX / 2 ) - 2 ) /* note: constant must be less than (ISM_FEC_MAX / number of coded parameters) */ Loading Loading @@ -195,7 +200,6 @@ ivas_error ivas_ism_metadata_enc( push_wmops( "ism_meta_enc" ); /* initialization */ ism_metadata_flag_global = 0; set_s( nb_bits_metadata, 0, nchan_transport ); Loading @@ -218,6 +222,37 @@ ivas_error ivas_ism_metadata_enc( else if ( ism_mode == ISM_MODE_DISC ) { hIsmMeta[ch]->ism_metadata_flag = localVAD[ch] || hSCE[ch]->hCoreCoder[0]->lp_noise > 10; #ifdef FIX_387_ISM_MD_FEC /* in inactive frames, send MD 1) in ISM_MD_INC_DIFF_CNT_MAX consecutive frames when MD significantly change, 2) at least every ISM_MD_FEC_DIFF frames */ if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { if ( ( fabsf( hIsmMeta[ch]->azimuth - hIsmMeta[ch]->last_true_azimuth ) > ISM_MD_FEC_DIFF ) || ( fabsf( hIsmMeta[ch]->elevation - hIsmMeta[ch]->last_true_elevation ) > ISM_MD_FEC_DIFF ) ) { hIsmMeta[ch]->ism_metadata_flag = 1; hIsmMeta[ch]->ism_md_inc_diff_cnt = 0; } else if ( hIsmMeta[ch]->ism_md_inc_diff_cnt < ISM_MD_INC_DIFF_CNT_MAX ) { hIsmMeta[ch]->ism_metadata_flag = 1; if ( hIsmMeta[ch]->ism_md_inc_diff_cnt % 2 == 0 ) { hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; } else { hIsmMeta[ch]->position_angle.angle2_diff_cnt = ISM_FEC_MAX; } } else if ( hIsmMeta[ch]->ism_md_fec_cnt_enc == ISM_MD_FEC_CNT_MAX ) { hIsmMeta[ch]->ism_metadata_flag = 1; hIsmMeta[ch]->position_angle.angle1_diff_cnt = ISM_FEC_MAX; } } #endif } } Loading Loading @@ -307,7 +342,9 @@ ivas_error ivas_ism_metadata_enc( idx_angle1_abs = hParamIsm->azi_index[ch]; idx_angle2_abs = hParamIsm->ele_index[ch]; } encode_angle_indices( hBstr, &( hIsmMetaData->position_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_azimuth[ch], &flag_abs_elevation[ch] ); /*----------------------------------------------------------------* * Quantize and encode radius, yaw, and pitch *----------------------------------------------------------------*/ Loading @@ -317,6 +354,7 @@ ivas_error ivas_ism_metadata_enc( idx_angle1_abs = ism_quant_meta( hIsmMetaData->yaw, &valQ, ism_azimuth_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_AZIMUTH_NBITS ); idx_angle2_abs = ism_quant_meta( hIsmMetaData->pitch, &valQ, ism_elevation_borders, ISM_Q_STEP, ISM_Q_STEP_BORDER, 1 << ISM_ELEVATION_NBITS ); idx_radius_abs = usquant( hIsmMetaData->radius, &valQ, ISM_RADIUS_MIN, ISM_RADIUS_DELTA, 1 << ISM_RADIUS_NBITS ); encode_angle_indices( hBstr, &( hIsmMetaData->orientation_angle ), hIsmMetaData->last_ism_metadata_flag, hSCE[0]->hCoreCoder[0]->ini_frame, idx_angle1_abs, idx_angle2_abs, &flag_abs_yaw[ch], &flag_abs_pitch[ch] ); encode_radius( hBstr, &hIsmMetaData->last_radius_idx, &hIsmMetaData->radius_diff_cnt, hIsmMetaData->last_ism_metadata_flag, idx_radius_abs, &flag_abs_radius[ch] ); } Loading @@ -326,6 +364,12 @@ ivas_error ivas_ism_metadata_enc( { nb_bits_metadata[ch] = hBstr->nb_bits_tot - nb_bits_start; } #ifdef FIX_387_ISM_MD_FEC /* Updates */ hIsmMeta[ch]->last_true_azimuth = hIsmMeta[ch]->azimuth; hIsmMeta[ch]->last_true_elevation = hIsmMeta[ch]->elevation; #endif } } Loading Loading @@ -462,6 +506,19 @@ ivas_error ivas_ism_metadata_enc( for ( ch = 0; ch < nchan_ism; ch++ ) { hIsmMeta[ch]->last_ism_metadata_flag = hIsmMeta[ch]->ism_metadata_flag; #ifdef FIX_387_ISM_MD_FEC if ( hIsmMeta[ch]->ism_metadata_flag == 0 ) { hIsmMeta[ch]->ism_md_fec_cnt_enc++; } else { hIsmMeta[ch]->ism_md_fec_cnt_enc = 0; } hIsmMeta[ch]->ism_md_inc_diff_cnt++; hIsmMeta[ch]->ism_md_inc_diff_cnt = min( hIsmMeta[ch]->ism_md_inc_diff_cnt, ISM_MD_INC_DIFF_CNT_MAX ); #endif } for ( ch = 0; ch < nchan_transport; ch++ ) Loading Loading @@ -547,6 +604,13 @@ ivas_error ivas_ism_metadata_enc_create( st_ivas->hIsmMetaData[ch]->last_azimuth = 0.0f; st_ivas->hIsmMetaData[ch]->last_elevation = 0.0f; #ifdef FIX_387_ISM_MD_FEC st_ivas->hIsmMetaData[ch]->last_true_azimuth = 0.0f; st_ivas->hIsmMetaData[ch]->last_true_elevation = 0.0f; st_ivas->hIsmMetaData[ch]->ism_md_fec_cnt_enc = 0; st_ivas->hIsmMetaData[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX; #endif } if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) Loading Loading @@ -1032,6 +1096,11 @@ void ivas_ism_metadata_sid_enc( hIsmMetaData->position_angle.last_angle1_idx = idx_azimuth << ( ISM_AZIMUTH_NBITS - nBits_azimuth ); hIsmMetaData->position_angle.last_angle2_idx = idx_elevation << ( ISM_ELEVATION_NBITS - nBits_elevation ); } #ifdef FIX_387_ISM_MD_FEC hIsmMetaData->ism_md_fec_cnt_enc = 0; hIsmMeta[ch]->ism_md_inc_diff_cnt = ISM_MD_INC_DIFF_CNT_MAX; #endif } } Loading