diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 0a206fcdb5de316ea3bfc629646888606395e946..886509b5ac96d65923b4f13872021fd74414c2f2 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1914,7 +1914,11 @@ ivas_error preview_indices( k = IVAS_FORMAT_SIGNALING_NBITS; if ( st_ivas->ivas_format == MASA_FORMAT ) { +#ifdef COMBINED_FORMAT_SIGNALING + k = IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; +#else k = IVAS_FORMAT_SIGNALING_NBITS_SBA; +#endif } if ( total_brate < MIN_BRATE_MDCT_STEREO ) @@ -1954,9 +1958,15 @@ ivas_error preview_indices( else if ( st_ivas->ivas_format == SBA_FORMAT ) { /* Read SBA planar flag and SBA order */ +#ifdef COMBINED_FORMAT_SIGNALING + st_ivas->sba_planar = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED] == 1 ); + st_ivas->sba_order = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + 2] == 1 ); + st_ivas->sba_order += 2 * ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + 1] == 1 ); +#else st_ivas->sba_planar = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_SBA] == 1 ); st_ivas->sba_order = ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_SBA + 2] == 1 ); st_ivas->sba_order += 2 * ( bit_stream[IVAS_FORMAT_SIGNALING_NBITS_SBA + 1] == 1 ); +#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( total_brate, st_ivas->sba_order ); @@ -2106,12 +2116,12 @@ ivas_error read_indices( } /* 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 frames triggers SID_BAD. + 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 frames triggers SID_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 . - */ + 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; @@ -2123,10 +2133,10 @@ ivas_error read_indices( { 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 - */ + 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 + */ } speech_bad = 0; @@ -2142,7 +2152,7 @@ ivas_error read_indices( } /* 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 ) */ + as this frame was never transmitted, one can not know it is good and has a a length of zero ) */ if ( *CNG != 0 ) { /* We were in CNG synthesis */ @@ -2340,7 +2350,7 @@ static Word32 read_indices_mime_handle_dtx( /* Now modify bfi flag for the decoder's SPEECH/CNG synthesis logic */ /* in SPEECH synthesis, make sure to activate speech PLC for a received NO_DATA frame, - no_data frames may be injected by the network or by the dejitter buffer */ + no_data frames may be injected by the network or by the dejitter buffer */ /* modify bfi_flag to stay/move into the correct decoder PLC section */ if ( ( *CNG == 0 ) && ( no_data != 0 ) ) { @@ -2360,10 +2370,10 @@ static Word32 read_indices_mime_handle_dtx( /* now bfi, total_brate are set by RX-DTX handler:: - bfi==0, total_brate!=0 CNG or speech pending bitrate - bfi==0, total_brate==0 CNG will continue or start(sid_first, sid_bad) - bfi==1, total_brate!=0 speech PLC - bfi==1, total_brate==0 , speech PLC */ + bfi==0, total_brate!=0 CNG or speech pending bitrate + bfi==0, total_brate==0 CNG will continue or start(sid_first, sid_bad) + bfi==1, total_brate!=0 speech PLC + bfi==1, total_brate==0 , speech PLC */ /* handle available AMRWB/AMRWBIO MIME header ToC rate-info at startup */ if ( ( st->bfi == 1 && st->ini_frame == 0 ) && ( ( amrwb_rfc4867_flag != 0 ) || ( amrwb_rfc4867_flag == 0 && isAMRWB_IOmode != 0 ) ) ) /*AMRWB ToC */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 263c5992b062cc0b14d4cdf79c0540c3b9c86636..c840fd3a83a9c9fea98a1f9d5f5e8826d9aba264 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -78,7 +78,11 @@ typedef enum *----------------------------------------------------------------------------------*/ #define IVAS_FORMAT_SIGNALING_NBITS 2 /* number of bits for signaling the IVAS format */ +#ifdef COMBINED_FORMAT_SIGNALING +#define IVAS_FORMAT_SIGNALING_NBITS_EXTENDED ( IVAS_FORMAT_SIGNALING_NBITS + 1 ) +#else #define IVAS_FORMAT_SIGNALING_NBITS_SBA ( IVAS_FORMAT_SIGNALING_NBITS + 1 ) +#endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 481812d22d3ed082870c6a31a1481b3d2dfef2fc..6688edc0415b0bcd0b037cf848e446e567a63584 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -2154,8 +2154,13 @@ void ivas_spar_set_bitrate_config( max_bits += (int16_t) ( ivas_spar_br_table_consts[table_idx].core_brs[i][1] / FRAMES_PER_SEC ); } +#ifdef COMBINED_FORMAT_SIGNALING + pSpar_md_cfg->tgt_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_EXTENDED - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - total_bits; + pSpar_md_cfg->max_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_EXTENDED - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - max_bits; +#else pSpar_md_cfg->tgt_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_SBA - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - total_bits; pSpar_md_cfg->max_bits_per_blk = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC ) - IVAS_FORMAT_SIGNALING_NBITS_SBA - SBA_PLANAR_BITS - SBA_ORDER_BITS - length - max_bits; +#endif md_coding_bits_header = SPAR_NUM_CODING_STRAT_BITS + pSpar_md_cfg->quant_strat_bits; diff --git a/lib_com/options.h b/lib_com/options.h old mode 100755 new mode 100644 index ac13c074027e5baed583bb97ccd68c09b2a86a19..9c461d84e6698b8bad3cb76268bd3d7e99636239 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -171,14 +171,16 @@ #define FIX_425_MASA_BRSW_RENDERER /* Nokia: Issue 425: renderer not reconfigure in MASA bitrate switching */ -#define EUALER2QUAT_FIX /*Dlb :fix for issue 430 issue in euler2quat, sign of quat y is inverted*/ +#define EUALER2QUAT_FIX /* Dlb :fix for issue 430 issue in euler2quat, sign of quat y is inverted */ #define HR_METADATA /* Nok: encode directional MASA metadata with more bits at 384k and 512k */ #define FIX_357_DTX_32K /* Eri: issue 357 - Forced LP-CNG at 32k */ #define FIX_435_ISM_MERGE_BUG /* Eri: Merge bug fix for ISM NULL metadata and tcx_only cases */ #define FIX_355_REFACTOR_PARAMBIN_TO_5MS /* Nokia: Fixes issue 355 by refactoring parametric binauralizer code to 5 ms mode */ - #define FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING /* Eri: Fix incorrect use of stack variable used for channel aware config file */ +#define COMBINED_FORMAT_SIGNALING /* VA: Introduce a signaling bit for combined format coding */ + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index a193ac282337c7ac7d18deead2e03ab4c6aa0720..a58220a9b7247078ac39cdba10924f39e77646df 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -369,8 +369,24 @@ static ivas_error ivas_read_format( st_ivas->ivas_format = MC_FORMAT; break; case 2: +#ifdef COMBINED_FORMAT_SIGNALING st_ivas->ivas_format = ISM_FORMAT; + if ( ivas_total_brate >= IVAS_24k4 ) + { + if ( st_ivas->bit_stream[*num_bits_read] ) + { + /* placeholder for combined format signaling */ + + ( *num_bits_read )++; + } + + ( *num_bits_read )++; + } +#else + st_ivas->ivas_format = ISM_FORMAT; +#endif + break; case 3: if ( st_ivas->bit_stream[*num_bits_read] ) diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 36d476723ce069a4789fa7bcdd80b20e1238bbee..d617727be4bd4a5cddbd3b100b3ebd7441b2aa42 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -57,7 +57,11 @@ void ivas_write_format( ind = 0; nBits = IVAS_FORMAT_SIGNALING_NBITS; +#ifdef COMBINED_FORMAT_SIGNALING + extra_bits = ( IVAS_FORMAT_SIGNALING_NBITS_EXTENDED - IVAS_FORMAT_SIGNALING_NBITS ); +#else extra_bits = ( IVAS_FORMAT_SIGNALING_NBITS_SBA - IVAS_FORMAT_SIGNALING_NBITS ); +#endif switch ( st_ivas->hEncoderConfig->ivas_format ) { @@ -66,6 +70,13 @@ void ivas_write_format( break; case ISM_FORMAT: ind = 2; +#ifdef COMBINED_FORMAT_SIGNALING + if ( st_ivas->hEncoderConfig->ivas_total_brate >= IVAS_24k4 ) + { + ind = 4; + nBits += extra_bits; + } +#endif break; case MC_FORMAT: ind = 1; diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index aff8b9a0b6f421e0450d55c51c71dbf84f46af9e..3a216b6164f2f335f41d921e73a4c80d9638584b 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -250,8 +250,20 @@ int16_t ivas_ism_dtx_enc( /* IVAS format signaling was erased in dtx() */ if ( hSCE[0]->hCoreCoder[0]->hBstr->nb_bits_tot == 0 ) { +#ifdef COMBINED_FORMAT_SIGNALING /* replicate ivas_write_format() */ + int16_t ind = 2; + nBits = IVAS_FORMAT_SIGNALING_NBITS; + if ( ivas_total_brate >= IVAS_24k4 ) + { + ind = 4; + nBits = IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; + } + + push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, ind, nBits ); +#else push_indice( hSCE[0]->hCoreCoder[0]->hBstr, IND_IVAS_FORMAT, 2 /* == ISM format */, IVAS_FORMAT_SIGNALING_NBITS ); +#endif } } else /* ism_dtx_flag == 1 */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 900c5e1653c173f8e149130991e00b0e8b179432..d1f47bcee301d0879caedf5377967cae0d38e021 100644 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -476,7 +476,11 @@ void ivas_mct_core_enc( } else if ( ivas_format == SBA_FORMAT ) { +#ifdef COMBINED_FORMAT_SIGNALING + nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_EXTENDED; +#else nAvailBits -= IVAS_FORMAT_SIGNALING_NBITS_SBA; +#endif nAvailBits -= SBA_ORDER_BITS + SBA_PLANAR_BITS; } @@ -551,7 +555,11 @@ void ivas_mct_core_enc( } #ifdef DEBUGGING +#ifdef COMBINED_FORMAT_SIGNALING + format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_EXTENDED + SBA_ORDER_BITS + SBA_PLANAR_BITS ); +#else format_bits = ( ivas_format == MC_FORMAT ? IVAS_FORMAT_SIGNALING_NBITS + MC_LS_SETUP_BITS : IVAS_FORMAT_SIGNALING_NBITS_SBA + SBA_ORDER_BITS + SBA_PLANAR_BITS ); +#endif mct_bits += hMCT->nBitsMCT + hMCT->nchan_out_woLFE; assert( ( total_brate + ( NBITS_BWIDTH + format_bits + mct_bits + sba_meta + lfe_bits ) * FRAMES_PER_SEC ) == ivas_total_brate ); #endif