Loading lib_com/bitstream.c +4 −0 Original line number Diff line number Diff line Loading @@ -951,7 +951,11 @@ ivas_error write_indices_ivas( ivas_total_brate = st_ivas->hSCE[0]->hCoreCoder[0]->total_brate; } #ifdef PARAM_ISM_DTX_CNG if ( i * FRAMES_PER_SEC != ivas_total_brate && i * FRAMES_PER_SEC != IVAS_SID_5k2 && i != 0 ) #else if ( i * FRAMES_PER_SEC != ivas_total_brate && i >= ACELP_11k60 / FRAMES_PER_SEC ) #endif { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Bitstream write size mismatch! Actual bitrate: %ld vs. Reference bitrate: %d\n", i * 50L, ivas_total_brate ); } Loading lib_com/ivas_cnst.h +9 −0 Original line number Diff line number Diff line Loading @@ -354,9 +354,18 @@ 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, #ifdef PARAM_ISM_DTX_CNG IND_ISM_SCE_ID_DTX = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, IND_ISM_NOISY_SPEECH_FLAG, IND_ISM_DTX_COH_SCA, #endif /* ------------- loop for objects -------------- */ #ifdef PARAM_ISM_DTX_CNG TAG_ISM_LOOP_START = IND_ISM_DTX_COH_SCA + MAX_NUM_OBJECTS, #else TAG_ISM_LOOP_START = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, #endif IND_ISM_AZIMUTH_DIFF_FLAG = TAG_ISM_LOOP_START, IND_ISM_AZIMUTH = TAG_ISM_LOOP_START, IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START, Loading lib_dec/ivas_ism_dtx_dec.c +6 −12 Original line number Diff line number Diff line Loading @@ -102,10 +102,8 @@ ivas_error ivas_ism_dtx_dec( int16_t *nb_bits_metadata /* o : number of metadata bits */ ) { int16_t nBits; int16_t ch, num_obj, num_obj_prev; int16_t ch, pos, num_obj, num_obj_prev; int32_t ivas_total_brate; DEC_CORE_HANDLE st0; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; Loading @@ -125,15 +123,16 @@ ivas_error ivas_ism_dtx_dec( num_obj_prev = st_ivas->nchan_transport; } st0 = st_ivas->hSCE[0]->hCoreCoder[0]; /* read number of objects */ if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { num_obj = 1; while ( get_next_indice( st0, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) 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 ) { num_obj++; ( num_obj )++; pos--; } if ( num_obj != num_obj_prev ) Loading Loading @@ -161,11 +160,6 @@ ivas_error ivas_ism_dtx_dec( /* Metadata decoding and dequantization */ ivas_param_ism_metadata_dtx_dec( st_ivas ); /* Since the SID bits are already read, nBits represent remaining bits */ nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; st0->bit_stream += nBits; st0->next_bit_pos = 0; for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; Loading lib_dec/ivas_ism_param_dec.c +30 −7 Original line number Diff line number Diff line Loading @@ -1452,6 +1452,8 @@ void ivas_param_ism_metadata_dtx_dec( ) { int16_t azi_idx, ele_idx, i; int16_t nb_bits_start, last_bit_pos, next_bit_pos_orig; uint16_t bstr_meta[IVAS_SID_5k2 / FRAMES_PER_SEC], *bstr_orig; DEC_CORE_HANDLE st0; PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ int16_t coh_idx; Loading @@ -1464,12 +1466,35 @@ void ivas_param_ism_metadata_dtx_dec( st0 = st_ivas->hSCE[0]->hCoreCoder[0]; hParamIsm = st_ivas->hDirAC->hParamIsm; /* read the noisy speech flag */ hParamIsm->flag_noisy_speech = get_next_indice( st0, 1 ); nb_bits_start = 0; last_bit_pos = (int16_t) ( ( st_ivas->hDecoderConfig->ivas_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 = st_ivas->hDecoderConfig->ivas_total_brate; /* needed for BER detection in get_next_indice() */ /* number of objects was already read in ivas_ism_get_dtx_dec() */ /* update the position in the bitstream */ st0->next_bit_pos += hParamIsm->num_obj; /* read sce id */ st_ivas->hISMDTX.sce_id_dtx = get_next_indice( st0, 1 ); /* read the noisy speech flag */ hParamIsm->flag_noisy_speech = get_next_indice( st0, 1 ); /* decode the coherence */ coh_idx = get_next_indice( st0, PARAM_ISM_DTX_COH_SCA_BITS ); st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = (float) ( coh_idx ) / (float) ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ); st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence; /* get the DOA'S */ for ( i = 0; i < hParamIsm->num_obj; i++ ) { Loading @@ -1480,11 +1505,9 @@ void ivas_param_ism_metadata_dtx_dec( ivas_param_ism_dec_dequantize_DOA_dtx( PARAM_ISM_DTX_AZI_BITS, PARAM_ISM_DTX_ELE_BITS, azi_idx, ele_idx, &( st_ivas->hDirAC->azimuth_values[i] ), &( st_ivas->hDirAC->elevation_values[i] ) ); } /* decode the coherence */ coh_idx = get_next_indice( st0, PARAM_ISM_DTX_COH_SCA_BITS ); st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = (float) ( coh_idx ) / (float) ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ); st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence; /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; #ifdef DEBUG_MODE_PARAM_ISM dbgwrite( &( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence ), sizeof( float ), 1, 1, "./res/ParamISM_coh_dec.dat" ); Loading lib_enc/ivas_ism_enc.c +1 −1 Original line number Diff line number Diff line Loading @@ -215,7 +215,7 @@ ivas_error ivas_ism_enc( { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); ivas_param_ism_metadata_dtx_enc( st->hBstr, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); } } else Loading Loading
lib_com/bitstream.c +4 −0 Original line number Diff line number Diff line Loading @@ -951,7 +951,11 @@ ivas_error write_indices_ivas( ivas_total_brate = st_ivas->hSCE[0]->hCoreCoder[0]->total_brate; } #ifdef PARAM_ISM_DTX_CNG if ( i * FRAMES_PER_SEC != ivas_total_brate && i * FRAMES_PER_SEC != IVAS_SID_5k2 && i != 0 ) #else if ( i * FRAMES_PER_SEC != ivas_total_brate && i >= ACELP_11k60 / FRAMES_PER_SEC ) #endif { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Bitstream write size mismatch! Actual bitrate: %ld vs. Reference bitrate: %d\n", i * 50L, ivas_total_brate ); } Loading
lib_com/ivas_cnst.h +9 −0 Original line number Diff line number Diff line Loading @@ -354,9 +354,18 @@ 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, #ifdef PARAM_ISM_DTX_CNG IND_ISM_SCE_ID_DTX = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, IND_ISM_NOISY_SPEECH_FLAG, IND_ISM_DTX_COH_SCA, #endif /* ------------- loop for objects -------------- */ #ifdef PARAM_ISM_DTX_CNG TAG_ISM_LOOP_START = IND_ISM_DTX_COH_SCA + MAX_NUM_OBJECTS, #else TAG_ISM_LOOP_START = IND_ISM_VAD_FLAG + MAX_NUM_OBJECTS, #endif IND_ISM_AZIMUTH_DIFF_FLAG = TAG_ISM_LOOP_START, IND_ISM_AZIMUTH = TAG_ISM_LOOP_START, IND_ISM_ELEVATION_DIFF_FLAG = TAG_ISM_LOOP_START, Loading
lib_dec/ivas_ism_dtx_dec.c +6 −12 Original line number Diff line number Diff line Loading @@ -102,10 +102,8 @@ ivas_error ivas_ism_dtx_dec( int16_t *nb_bits_metadata /* o : number of metadata bits */ ) { int16_t nBits; int16_t ch, num_obj, num_obj_prev; int16_t ch, pos, num_obj, num_obj_prev; int32_t ivas_total_brate; DEC_CORE_HANDLE st0; ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; Loading @@ -125,15 +123,16 @@ ivas_error ivas_ism_dtx_dec( num_obj_prev = st_ivas->nchan_transport; } st0 = st_ivas->hSCE[0]->hCoreCoder[0]; /* read number of objects */ if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) { num_obj = 1; while ( get_next_indice( st0, 1 ) == 1 && num_obj < MAX_NUM_OBJECTS ) 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 ) { num_obj++; ( num_obj )++; pos--; } if ( num_obj != num_obj_prev ) Loading Loading @@ -161,11 +160,6 @@ ivas_error ivas_ism_dtx_dec( /* Metadata decoding and dequantization */ ivas_param_ism_metadata_dtx_dec( st_ivas ); /* Since the SID bits are already read, nBits represent remaining bits */ nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; st0->bit_stream += nBits; st0->next_bit_pos = 0; for ( ch = 0; ch < st_ivas->nchan_transport; ch++ ) { nb_bits_metadata[ch] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; Loading
lib_dec/ivas_ism_param_dec.c +30 −7 Original line number Diff line number Diff line Loading @@ -1452,6 +1452,8 @@ void ivas_param_ism_metadata_dtx_dec( ) { int16_t azi_idx, ele_idx, i; int16_t nb_bits_start, last_bit_pos, next_bit_pos_orig; uint16_t bstr_meta[IVAS_SID_5k2 / FRAMES_PER_SEC], *bstr_orig; DEC_CORE_HANDLE st0; PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ int16_t coh_idx; Loading @@ -1464,12 +1466,35 @@ void ivas_param_ism_metadata_dtx_dec( st0 = st_ivas->hSCE[0]->hCoreCoder[0]; hParamIsm = st_ivas->hDirAC->hParamIsm; /* read the noisy speech flag */ hParamIsm->flag_noisy_speech = get_next_indice( st0, 1 ); nb_bits_start = 0; last_bit_pos = (int16_t) ( ( st_ivas->hDecoderConfig->ivas_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 = st_ivas->hDecoderConfig->ivas_total_brate; /* needed for BER detection in get_next_indice() */ /* number of objects was already read in ivas_ism_get_dtx_dec() */ /* update the position in the bitstream */ st0->next_bit_pos += hParamIsm->num_obj; /* read sce id */ st_ivas->hISMDTX.sce_id_dtx = get_next_indice( st0, 1 ); /* read the noisy speech flag */ hParamIsm->flag_noisy_speech = get_next_indice( st0, 1 ); /* decode the coherence */ coh_idx = get_next_indice( st0, PARAM_ISM_DTX_COH_SCA_BITS ); st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = (float) ( coh_idx ) / (float) ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ); st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence; /* get the DOA'S */ for ( i = 0; i < hParamIsm->num_obj; i++ ) { Loading @@ -1480,11 +1505,9 @@ void ivas_param_ism_metadata_dtx_dec( ivas_param_ism_dec_dequantize_DOA_dtx( PARAM_ISM_DTX_AZI_BITS, PARAM_ISM_DTX_ELE_BITS, azi_idx, ele_idx, &( st_ivas->hDirAC->azimuth_values[i] ), &( st_ivas->hDirAC->elevation_values[i] ) ); } /* decode the coherence */ coh_idx = get_next_indice( st0, PARAM_ISM_DTX_COH_SCA_BITS ); st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = (float) ( coh_idx ) / (float) ( ( 1 << PARAM_ISM_DTX_COH_SCA_BITS ) - 1 ); st_ivas->hSCE[1]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence; /* set the bitstream pointer to its original position */ st0->bit_stream = bstr_orig; st0->next_bit_pos = next_bit_pos_orig; #ifdef DEBUG_MODE_PARAM_ISM dbgwrite( &( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->coherence ), sizeof( float ), 1, 1, "./res/ParamISM_coh_dec.dat" ); Loading
lib_enc/ivas_ism_enc.c +1 −1 Original line number Diff line number Diff line Loading @@ -215,7 +215,7 @@ ivas_error ivas_ism_enc( { ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); ivas_param_ism_metadata_dtx_enc( st->hBstr, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); ivas_param_ism_metadata_dtx_enc( st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData, st_ivas->hIsmMetaData, st_ivas->hISMDTX, st_ivas->hDirAC->hParamIsm ); } } else Loading