Loading lib_com/ivas_prot.h +5 −3 Original line number Diff line number Diff line Loading @@ -977,9 +977,11 @@ int16_t ivas_ism_dtx_enc( int16_t *sid_flag /* o : indication of SID frame */ ); void ivas_param_ism_coh_estim_dtx_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t input_frame /* i : input frame length per channel */ 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 */ ); #endif Loading lib_enc/ivas_ism_dtx_enc.c +34 −25 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ ivas_error ivas_ism_dtx_open( set_f( hISMDTX->long_term_energy_stereo_dmx_enc[i], 0.0f, PARAM_ISM_HYS_BUF_SIZE ); } hISMDTX->coh = 0; set_f( hISMDTX->coh, 0.0f, MAX_NUM_OBJECTS ); st_ivas->hISMDTX = hISMDTX; Loading Loading @@ -283,47 +283,56 @@ void ivas_ism_get_sce_id_dtx( * *-------------------------------------------------------------------*/ void ivas_param_ism_coh_estim_dtx_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t input_frame /* i : input frame length per channel */ 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 */ ) { SCE_ENC_HANDLE hSCE; Encoder_State *st; Encoder_State *st, *st_id0; int16_t sce_id, i; float input[L_FRAME48k], acorr_ene[PARAM_ISM_MAX_DMX], xcorr_ene; float acorr_ene[PARAM_ISM_MAX_DMX], xcorr_ene; if ( nchan_transport == 1 ) { hISMDTX->coh[0] = 0.f; return; } /* Compute Coherence */ mvr2r( st_ivas->hSCE[0]->hCoreCoder[0]->input, input, input_frame ); acorr_ene[hISMDTX->sce_id_dtx] = 0.0f; st_id0 = hSCE[hISMDTX->sce_id_dtx]->hCoreCoder[0]; for ( sce_id = 1; sce_id < st_ivas->nchan_transport; sce_id++ ) for ( i = 0; i < input_frame; i++ ) { hSCE = st_ivas->hSCE[sce_id]; st = hSCE->hCoreCoder[0]; acorr_ene[hISMDTX->sce_id_dtx] += st_id0->input[i] * st_id0->input[i]; } for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) { if ( sce_id == hISMDTX->sce_id_dtx ) { hISMDTX->coh[sce_id] = 1.0f; continue; } st = hSCE[sce_id]->hCoreCoder[0]; acorr_ene[0] = 0.0f; acorr_ene[sce_id] = 0.0f; xcorr_ene = 0.0f; for ( i = 0; i < input_frame; i++ ) { acorr_ene[0] += input[i] * input[i]; acorr_ene[sce_id] += st->input[i] * st->input[i]; xcorr_ene += input[i] * st->input[i]; xcorr_ene += st_id0->input[i] * st->input[i]; } st_ivas->hISMDTX->coh = fabsf( xcorr_ene ) / ( (float) sqrt( ( acorr_ene[0] * acorr_ene[sce_id] ) + EPSILON ) ); hISMDTX->coh[sce_id] = fabsf( xcorr_ene ) / ( sqrtf( ( acorr_ene[hISMDTX->sce_id_dtx] * acorr_ene[sce_id] ) + EPSILON ) ); /* ensure values of coherence and energy ratio are between [0,1] */ if ( st_ivas->hISMDTX->coh < 0.f ) { st_ivas->hISMDTX->coh = 0.0f; } if ( st_ivas->hISMDTX->coh > 1.f ) { st_ivas->hISMDTX->coh = 1.0f; } /* ensure value of coherence is between [0,1] */ hISMDTX->coh[sce_id] = check_bounds( hISMDTX->coh[sce_id], 0.0f, 1.0f ); } return; Loading lib_enc/ivas_ism_enc.c +14 −10 Original line number Diff line number Diff line Loading @@ -182,7 +182,6 @@ 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 */ //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, &sid_flag ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) Loading @@ -190,17 +189,17 @@ ivas_error ivas_ism_enc( ivas_param_ism_compute_noisy_speech_flag( st_ivas ); } #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->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif if ( sid_flag ) { /* estimate coherence between objects */ //ivas_ism_coh_estim_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); ivas_param_ism_coh_estim_dtx_enc( st_ivas, input_frame ); ivas_ism_coh_estim_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); //ivas_param_ism_coh_estim_dtx_enc( st_ivas, input_frame ); } #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->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif } #endif Loading @@ -209,6 +208,12 @@ ivas_error ivas_ism_enc( * Metadata quantization and encoding *-----------------------------------------------------------------*/ #ifdef PARAM_ISM_DTX_CNG if ( dtx_flag ) { } else #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { #ifndef PARAM_ISM_DTX_CNG Loading Loading @@ -249,7 +254,6 @@ 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 ); } /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ Loading lib_enc/ivas_ism_metadata_enc.c +1 −7 Original line number Diff line number Diff line Loading @@ -184,13 +184,7 @@ ivas_error ivas_ism_metadata_enc( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); } #ifdef PARAM_ISM_DTX_CNG if ( ( ( ( num_obj == 1 ) && ( ism_mode == ISM_MODE_DISC ) ) || ( ( num_obj == 3 || num_obj == 4 ) && ( ism_mode == ISM_MODE_PARAM ) ) ) && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) ) #else 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 ) ) #endif 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 */ pop_wmops(); Loading lib_enc/ivas_ism_param_enc.c +1 −1 Original line number Diff line number Diff line Loading @@ -567,7 +567,7 @@ void ivas_param_ism_metadata_dtx_enc( } /* quantize and write coherence */ coh_idx = (int16_t) ( hISMDTX->coh * ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ) + 0.5f ); coh_idx = (int16_t) ( hISMDTX->coh[0] * ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ) + 0.5f ); assert( ( coh_idx >= 0 ) && ( coh_idx <= ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ) ) ); push_next_indice( hBstr, coh_idx, PARAM_ISM_DTX_COH_SCA_BITS ); Loading Loading
lib_com/ivas_prot.h +5 −3 Original line number Diff line number Diff line Loading @@ -977,9 +977,11 @@ int16_t ivas_ism_dtx_enc( int16_t *sid_flag /* o : indication of SID frame */ ); void ivas_param_ism_coh_estim_dtx_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t input_frame /* i : input frame length per channel */ 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 */ ); #endif Loading
lib_enc/ivas_ism_dtx_enc.c +34 −25 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ ivas_error ivas_ism_dtx_open( set_f( hISMDTX->long_term_energy_stereo_dmx_enc[i], 0.0f, PARAM_ISM_HYS_BUF_SIZE ); } hISMDTX->coh = 0; set_f( hISMDTX->coh, 0.0f, MAX_NUM_OBJECTS ); st_ivas->hISMDTX = hISMDTX; Loading Loading @@ -283,47 +283,56 @@ void ivas_ism_get_sce_id_dtx( * *-------------------------------------------------------------------*/ void ivas_param_ism_coh_estim_dtx_enc( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const int16_t input_frame /* i : input frame length per channel */ 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 */ ) { SCE_ENC_HANDLE hSCE; Encoder_State *st; Encoder_State *st, *st_id0; int16_t sce_id, i; float input[L_FRAME48k], acorr_ene[PARAM_ISM_MAX_DMX], xcorr_ene; float acorr_ene[PARAM_ISM_MAX_DMX], xcorr_ene; if ( nchan_transport == 1 ) { hISMDTX->coh[0] = 0.f; return; } /* Compute Coherence */ mvr2r( st_ivas->hSCE[0]->hCoreCoder[0]->input, input, input_frame ); acorr_ene[hISMDTX->sce_id_dtx] = 0.0f; st_id0 = hSCE[hISMDTX->sce_id_dtx]->hCoreCoder[0]; for ( sce_id = 1; sce_id < st_ivas->nchan_transport; sce_id++ ) for ( i = 0; i < input_frame; i++ ) { hSCE = st_ivas->hSCE[sce_id]; st = hSCE->hCoreCoder[0]; acorr_ene[hISMDTX->sce_id_dtx] += st_id0->input[i] * st_id0->input[i]; } for ( sce_id = 0; sce_id < nchan_transport; sce_id++ ) { if ( sce_id == hISMDTX->sce_id_dtx ) { hISMDTX->coh[sce_id] = 1.0f; continue; } st = hSCE[sce_id]->hCoreCoder[0]; acorr_ene[0] = 0.0f; acorr_ene[sce_id] = 0.0f; xcorr_ene = 0.0f; for ( i = 0; i < input_frame; i++ ) { acorr_ene[0] += input[i] * input[i]; acorr_ene[sce_id] += st->input[i] * st->input[i]; xcorr_ene += input[i] * st->input[i]; xcorr_ene += st_id0->input[i] * st->input[i]; } st_ivas->hISMDTX->coh = fabsf( xcorr_ene ) / ( (float) sqrt( ( acorr_ene[0] * acorr_ene[sce_id] ) + EPSILON ) ); hISMDTX->coh[sce_id] = fabsf( xcorr_ene ) / ( sqrtf( ( acorr_ene[hISMDTX->sce_id_dtx] * acorr_ene[sce_id] ) + EPSILON ) ); /* ensure values of coherence and energy ratio are between [0,1] */ if ( st_ivas->hISMDTX->coh < 0.f ) { st_ivas->hISMDTX->coh = 0.0f; } if ( st_ivas->hISMDTX->coh > 1.f ) { st_ivas->hISMDTX->coh = 1.0f; } /* ensure value of coherence is between [0,1] */ hISMDTX->coh[sce_id] = check_bounds( hISMDTX->coh[sce_id], 0.0f, 1.0f ); } return; Loading
lib_enc/ivas_ism_enc.c +14 −10 Original line number Diff line number Diff line Loading @@ -182,7 +182,6 @@ 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 */ //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, &sid_flag ); if ( st_ivas->ism_mode == ISM_MODE_PARAM ) Loading @@ -190,17 +189,17 @@ ivas_error ivas_ism_enc( ivas_param_ism_compute_noisy_speech_flag( st_ivas ); } #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->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif if ( sid_flag ) { /* estimate coherence between objects */ //ivas_ism_coh_estim_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); ivas_param_ism_coh_estim_dtx_enc( st_ivas, input_frame ); ivas_ism_coh_estim_dtx_enc( st_ivas->hISMDTX, st_ivas->hSCE, st_ivas->nchan_transport, input_frame ); //ivas_param_ism_coh_estim_dtx_enc( st_ivas, input_frame ); } #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->hISMDTX->dtx_flag ), sizeof( int16_t ), 1, 1, "./res/ParamISM_DTX_CNG_flag_enc.dat" ); #endif } #endif Loading @@ -209,6 +208,12 @@ ivas_error ivas_ism_enc( * Metadata quantization and encoding *-----------------------------------------------------------------*/ #ifdef PARAM_ISM_DTX_CNG if ( dtx_flag ) { } else #endif if ( st_ivas->ism_mode == ISM_MODE_PARAM ) { #ifndef PARAM_ISM_DTX_CNG Loading Loading @@ -249,7 +254,6 @@ 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 ); } /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ Loading
lib_enc/ivas_ism_metadata_enc.c +1 −7 Original line number Diff line number Diff line Loading @@ -184,13 +184,7 @@ ivas_error ivas_ism_metadata_enc( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: incorrect ISM mode" ); } #ifdef PARAM_ISM_DTX_CNG if ( ( ( ( num_obj == 1 ) && ( ism_mode == ISM_MODE_DISC ) ) || ( ( num_obj == 3 || num_obj == 4 ) && ( ism_mode == ISM_MODE_PARAM ) ) ) && ( hSCE[0]->hCoreCoder[0]->core_brate == SID_2k40 || hSCE[0]->hCoreCoder[0]->core_brate == FRAME_NO_DATA ) ) #else 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 ) ) #endif 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 */ pop_wmops(); Loading
lib_enc/ivas_ism_param_enc.c +1 −1 Original line number Diff line number Diff line Loading @@ -567,7 +567,7 @@ void ivas_param_ism_metadata_dtx_enc( } /* quantize and write coherence */ coh_idx = (int16_t) ( hISMDTX->coh * ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ) + 0.5f ); coh_idx = (int16_t) ( hISMDTX->coh[0] * ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ) + 0.5f ); assert( ( coh_idx >= 0 ) && ( coh_idx <= ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ) ) ); push_next_indice( hBstr, coh_idx, PARAM_ISM_DTX_COH_SCA_BITS ); Loading