From 5d1c2b1c1706aaed8cc43bd85e1bc92a907ac963 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Thu, 13 Mar 2025 10:27:26 +0530 Subject: [PATCH] Fix for 3GPP issue 1343: read_indices_fx() variants Link #1343 --- lib_com/bitstream.c | 196 ++++++++----- lib_com/bitstream_fx.c | 357 +---------------------- lib_com/prot_fx.h | 24 +- lib_dec/lib_dec_fx.c | 2 +- lib_enc/acelp_core_switch_enc_fx.c | 13 - lib_enc/dtx_fx.c | 8 +- lib_enc/enc_ppp_fx.c | 12 +- lib_enc/eval_pit_contr_fx.c | 8 - lib_enc/fd_cng_enc_fx.c | 4 +- lib_enc/init_enc_fx.c | 15 - lib_enc/ivas_core_enc_fx.c | 2 +- lib_enc/ivas_corecoder_enc_reconfig_fx.c | 8 +- lib_enc/ivas_init_enc_fx.c | 2 +- lib_enc/ivas_ism_dtx_enc_fx.c | 2 +- lib_enc/ivas_ism_metadata_enc_fx.c | 2 +- lib_enc/ivas_omasa_enc_fx.c | 4 +- lib_enc/ivas_qmetadata_enc_fx.c | 2 +- lib_enc/ivas_sce_enc_fx.c | 2 +- lib_enc/ivas_spar_md_enc_fx.c | 2 +- lib_enc/ivas_stereo_td_enc_fx.c | 2 +- lib_enc/tcx_utils_enc_fx.c | 11 - 21 files changed, 149 insertions(+), 529 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 90b49f8c2..79a659eb0 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1318,33 +1318,6 @@ UWord16 get_indice_st( } #define WMC_TOOL_SKIP -/*-------------------------------------------------------------------* - * reset_indices_enc() - * - * Reset the buffer of encoder indices - *-------------------------------------------------------------------*/ - -void reset_indices_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const Word16 max_num_indices /* i : max number of indices */ -) -{ - Word16 i; - - hBstr->nb_bits_tot = 0; - move16(); - hBstr->nb_ind_tot = 0; - move16(); - - FOR( i = 0; i < max_num_indices; i++ ) - { - hBstr->ind_list[i].nb_bits = -1; - move16(); - } - - return; -} - /*-------------------------------------------------------------------* * reset_indices_dec() * @@ -1533,21 +1506,21 @@ static ivas_error write_indices_element_fx( { IF( st_ivas->hSCE[element_id]->hMetaData != NULL ) { - reset_indices_enc( st_ivas->hSCE[element_id]->hMetaData, st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot ); + reset_indices_enc_fx( st_ivas->hSCE[element_id]->hMetaData, st_ivas->hSCE[element_id]->hMetaData->nb_ind_tot ); } - reset_indices_enc( sts[0]->hBstr, sts[0]->hBstr->nb_ind_tot ); + reset_indices_enc_fx( sts[0]->hBstr, sts[0]->hBstr->nb_ind_tot ); } ELSE { IF( st_ivas->hCPE[element_id]->hMetaData != NULL ) { - reset_indices_enc( st_ivas->hCPE[element_id]->hMetaData, st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot ); + reset_indices_enc_fx( st_ivas->hCPE[element_id]->hMetaData, st_ivas->hCPE[element_id]->hMetaData->nb_ind_tot ); } FOR( n = 0; n < n_channels; n++ ) { - reset_indices_enc( sts[n]->hBstr, sts[n]->hBstr->nb_ind_tot ); + reset_indices_enc_fx( sts[n]->hBstr, sts[n]->hBstr->nb_ind_tot ); } } @@ -2059,67 +2032,84 @@ void ivas_set_bitstream_pointers( *-------------------------------------------------------------------*/ /*! r: 1 = reading OK, 0 = problem */ -ivas_error read_indices( +ivas_error read_indices_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t bit_stream[], /* i : bitstream buffer */ + UWord16 bit_stream[], /* i : bitstream buffer */ UWord16 num_bits, /* i : number of bits in bitstream */ - int16_t *prev_ft_speech, - int16_t *CNG, - int16_t bfi /* i : bad frame indicator */ + Word16 *prev_ft_speech, + Word16 *CNG, + Word16 bfi /* i : bad frame indicator */ ) { - int16_t k; + Word16 k; Decoder_State **sts; - int32_t total_brate = 0; - int16_t curr_ft_good_sp, curr_ft_bad_sp; - int16_t g192_sid_first, sid_upd_bad, sid_update; - int16_t speech_bad, speech_lost; - int16_t n; + Word32 total_brate = 0; + move32(); + Word16 curr_ft_good_sp, curr_ft_bad_sp; + Word16 g192_sid_first, sid_upd_bad, sid_update; + Word16 speech_bad, speech_lost; + Word16 n; ivas_error error; error = IVAS_ERR_OK; + move32(); st_ivas->BER_detect = 0; + move16(); st_ivas->num_bits = num_bits; + move16(); sts = reset_elements( st_ivas ); st_ivas->bfi = bfi; + move16(); /* convert the frame length to total bitrate */ - total_brate = (int32_t) ( num_bits * FRAMES_PER_SEC ); + total_brate = imult3216( num_bits, FRAMES_PER_SEC ); + move32(); /* verify that a valid num bits value is present in the G.192 file */ /* only AMRWB, EVS or IVAS bitrates or 0(NO DATA) are allowed in G.192 file frame reading */ - if ( st_ivas->ivas_format != MONO_FORMAT ) + IF( NE_32( st_ivas->ivas_format, MONO_FORMAT ) ) { k = 0; - while ( k < SIZE_IVAS_BRATE_TBL && total_brate != ivas_brate_tbl[k] ) + move16(); + + test(); + WHILE( LT_16( k, SIZE_IVAS_BRATE_TBL ) && NE_32( total_brate, ivas_brate_tbl[k] ) ) { - k++; + k = add( k, 1 ); } - if ( st_ivas->ivas_format == ISM_FORMAT && ( k < SIZE_IVAS_BRATE_TBL || total_brate <= SID_2k40 ) ) + test(); + test(); + test(); + test(); + IF( EQ_32( st_ivas->ivas_format, ISM_FORMAT ) && ( LT_16( k, SIZE_IVAS_BRATE_TBL ) || LE_32( total_brate, SID_2k40 ) ) ) { st_ivas->element_mode_init = IVAS_SCE; + move16(); } - else if ( ( st_ivas->ivas_format == SBA_FORMAT || st_ivas->ivas_format == MASA_FORMAT ) && ( total_brate <= SID_2k40 ) ) + ELSE IF( ( EQ_32( st_ivas->ivas_format, SBA_FORMAT ) || EQ_32( st_ivas->ivas_format, MASA_FORMAT ) ) && LE_32( total_brate, SID_2k40 ) ) { st_ivas->element_mode_init = IVAS_SCE; + move16(); } - else if ( k == SIZE_IVAS_BRATE_TBL ) + ELSE IF( EQ_16( k, SIZE_IVAS_BRATE_TBL ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) in the G.192 frame ! Exiting ! \n", total_brate ); } - else + ELSE { st_ivas->element_mode_init = -1; + move16(); } } - else /* AMRWB or EVS */ + ELSE /* AMRWB or EVS */ { st_ivas->element_mode_init = EVS_MONO; + move16(); - if ( rate2EVSmode_float( total_brate, NULL ) < 0 ) /* negative value means that a valid rate was not found */ + IF( rate2EVSmode_float( total_brate, NULL ) < 0 ) /* negative value means that a valid rate was not found */ { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) in the G.192 frame ! Exiting ! \n", total_brate ); } @@ -2129,47 +2119,58 @@ ivas_error read_indices( /* handle SID_FIRST, SID_BAD, SPEECH_LOST, NO_DATA as properly as possible for the ITU-T G.192 format */ /* (total_brate, bfi , st_CNG) = rx_handler(received frame type, [previous frame type], past CNG state, past core) */ curr_ft_good_sp = 0; + move16(); curr_ft_bad_sp = 0; + move16(); - if ( is_DTXrate( total_brate ) == 0 ) + IF( is_DTXrate( total_brate ) == 0 ) { - if ( st_ivas->bfi == 0 ) + IF( st_ivas->bfi == 0 ) { curr_ft_good_sp = 1; + move16(); } - else + ELSE { curr_ft_bad_sp = 1; + move16(); } } sid_update = 0; + move16(); sid_upd_bad = 0; - if ( is_SIDrate( total_brate ) == 1 ) + move16(); + IF( EQ_16( is_SIDrate( total_brate ), 1 ) ) { - if ( st_ivas->bfi == 0 ) + IF( st_ivas->bfi == 0 ) { sid_update = 1; + move16(); } - else + ELSE { sid_upd_bad = 1; /* this frame type may happen in ETSI/3GPP CS cases, a corrupt SID frames */ + move16(); } } /* all zero indices/bits iSP AMRWB SID_update results in a valid LP filter with extremely high LP-filter-gain */ /* all zero indices/bits may be a result of CS bit errors and/or erroneously injected by gateways or by a bad dejitter handlers */ - if ( total_brate == SID_1k75 && sid_update == 1 ) + test(); + IF( EQ_32( total_brate, SID_1k75 ) && EQ_16( sid_update, 1 ) ) { /* valid sid_update received, check for very risky but formally valid content */ - int16_t sum = 0; - for ( k = 0; k < num_bits; ++k ) + Word16 sum = 0; + move16(); + FOR( k = 0; k < num_bits; ++k ) { - sum += ( bit_stream[k] == 1 ); /* check of 35 zeroes */ + sum = add( sum, extract_l( EQ_32( bit_stream[k], 1 ) ) ); /* check of 35 zeroes */ } if ( sum == 0 ) { /* all zeros */ sid_upd_bad = 1; /* initial signal as corrupt (BER likely) */ + move16(); } } @@ -2180,14 +2181,22 @@ ivas_error read_indices( Here we inhibit use of the SID-length info, even though it is available in the G.192 file format after STL/EID-XOR . */ - if ( sid_upd_bad ) + IF( sid_upd_bad ) { sid_upd_bad = 0; + move16(); total_brate = FRAME_NO_DATA; /* treat SID_BAD as a stolen signaling frame --> SPEECH LOST */ + move32(); } g192_sid_first = 0; - if ( st_ivas->ivas_format == MONO_FORMAT && sts[0]->core == AMR_WB_CORE && *prev_ft_speech && total_brate == FRAME_NO_DATA && st_ivas->bfi == 0 ) + move16(); + + test(); + test(); + test(); + test(); + if ( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) && EQ_16( sts[0]->core, AMR_WB_CORE ) && *prev_ft_speech && total_brate == FRAME_NO_DATA && st_ivas->bfi == 0 ) { g192_sid_first = 1; /* SID_FIRST detected for previous AMRWB/AMRWBIO active frames only */ /* It is not possible to perfectly simulate rate switching conditions EVS->AMRWBIO where: @@ -2195,104 +2204,135 @@ ivas_error read_indices( and a good length 0 "SID_FIRST"(NO_DATA) frame is sent in AMRWBIO, due to the one frame state memory in the AMRWB legacy G.192 SID_FIRST encoding */ + move16(); } speech_bad = 0; + move16(); + + test(); if ( st_ivas->bfi != 0 && ( is_DTXrate( total_brate ) == 0 ) ) { speech_bad = 1; /* initial ft assumption, CNG_state decides what to do */ + move16(); } speech_lost = 0; + move16(); + + test(); if ( total_brate == FRAME_NO_DATA && st_ivas->bfi != 0 ) /* unsent NO_DATA or stolen NO_DATA/signaling frame */ { speech_lost = 1; /* initial ft assumption, CNG_state decides what to do */ + move16(); } /* Do not allow decoder to enter CNG-synthesis for any instantly received GOOD+LENGTH==0 frame as this frame was never transmitted, one can not know it is good and has a a length of zero ) */ - if ( *CNG != 0 ) + IF( *CNG != 0 ) { /* We were in CNG synthesis */ if ( curr_ft_good_sp != 0 ) { /* only a good speech frame makes you leave CNG synthesis */ *CNG = 0; + move16(); } } - else + ELSE { /* We were in SPEECH synthesis */ /* only a received/detected SID frame can make the decoder enter into CNG synthsis */ + test(); + test(); if ( g192_sid_first || sid_update || sid_upd_bad ) { *CNG = 1; + move16(); } } /* set bfi, total_brate pair for proper decoding */ /* handle the G.192 _simulated_ untransmitted NO_DATA frame, setting for decoder SPEECH synthesis */ + test(); + test(); if ( *CNG == 0 && total_brate == FRAME_NO_DATA && st_ivas->bfi == 0 ) { st_ivas->bfi = 1; /* SPEECH PLC code will now become active as in a real system */ /* total_brate= 0 */ + move16(); } /* handle bad/lost speech frame(and CS bad SID frame) in the decoders CNG synthesis settings pair (total_brate, bfi) */ - if ( ( - bfi != FRAMEMODE_FUTURE && - ( *CNG != 0 ) && ( ( speech_bad != 0 ) || ( speech_lost != 0 ) ) ) || /* SP_BAD or SPEECH_LOST) --> stay in CNG */ - ( sid_upd_bad != 0 ) ) /* SID_UPD_BAD --> start CNG */ + test(); + test(); + test(); + test(); + IF( ( + NE_16( bfi, FRAMEMODE_FUTURE ) && + ( *CNG != 0 ) && ( ( speech_bad != 0 ) || ( speech_lost != 0 ) ) ) || /* SP_BAD or SPEECH_LOST) --> stay in CNG */ + ( sid_upd_bad != 0 ) ) /* SID_UPD_BAD --> start CNG */ { st_ivas->bfi = 0; /* bfi=0 needed to activate CNG code */ + move16(); total_brate = FRAME_NO_DATA; + move32(); } /* update for next frame's G.192 file format's odd SID_FIRST detection (primarily for AMRWBIO) */ + test(); *prev_ft_speech = ( ( curr_ft_good_sp != 0 ) || ( curr_ft_bad_sp != 0 ) ); + move16(); /* st->total brate= total_brate; updated in a good frame below */ - for ( k = 0; k < st_ivas->nCPE; k++ ) + FOR( k = 0; k < st_ivas->nCPE; k++ ) { sts = st_ivas->hCPE[k]->hCoreCoder; - for ( n = 0; n < CPE_CHANNELS; n++ ) + FOR( n = 0; n < CPE_CHANNELS; n++ ) { sts[n]->bfi = st_ivas->bfi; + move16(); } } - for ( k = 0; k < st_ivas->nSCE; k++ ) + FOR( k = 0; k < st_ivas->nSCE; k++ ) { sts = st_ivas->hSCE[k]->hCoreCoder; sts[0]->bfi = st_ivas->bfi; + move16(); } - if ( st_ivas->bfi == 0 ) + IF( st_ivas->bfi == 0 ) { /* select Mode 1 or Mode 2 */ - if ( st_ivas->ivas_format == MONO_FORMAT ) /* EVS mono */ + IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) /* EVS mono */ { decoder_selectCodec( sts[0], total_brate, bit_stream[0] ); st_ivas->hDecoderConfig->Opt_AMR_WB = sts[0]->Opt_AMR_WB; + move16(); } - else /* IVAS */ + ELSE /* IVAS */ { st_ivas->codec_mode = MODE1; + move16(); st_ivas->hDecoderConfig->Opt_AMR_WB = 0; + move16(); } } /* GOOD frame */ - if ( st_ivas->bfi == 0 || st_ivas->bfi == FRAMEMODE_FUTURE ) + test(); + if ( st_ivas->bfi == 0 || EQ_16( st_ivas->bfi, FRAMEMODE_FUTURE ) ) { /* GOOD frame - convert ITU-T G.192 words to short values */ st_ivas->hDecoderConfig->ivas_total_brate = total_brate; + move32(); } st_ivas->bit_stream = bit_stream; - if ( st_ivas->ivas_format == MONO_FORMAT ) + IF( EQ_32( st_ivas->ivas_format, MONO_FORMAT ) ) { ivas_set_bitstream_pointers( st_ivas ); } diff --git a/lib_com/bitstream_fx.c b/lib_com/bitstream_fx.c index 6163fc4ff..d4938f399 100644 --- a/lib_com/bitstream_fx.c +++ b/lib_com/bitstream_fx.c @@ -543,7 +543,8 @@ UWord16 get_indice_1_fx( /* o : value of the indice */ *-------------------------------------------------------------------*/ void reset_indices_enc_fx( - BSTR_ENC_HANDLE hBstr /* i/o: encoder state structure */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ + const Word16 max_num_indices /* i : max number of indices */ ) { Word16 i; @@ -559,7 +560,7 @@ void reset_indices_enc_fx( hBstr->last_ind_fx = -1; move16(); - FOR( i = 0; i < MAX_NUM_INDICES; i++ ) + FOR( i = 0; i < max_num_indices; i++ ) { hBstr->ind_list[i].nb_bits = -1; move16(); @@ -1547,358 +1548,6 @@ Word32 BIT_ALLOC_IDX_16KHZ_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 t return L_temp; } - -/*-------------------------------------------------------------------* - * read_indices_fx() - * - * Read indices from an ITU-T G.192 bitstream to the buffer - * Simulate packet losses by inserting frame erasures - *-------------------------------------------------------------------*/ - -Word16 read_indices_fx( /* o : 1 = reading OK, 0 = problem */ - Decoder_State *st, /* i/o: decoder state structure */ - FILE *file, /* i : bitstream file */ - Word16 rew_flag /* i : rewind flag (rewind file after reading)*/ -) -{ - Word16 k; - UWord16 utmp, stream[2 + MAX_BITS_PER_FRAME], *pt_stream, *bit_stream_ptr; - Word16 num_bits; - Word32 total_brate; - Word32 L_tmp; - Word16 curr_ft_good_sp, curr_ft_bad_sp; - Word16 g192_sid_first, sid_upd_bad, sid_update; - Word16 speech_bad, speech_lost; - Word16 num_bits_read; - - st->bfi = 0; - move16(); - st->BER_detect = 0; - move16(); - st->mdct_sw_enable = 0; - move16(); - st->mdct_sw = 0; - move16(); - reset_indices_dec_fx( st ); - - /* read the Sync Header field from the bitstream */ - /* in case rew_flag is set, read until first good frame is encountered */ - test(); - test(); - DO - { - /* read the Sync header */ - IF( NE_32( fread( &utmp, sizeof( unsigned short ), 1, file ), 1 ) ) - { - IF( ferror( file ) ) - { - /* error during reading */ - fprintf( stderr, "\nError reading the bitstream !" ); - exit( -1 ); - } - ELSE - { - /* end of file reached */ - return 0; - } - } - - /* set the BFI indicator according the value of Sync Header */ - IF( EQ_16( utmp, SYNC_BAD_FRAME ) ) - { - st->bfi = 1; - move16(); - } - ELSE - { - st->bfi = 0; - move16(); - } - - /* read the Frame Length field from the bitstream */ - IF( NE_32( fread( &num_bits, sizeof( unsigned short ), 1, file ), 1 ) ) - { - IF( ferror( file ) ) - { - /* error during reading */ - fprintf( stderr, "\nError reading the bitstream !" ); - exit( -1 ); - } - ELSE - { - /* end of file reached */ - return 0; - } - } - /* convert the frame length to total bitrate */ - total_brate = L_mult0( num_bits, 50 ); - - /* read ITU-T G.192 serial stream of indices from file to the local buffer */ - /* Validate that the G.192 length is within the defined bit rate range - to not allow writing past the end of the "stream" buffer */ - IF( GT_16( num_bits, MAX_BITS_PER_FRAME ) ) - { - fprintf( stderr, "\nError, too large G.192 frame (size(%d))! Exiting ! \n", num_bits ); - exit( -1 ); - } - - /* verify that a valid num bits value is present in the G.192 file */ - /* only AMRWB or EVS bit rates or 0(NO DATA) are allowed in G.192 file frame reading */ - IF( rate2EVSmode( total_brate, NULL ) < 0 ) /* negative value means that a valid rate was not found */ - { - fprintf( stderr, "\nError, illegal bit rate (%d) in the G.192 frame ! Exiting ! \n", total_brate ); - exit( -1 ); - } - pt_stream = stream; - - num_bits_read = (Word16) fread( pt_stream, sizeof( unsigned short ), num_bits, file ); - move16(); - - IF( NE_16( num_bits_read, num_bits ) ) - { - fprintf( stderr, "\nError, invalid number of bits read ! Exiting ! \n" ); - exit( -1 ); - } - } - WHILE( rew_flag && ( st->bfi || ( total_brate < 2800 ) ) ); - - /* G.192 RX DTX handler*/ - IF( !rew_flag ) - { - /* handle SID_FIRST, SID_BAD, SPEECH_LOST, NO_DATA as properly as possible for the ITU-T G.192 format */ - - /* (total_brate, bfi , st_CNG) = rx_handler(received frame type, [previous frame type], past CNG state, past core) */ - curr_ft_good_sp = 0; - move16(); - curr_ft_bad_sp = 0; - move16(); - - IF( GT_32( total_brate, SID_2k40 ) ) - { - IF( st->bfi == 0 ) - { - curr_ft_good_sp = 1; - move16(); - } - ELSE - { - curr_ft_bad_sp = 1; - move16(); - } - } - sid_update = 0; - move16(); - sid_upd_bad = 0; - move16(); - - test(); - IF( total_brate == SID_1k75 || total_brate == SID_2k40 ) - { - IF( st->bfi == 0 ) - { - sid_update = 1; - move16(); - } - ELSE - { - sid_upd_bad = 1; /* may happen in CS , corrupt but detected sid frame */ - move16(); - } - } - - /* all zero indeces/bits iSP AMRWB SID_update results in a valid LP filter with extremely high LP-filter-gain */ - /* all zero indeces/bits may be a result of CS bit errors and/or erroneously injected by gateways or by a bad dejitter handlers */ - test(); - IF( EQ_32( total_brate, SID_1k75 ) && EQ_16( sid_update, 1 ) ) - { - /* valid sid_update received, check for very risky but formally valid content */ - Word16 sum = 0; - move16(); - FOR( k = 0; k < num_bits; ++k ) - { - sum = add( sum, extract_l( EQ_16( pt_stream[k], G192_BIN1 ) ) ); /* check of 35 zeroes, 35 ones */ - } - if ( sum == 0 ) - { /* all zeros */ - sid_upd_bad = 1; /* initial signal as corrupt (BER likley) */ - move16(); - } - } - - /* AMRWB 26.173 G.192 file reader (read_serial) does not declare/use SID_BAD ft, - it declares every bad synch marked frame initially as a lost_speech frame, - and then the RXDTX handler CNG state decides the decoding mode CNG/SPEECH. - While In the AMRWB ETSI/3GPP format eid a CRC error in a detected SID_UPDATE frame triggers SID_UPD_BAD. - - Here we inhibit use of the SID-length info, even though it is available in the G.192 file format after STL/EID-XOR . - */ - IF( sid_upd_bad ) - { - sid_upd_bad = 0; - move16(); - total_brate = FRAME_NO_DATA; /* treat SID_BAD as a stolen signaling frame --> SPEECH LOST */ - move32(); - } - - g192_sid_first = 0; - move16(); - - test(); - test(); - test(); - if ( EQ_16( st->core, AMR_WB_CORE ) && st->prev_ft_speech_fx && total_brate == FRAME_NO_DATA && st->bfi == 0 ) - { - g192_sid_first = 1; /* SID_FIRST detected for previous AMRWB/AMRWBIO active frames only */ - /* - It is not possible to perfectly simulate rate switching conditions EVS->AMRWBIO where: - the very first SID_FIRST detection is based on a past EVS active frame - and a good length 0 "SID_FIRST"(NO_DATA) frame is sent in AMRWBIO, - , due to the one frame state memory in the AMRWB legacy G.192 SID_FIRST encoding - */ - move16(); - } - - speech_bad = 0; - move16(); - - test(); - if ( GT_32( total_brate, SID_2k40 ) && st->bfi != 0 ) /* CS-type of CRC failure frame */ - { - speech_bad = 1; /* initial assumption, CNG_state decides what to do */ - move16(); - } - - speech_lost = 0; - move16(); - - test(); - if ( total_brate == 0 && st->bfi != 0 ) /* unsent NO_DATA or stolen NO_DATA/signaling frame */ - { - speech_lost = 1; /* initial assumption, CNG_state decides what to do */ - move16(); - } - - /* Do not allow decoder to enter CNG-synthesis for any instantly received GOOD+LENGTH==0 frame - as this frame was never transmitted, one can not know it is good and has a a length of zero ) */ - - IF( st->CNG_fx != 0 ) - { - /* We were in CNG synthesis */ - if ( curr_ft_good_sp != 0 ) - { - /* only a good speech frame makes you leave CNG synthesis */ - st->CNG_fx = 0; - move16(); - } - } - ELSE - { - /* We were in SPEECH synthesis */ - /* only a received SID frame can make the decoder enter into CNG synthsis */ - test(); - test(); - if ( g192_sid_first || sid_update || sid_upd_bad ) - { - st->CNG_fx = 1; - move16(); - } - } - - /* handle the g.192 _simulated_ untransmitted frame, setting for decoder SPEECH synthesis */ - test(); - test(); - if ( ( st->CNG_fx == 0 ) && ( total_brate == 0 && st->bfi == 0 ) ) - { - st->bfi = 1; - move16(); /* SPEECH PLC code will now become active as in a real system */ - /* total_brate= 0 */ - } - - /* handle bad speech frame(and bad sid frame) in the decoders CNG synthesis settings pair (total_brate, bfi) */ - test(); - test(); - test(); - IF( ( ( st->CNG_fx != 0 ) && ( ( speech_bad != 0 ) || ( speech_lost != 0 ) ) ) || /* SP_BAD or SPEECH_LOST) --> stay in CNG */ - ( sid_upd_bad != 0 ) ) /* SID_UPD_BAD --> start CNG */ - { - st->bfi = 0; - move16(); - total_brate = 0; - move32(); - } - /* update for next frame's G.192 file format's SID_FIRST detection (primarily for AMRWBIO) */ - test(); - st->prev_ft_speech_fx = ( ( curr_ft_good_sp != 0 ) || ( curr_ft_bad_sp != 0 ) ); - move16(); - - /* st->total brate= total_brate ; updated in a good frame below */ - } /* rew_flag */ - - /* get total bit-rate */ -#ifdef DEBUGGING - st->bfi |= file_read_FECpattern(); -#endif - test(); - IF( st->bfi == 0 && !rew_flag ) - { - /* select MODE1 or MODE2 */ - decoder_selectCodec( st, total_brate, *pt_stream ); - } - - Mpy_32_16_ss( total_brate, 5243, &L_tmp, &utmp ); /* 5243 is 1/50 in Q18. (0+18-15=3) */ - st->total_num_bits = extract_l( L_shr( L_tmp, 3 ) ); /* Q0 */ - move16(); - - /* in case rew_flag is set, rewind the file and return */ - /* (used in io_enc() to print out info about technologies and to initialize the codec) */ - IF( rew_flag ) - { - rewind( file ); - st->total_brate = total_brate; - move32(); - return 1; - } - - /* GOOD frame */ - IF( st->bfi == 0 ) - { - /* GOOD frame - convert ITU-T G.192 words to short values */ - bit_stream_ptr = st->bit_stream; - - FOR( k = 0; k < num_bits; ++k ) - { - *bit_stream_ptr++ = (UWord16) EQ_32( *pt_stream++, G192_BIN1 ); - move16(); - } - - /*add two zero bytes for arithmetic coder flush*/ - FOR( k = 0; k < 2 * 8; ++k ) - { - *bit_stream_ptr++ = 0; - move16(); - } - /*a change of the total bitrate should not be - known to the decoder, if the received frame was lost*/ - st->total_brate = total_brate; - move32(); - - mdct_switching_dec( st ); - } -#ifdef DEBUGGING - else - { - bit_stream_ptr = st->bit_stream; - - for ( k = 0; k < num_bits + 2 * 8; ++k ) - { - *bit_stream_ptr++ = 0; - } - } -#endif - return 1; -} - - /*-------------------------------------------------------------------* * read_indices_mime_handle_dtx() * diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 9fe14b5bd..1bd007e64 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -1323,7 +1323,8 @@ UWord16 get_indice_1_fx( /* o : value of the indice */ ); void reset_indices_enc_fx( - BSTR_ENC_HANDLE hBstr /* i/o: encoder state structure */ + BSTR_ENC_HANDLE hBstr, /* i/o: encoder state structure */ + const Word16 max_num_indices /* i : max number of indices */ ); void reset_indices_dec_fx( @@ -1367,12 +1368,6 @@ Word16 BRATE2IDX16k_fx( Word32 brate ); Word32 BIT_ALLOC_IDX_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 tc ); Word32 BIT_ALLOC_IDX_16KHZ_fx( Word32 brate, Word16 ctype, Word16 sfrm, Word16 tc ); -Word16 read_indices_fx( /* o : 1 = OK, 0 = something wrong */ - Decoder_State *st_fx, /* i/o: decoder state structure */ - FILE *file, /* i : bitstream file */ - Word16 rew_flag /* i : rewind flag (rewind file after reading) */ -); - Word16 read_indices_mime( /* o : 1 = reading OK, 0 = problem */ Decoder_State *st, /* i/o: decoder state structure */ FILE *file, /* i : bitstream file */ @@ -11544,11 +11539,6 @@ uint16_t get_indice( int16_t nb_bits /* i : number of bits that were used to quantize the indice */ ); -void reset_indices_enc( - BSTR_ENC_HANDLE hBstr, /* i/o: encoder bitstream handle */ - const int16_t max_num_indices /* i : max number of indices */ -); - void reset_indices_dec( Decoder_State *st /* i/o: decoder state structure */ ); @@ -11560,13 +11550,13 @@ Word16 rate2EVSmode_float( /*! r: 1 = OK, 0 = something wrong */ -ivas_error read_indices( +ivas_error read_indices_fx( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - uint16_t bit_stream[], /* i : bitstream buffer */ + UWord16 bit_stream[], /* i : bitstream buffer */ UWord16 num_bits, /* i : number of bits in bitstream */ - int16_t *prev_ft_speech, - int16_t *CNG, - int16_t bfi /* i : bad frame indicator */ + Word16 *prev_ft_speech, + Word16 *CNG, + Word16 bfi /* i : bad frame indicator */ ); diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index dc06ddc5a..56ffe3924 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -923,7 +923,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial( } } - IF( NE_32( ( error = read_indices( hIvasDec->st_ivas, serial, num_bits, &hIvasDec->prev_ft_speech, &hIvasDec->CNG, bfi ) ), IVAS_ERR_OK ) ) + IF( NE_32( ( error = read_indices_fx( hIvasDec->st_ivas, serial, num_bits, &hIvasDec->prev_ft_speech, &hIvasDec->CNG, bfi ) ), IVAS_ERR_OK ) ) { return error; } diff --git a/lib_enc/acelp_core_switch_enc_fx.c b/lib_enc/acelp_core_switch_enc_fx.c index 90768aca1..d88e1523e 100644 --- a/lib_enc/acelp_core_switch_enc_fx.c +++ b/lib_enc/acelp_core_switch_enc_fx.c @@ -160,18 +160,6 @@ void acelp_core_switch_enc_fx( /*----------------------------------------------------------------* * bit-stream: modify the layer of sub frame CELP *----------------------------------------------------------------*/ -#ifdef IVAS_CODE_BITSTREAM - i = find_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START, &value, &nb_bits ); -#ifdef DEBUGGING - assert( i >= 0 && "Internal error in ACELP core switching - unable to find ACELP subframe indices!" ); -#endif - while ( hBstr->ind_list[i].id == TAG_ACELP_SUBFR_LOOP_START ) - { - push_indice( hBstr, IND_CORE_SWITCHING_CELP_SUBFRAME, hBstr->ind_list[i].value, hBstr->ind_list[i].nb_bits ); - i++; - } - delete_indice( hBstr, TAG_ACELP_SUBFR_LOOP_START ); -#else FOR( i = 0; i < 20; i++ ) { hBstr->ind_list[IND_CORE_SWITCHING_CELP_SUBFRAME + i].value = hBstr->ind_list[TAG_ACELP_SUBFR_LOOP_START + i].value; /* Q0 */ @@ -181,7 +169,6 @@ void acelp_core_switch_enc_fx( hBstr->ind_list[TAG_ACELP_SUBFR_LOOP_START + i].nb_bits = -1; /* Q0 */ move16(); } -#endif /*----------------------------------------------------------------* * BWE encoding *----------------------------------------------------------------*/ diff --git a/lib_enc/dtx_fx.c b/lib_enc/dtx_fx.c index 6e4d2a043..154b43c12 100644 --- a/lib_enc/dtx_fx.c +++ b/lib_enc/dtx_fx.c @@ -349,7 +349,7 @@ void dtx_ivas_fx( IF( NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) && st_fx->hBstr != NULL ) { - reset_indices_enc( st_fx->hBstr, st_fx->hBstr->nb_ind_tot ); + reset_indices_enc_fx( st_fx->hBstr, st_fx->hBstr->nb_ind_tot ); } } #ifdef NONBE_1211_DTX_BR_SWITCHING @@ -863,11 +863,7 @@ void dtx_fx( /* reset the bitstream (IVAS format signalling was already written) */ IF( NE_16( st_fx->element_mode, IVAS_CPE_MDCT ) && st_fx->hBstr != NULL ) { -#ifndef IVAS_CODE_BITSTREAM - reset_indices_enc_fx( st_fx->hBstr ); -#else - reset_indices_enc( st_fx->hBstr, st_fx->hBstr->nb_ind_tot ); -#endif + reset_indices_enc_fx( st_fx->hBstr, MAX_NUM_INDICES ); } } diff --git a/lib_enc/enc_ppp_fx.c b/lib_enc/enc_ppp_fx.c index f1a87d2d2..c2aeaa7ca 100644 --- a/lib_enc/enc_ppp_fx.c +++ b/lib_enc/enc_ppp_fx.c @@ -189,11 +189,7 @@ ivas_error encod_ppp_fx( /* We write signalling indices again only in case of bump_up */ /* delete previous indices */ -#ifndef IVAS_CODE_BITSTREAM - reset_indices_enc_fx( hBstr ); -#else - reset_indices_enc_fx( hBstr, hBstr->nb_ind_tot ); -#endif + reset_indices_enc_fx( hBstr, MAX_NUM_INDICES ); /* signalling matrix (writing of signalling bits) */ signalling_enc_fx( st_fx ); @@ -377,11 +373,7 @@ ivas_error encod_ppp_ivas_fx( /* We write signalling indices again only in case of bump_up */ /* delete previous indices */ -#ifndef IVAS_CODE_BITSTREAM - reset_indices_enc_fx( hBstr ); -#else - reset_indices_enc_fx( hBstr, hBstr->nb_ind_tot ); -#endif + reset_indices_enc_fx( hBstr, MAX_NUM_INDICES ); /* signalling matrix (writing of signalling bits) */ signalling_enc_fx( st_fx ); diff --git a/lib_enc/eval_pit_contr_fx.c b/lib_enc/eval_pit_contr_fx.c index 75e82409e..d5f832f8c 100644 --- a/lib_enc/eval_pit_contr_fx.c +++ b/lib_enc/eval_pit_contr_fx.c @@ -381,19 +381,14 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pit /* pitch contribution useless - delete all previously written indices belonging to pitch contribution */ FOR( i = TAG_ACELP_SUBFR_LOOP_START; i < TAG_ACELP_SUBFR_LOOP_END; i++ ) { -#ifndef IVAS_CODE_BITSTREAM IF( hBstr->ind_list[i].nb_bits != -1 ) { hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, hBstr->ind_list[i].nb_bits ); /* Q0 */ hBstr->ind_list[i].nb_bits = -1; move16(); } -#else - delete_indice( hBstr, i ); -#endif } -#ifndef IVAS_CODE_BITSTREAM IF( hBstr->ind_list[IND_ES_PRED].nb_bits != -1 ) { hBstr->nb_bits_tot = sub( hBstr->nb_bits_tot, hBstr->ind_list[IND_ES_PRED].nb_bits ); /* Q0 */ @@ -401,9 +396,6 @@ Word16 Pit_exc_contribution_len_fx( /* o : bin where pit hBstr->ind_list[IND_ES_PRED].nb_bits = -1; move16(); } -#else - delete_indice( hBstr, i ); -#endif } IF( LT_32( st_fx->core_brate, CFREQ_BITRATE ) ) { diff --git a/lib_enc/fd_cng_enc_fx.c b/lib_enc/fd_cng_enc_fx.c index 2db8b956b..757a69518 100644 --- a/lib_enc/fd_cng_enc_fx.c +++ b/lib_enc/fd_cng_enc_fx.c @@ -2695,9 +2695,9 @@ void stereoFdCngCoherence_fx( ELSE IF( LE_32( sts[0]->core_brate, SID_2k40 ) && LE_32( sts[1]->core_brate, SID_2k40 ) ) { /* case: no VAD for both channels -> INACTIVE FRAME */ - reset_indices_enc( sts[0]->hBstr, sts[0]->hBstr->nb_ind_tot ); + reset_indices_enc_fx( sts[0]->hBstr, sts[0]->hBstr->nb_ind_tot ); - reset_indices_enc( sts[1]->hBstr, sts[1]->hBstr->nb_ind_tot ); + reset_indices_enc_fx( sts[1]->hBstr, sts[1]->hBstr->nb_ind_tot ); /* synchronize SID sending for variable SID rate */ IF( EQ_32( sts[0]->core_brate, sts[1]->core_brate ) ) diff --git a/lib_enc/init_enc_fx.c b/lib_enc/init_enc_fx.c index cd5db5377..ebfd9c4a2 100644 --- a/lib_enc/init_enc_fx.c +++ b/lib_enc/init_enc_fx.c @@ -136,18 +136,6 @@ ivas_error init_encoder_fx( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Bitstream structure\n" ) ); } -#ifdef IVAS_CODE_BITSTREAM - - /* set pointer to the buffer of indices */ - st->hBstr->ind_list = st_ivas->ind_list; - st->hBstr->ivas_ind_list_zero = &st_ivas->ind_list; - st->hBstr->ivas_max_num_indices = &st_ivas->ivas_max_num_indices; - st->hBstr->nb_ind_tot = 0; - move16(); - st->hBstr->nb_bits_tot = 0; - move16(); - st->hBstr->st_ivas = st_ivas; -#endif } ELSE { @@ -910,9 +898,6 @@ ivas_error init_encoder_fx( NS2SA_FX2( st_fx->input_Fs, DELAY_FIR_RESAMPL_NS ), &st_fx->transientDetection ); - // reset_indices_enc_fx( st_fx->hBstr); - - st_fx->Q_syn2 = 0; move16(); st_fx->Q_syn = 0; diff --git a/lib_enc/ivas_core_enc_fx.c b/lib_enc/ivas_core_enc_fx.c index f88288ea1..cacbcabd3 100644 --- a/lib_enc/ivas_core_enc_fx.c +++ b/lib_enc/ivas_core_enc_fx.c @@ -309,7 +309,7 @@ ivas_error ivas_core_enc_fx( st->hBstr->nb_ind_tot = add( st->hBstr->nb_ind_tot, hStereoTD->tdm_hBstr_tmp.nb_ind_tot ); /* Q0 */ st->hBstr->nb_bits_tot = add( st->hBstr->nb_bits_tot, hStereoTD->tdm_hBstr_tmp.nb_bits_tot ); /* Q0 */ - reset_indices_enc( &hStereoTD->tdm_hBstr_tmp, MAX_IND_TDM_TMP ); + reset_indices_enc_fx( &hStereoTD->tdm_hBstr_tmp, MAX_IND_TDM_TMP ); } /*---------------------------------------------------------------------* diff --git a/lib_enc/ivas_corecoder_enc_reconfig_fx.c b/lib_enc/ivas_corecoder_enc_reconfig_fx.c index f21c8e262..a1f2196fb 100644 --- a/lib_enc/ivas_corecoder_enc_reconfig_fx.c +++ b/lib_enc/ivas_corecoder_enc_reconfig_fx.c @@ -405,7 +405,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( /* only reset indices if it is not the first index list, this already contains the IVAS format bits */ IF( sce_id > 0 || EQ_16( hEncoderConfig->ivas_format, MASA_ISM_FORMAT ) ) { - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->nb_ind_tot ); + reset_indices_enc_fx( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->nb_ind_tot ); } } @@ -449,7 +449,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( ( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && st_ivas->nSCE > 0 ) || ( EQ_16( hEncoderConfig->ivas_format, MASA_ISM_FORMAT ) && st_ivas->nSCE > 0 ) ) { - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_ind_tot ); + reset_indices_enc_fx( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_ind_tot ); } } } @@ -487,7 +487,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( test(); IF( add( i_mult( cpe_id, CPE_CHANNELS ), n ) > 0 || ( EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) && st_ivas->nSCE > 0 ) ) { - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_ind_tot ); + reset_indices_enc_fx( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->nb_ind_tot ); } IF( hEncoderConfig->Opt_DTX_ON ) @@ -667,7 +667,7 @@ ivas_error ivas_corecoder_enc_reconfig_fx( } } - reset_indices_enc( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData, st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_ind_tot ); + reset_indices_enc_fx( st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData, st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData->nb_ind_tot ); FOR( cpe_id = 0; cpe_id < st_ivas->nCPE - 1; cpe_id++ ) { diff --git a/lib_enc/ivas_init_enc_fx.c b/lib_enc/ivas_init_enc_fx.c index b49fc9716..57858b03e 100644 --- a/lib_enc/ivas_init_enc_fx.c +++ b/lib_enc/ivas_init_enc_fx.c @@ -2151,7 +2151,7 @@ ivas_error ivas_initialize_MD_bstr_enc_fx( hMetaData->ivas_max_num_indices = &st_ivas->ivas_max_num_indices_metadata; /* Q0 */ hMetaData->st_ivas = st_ivas; - reset_indices_enc( hMetaData, st_ivas->ivas_max_num_indices_metadata ); + reset_indices_enc_fx( hMetaData, st_ivas->ivas_max_num_indices_metadata ); *hMetaData_out = hMetaData; diff --git a/lib_enc/ivas_ism_dtx_enc_fx.c b/lib_enc/ivas_ism_dtx_enc_fx.c index 9256be408..6aba283be 100644 --- a/lib_enc/ivas_ism_dtx_enc_fx.c +++ b/lib_enc/ivas_ism_dtx_enc_fx.c @@ -191,7 +191,7 @@ Word16 ivas_ism_dtx_enc_fx( IF( dtx_flag ) { /* reset the bitstream (IVAS format signaling was already written) */ - reset_indices_enc( hSCE[0]->hCoreCoder[0]->hBstr, hSCE[0]->hCoreCoder[0]->hBstr->nb_ind_tot ); + reset_indices_enc_fx( hSCE[0]->hCoreCoder[0]->hBstr, hSCE[0]->hCoreCoder[0]->hBstr->nb_ind_tot ); } /*------------------------------------------------------------------* diff --git a/lib_enc/ivas_ism_metadata_enc_fx.c b/lib_enc/ivas_ism_metadata_enc_fx.c index 6a2e54db6..8e6e0c93f 100644 --- a/lib_enc/ivas_ism_metadata_enc_fx.c +++ b/lib_enc/ivas_ism_metadata_enc_fx.c @@ -873,7 +873,7 @@ ivas_error ivas_ism_metadata_enc_fx( /* write metadata only in active frames */ IF( GT_32( hSCE[0]->hCoreCoder[0]->core_brate, SID_2k40 ) ) { - reset_indices_enc( hSCE[ch]->hMetaData, hSCE[ch]->hMetaData->nb_ind_tot ); + reset_indices_enc_fx( hSCE[ch]->hMetaData, hSCE[ch]->hMetaData->nb_ind_tot ); } } diff --git a/lib_enc/ivas_omasa_enc_fx.c b/lib_enc/ivas_omasa_enc_fx.c index b5258712b..d31e6d53d 100644 --- a/lib_enc/ivas_omasa_enc_fx.c +++ b/lib_enc/ivas_omasa_enc_fx.c @@ -336,11 +336,11 @@ ivas_error ivas_omasa_enc_config_fx( /* re-write IVAS format signalling - actual 'ism_mode' was not known before */ IF( st_ivas->nSCE > 0 ) { - reset_indices_enc( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot ); + reset_indices_enc_fx( st_ivas->hSCE[0]->hCoreCoder[0]->hBstr, st_ivas->hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot ); } ELSE { - reset_indices_enc( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->nb_bits_tot ); + reset_indices_enc_fx( st_ivas->hCPE[0]->hCoreCoder[0]->hBstr, st_ivas->hCPE[0]->hCoreCoder[0]->hBstr->nb_bits_tot ); } ivas_write_format_fx( st_ivas ); diff --git a/lib_enc/ivas_qmetadata_enc_fx.c b/lib_enc/ivas_qmetadata_enc_fx.c index 2d6080995..7de54c482 100644 --- a/lib_enc/ivas_qmetadata_enc_fx.c +++ b/lib_enc/ivas_qmetadata_enc_fx.c @@ -1209,7 +1209,7 @@ void reset_metadata_spatial_fx( ELSE { /*Reset metadata*/ - reset_indices_enc( hMetaData, hMetaData->nb_ind_tot ); + reset_indices_enc_fx( hMetaData, hMetaData->nb_ind_tot ); } *total_brate = element_brate; diff --git a/lib_enc/ivas_sce_enc_fx.c b/lib_enc/ivas_sce_enc_fx.c index 2983ea2f0..35b65e4c1 100644 --- a/lib_enc/ivas_sce_enc_fx.c +++ b/lib_enc/ivas_sce_enc_fx.c @@ -608,7 +608,7 @@ ivas_error create_evs_sce_enc_fx( } st_fx->hBstr->ind_list = ind_list; // st_fx->hBstr->ind_list_fx = st->hBstr->ind_list; - reset_indices_enc_fx( st_fx->hBstr ); + reset_indices_enc_fx( st_fx->hBstr, MAX_NUM_INDICES ); hSCE->hCoreCoder[0] = st_fx; st_ivas->hSCE[sce_id] = hSCE; diff --git a/lib_enc/ivas_spar_md_enc_fx.c b/lib_enc/ivas_spar_md_enc_fx.c index 997581476..9c4fcc937 100644 --- a/lib_enc/ivas_spar_md_enc_fx.c +++ b/lib_enc/ivas_spar_md_enc_fx.c @@ -849,7 +849,7 @@ ivas_error ivas_spar_md_enc_process_fx( move16(); IF( NE_16( strat, NO_STRAT ) ) { - reset_indices_enc( &hMetaData_tmp, md_indices_allocated ); + reset_indices_enc_fx( &hMetaData_tmp, md_indices_allocated ); ivas_write_spar_md_bitstream_fx( hMdEnc, num_bands, bands_bw, &hMetaData_tmp, hEncoderConfig->ivas_total_brate, strat, qsi ); diff --git a/lib_enc/ivas_stereo_td_enc_fx.c b/lib_enc/ivas_stereo_td_enc_fx.c index 1544aab76..378068827 100644 --- a/lib_enc/ivas_stereo_td_enc_fx.c +++ b/lib_enc/ivas_stereo_td_enc_fx.c @@ -195,7 +195,7 @@ void stereo_td_init_enc_fx( move32(); hStereoTD->tdm_hBstr_tmp.ivas_max_num_indices = &hStereoTD->max_ind_tdm_tmp; hStereoTD->tdm_hBstr_tmp.st_ivas = NULL; - reset_indices_enc( &hStereoTD->tdm_hBstr_tmp, MAX_IND_TDM_TMP ); + reset_indices_enc_fx( &hStereoTD->tdm_hBstr_tmp, MAX_IND_TDM_TMP ); return; } diff --git a/lib_enc/tcx_utils_enc_fx.c b/lib_enc/tcx_utils_enc_fx.c index 7247b6446..ce7f0e6a6 100644 --- a/lib_enc/tcx_utils_enc_fx.c +++ b/lib_enc/tcx_utils_enc_fx.c @@ -3734,7 +3734,6 @@ void ProcessIGF_fx( } } - // IVAS_CODE_BITSTREAM bsStart = hBstr->next_ind_fx; move16(); @@ -3749,21 +3748,11 @@ void ProcessIGF_fx( IGFEncWriteBitstream_fx( hInstance, st->hBstr, &hInstance->infoTotalBitsPerFrameWritten, igfGridIdx, isIndepFlag ); } -#ifndef IVAS_CODE_BITSTREAM bsBits = sub( hBstr->next_ind_fx, bsStart ); IF( !isTCX20 ) { IGFEncConcatenateBitstream_fx( hInstance, bsBits, &hBstr->next_ind_fx, &hBstr->nb_bits_tot, hBstr->ind_list ); } -#else - PMT( "New bit stream implementation to be checked" ) - bsBits = sub( hBstr->next_ind_fx, bsStart ); - IF( !isTCX20 ) - { - IGFEncConcatenateBitstream_fx( hInstance, bsBits, &hBstr->next_ind_fx, &hBstr->nb_bits_tot_fx, hBstr->ind_list_fx ); - } - -#endif } void attenuateNbSpectrum_fx( Word16 L_frame, Word32 *spectrum ) -- GitLab