From 6e9a0fe6e0f87b777b8b58b4c4153594da8000da Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 17 May 2023 16:22:27 +0200 Subject: [PATCH 1/6] change starting bitrate of core-coder with 16kHz internal sampling rate from 17 kbps to 15.9 kbps; under ISM_16_KHZ_CORE --- lib_com/bits_alloc.c | 9 +++++++++ lib_com/ivas_cnst.h | 7 +++++++ lib_com/ivas_ism_com.c | 26 ++++++++++++++++++++++++++ lib_com/ivas_prot.h | 3 +++ lib_com/options.h | 4 ++++ lib_com/prot.h | 3 +++ lib_dec/evs_dec.c | 4 ++++ lib_dec/init_dec.c | 4 ++++ lib_dec/ivas_cpe_dec.c | 4 ++++ lib_dec/ivas_ism_dec.c | 4 ++++ lib_dec/ivas_ism_metadata_dec.c | 8 ++++++++ lib_dec/ivas_sce_dec.c | 4 ++++ lib_enc/evs_enc.c | 5 ++++- lib_enc/init_enc.c | 4 ++++ lib_enc/ivas_cpe_enc.c | 8 ++++++++ lib_enc/ivas_ism_enc.c | 12 ++++++++++++ lib_enc/ivas_ism_metadata_enc.c | 8 ++++++++ lib_enc/ivas_sce_enc.c | 8 ++++++++ 18 files changed, 124 insertions(+), 1 deletion(-) diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 5ae9cb84d0..81bdd93bf8 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -1477,6 +1477,9 @@ static int16_t allocate_unused( /*! r: ACELP16k flag */ int16_t set_ACELP_flag( +#ifdef ISM_16_KHZ_CORE + const ISM_MODE ism_mode, /* i : ISM mode */ +#endif const int16_t element_mode, /* i : element mode */ const int32_t element_brate, /* i : element bitrate */ const int32_t total_brate, /* i : total bitrate per channel */ @@ -1515,6 +1518,12 @@ int16_t set_ACELP_flag( } else if ( element_mode == IVAS_SCE ) { +#ifdef ISM_16_KHZ_CORE + if ( ism_mode == ISM_MODE_DISC && element_brate >= SCE_CORE_16k_LOW_LIMIT_ISM ) + { + return 1; + } +#endif if ( element_brate >= SCE_CORE_16k_LOW_LIMIT ) { return 1; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index b5e3964319..c8eab50f29 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -294,6 +294,9 @@ typedef enum #define ACELP_12k8_HIGH_LIMIT 24350 /* max. per channel bitrate where the ACELP@12.8kHz is supported */ #define ACELP_16k_LOW_LIMIT 13250 /* min. per channel bitrate where the ACELP@16kHz is supported */ #define SCE_CORE_16k_LOW_LIMIT 17000 /* min. SCE bitrate where the ACELP@16kHz is supported; must be >= (ACELP_16k_LOW_LIMIT + SWB_TBE_1k6) */ +#ifdef ISM_16_KHZ_CORE +#define SCE_CORE_16k_LOW_LIMIT_ISM 15900 /* min. SCE bitrate where the ACELP@16kHz is supported; must be >= (ACELP_16k_LOW_LIMIT + SWB_TBE_1k6) */ +#endif #define MIN_BRATE_AVQ_EXC ACELP_29k00 /* min. per channel bitrate where the AVQ excitation stage is supported */ #define MAX_BRATE_AVQ_EXC_TD 40000 /* max. per channel bitrate where the AVQ excitation stage in time domain is supported */ @@ -331,7 +334,11 @@ typedef enum * ISM Constants *----------------------------------------------------------------------------------*/ +#ifdef ISM_16_KHZ_COREaa // VE: to be verified !!!!! +#define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT_ISM - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ +#else #define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ +#endif #define ISM_METADATA_VAD_FLAG_BITS 1 #define ISM_METADATA_FLAG_BITS 2 diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index d14b252fd8..51c9f88cb1 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -92,6 +92,9 @@ ivas_error ivas_ism_config( const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ +#ifdef ISM_16_KHZ_CORE + const ISM_MODE ism_mode, /* i : ISM mode */ +#endif #ifdef ISM_NON_DIEGETIC_PAN const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ #endif @@ -109,12 +112,23 @@ ivas_error ivas_ism_config( int16_t tmp; int16_t ism_metadata_flag_global; int16_t n_ISms; +#ifdef ISM_16_KHZ_CORE + int32_t sce_core_16k_limit; +#endif ivas_error error; error = IVAS_ERR_OK; n_ISms = nchan_transport; +#ifdef ISM_16_KHZ_CORE + sce_core_16k_limit = SCE_CORE_16k_LOW_LIMIT_ISM; + if ( ism_mode == ISM_MODE_PARAM || ism_extended_metadata_flag ) + { + sce_core_16k_limit = SCE_CORE_16k_LOW_LIMIT; + } +#endif + /* initialization */ ism_metadata_flag_global = 0; bits_side = 0; @@ -221,9 +235,17 @@ ivas_error ivas_ism_config( { limit = MIN_BRATE_WB_BWE / FRMS_PER_SECOND; } +#ifdef ISM_16_KHZ_CORE + else if ( element_brate[ch] >= sce_core_16k_limit ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ +#else else if ( element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ +#endif { +#ifdef ISM_16_KHZ_CORE + /*limit = sce_core_16k_limit;*/ +#else /*limit = SCE_CORE_16k_LOW_LIMIT;*/ +#endif limit = ( ACELP_16k_LOW_LIMIT + SWB_TBE_1k6 ) / FRMS_PER_SECOND; } @@ -275,7 +297,11 @@ ivas_error ivas_ism_config( for ( ch = 0; ch < n_ISms; ch++ ) { limit_high = IVAS_512k / FRMS_PER_SECOND; +#ifdef ISM_16_KHZ_CORE + if ( element_brate[ch] < sce_core_16k_limit ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ +#else if ( element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ +#endif { limit_high = ACELP_12k8_HIGH_LIMIT / FRMS_PER_SECOND; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 5d4faf0eb0..ace91a63eb 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -867,6 +867,9 @@ ivas_error ivas_ism_config( const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ +#ifdef ISM_16_KHZ_CORE + const ISM_MODE ism_mode, /* i : ISM mode */ +#endif #ifdef ISM_NON_DIEGETIC_PAN const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ #endif diff --git a/lib_com/options.h b/lib_com/options.h index 4150e91a5d..240263cf77 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -221,6 +221,10 @@ #define HYBRID_ITD_MAX /* FhG: Improvement for DFT-stereo for cases with large ITDs */ + +#define ISM_16_KHZ_CORE // change starting bitrate of core-coder with 16kHz internal sampling rate from 17 kbps to 15.9 kbps + // VE: 4ISM 64 kbps extend metadata cases might fail due to too high bitbudget for ext. MD + 4 x 16kHz core + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 8c6fdd674f..b290372d4f 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -9076,6 +9076,9 @@ ivas_error config_acelp1( /*! r: ACELP16k flag */ int16_t set_ACELP_flag( +#ifdef ISM_16_KHZ_CORE + const ISM_MODE ism_mode, /* i : ISM mode */ +#endif const int16_t element_mode, /* i : element mode */ const int32_t element_brate, /* i : element bitrate */ const int32_t total_brate, /* i : total bitrate per channel */ diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 8ea2d71159..0d55b54762 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -92,7 +92,11 @@ ivas_error evs_dec( *-----------------------------------------------------------------*/ st->idchan = 0; +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); +#endif tmps = 0; delay_tdbwe = 0; diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 173623db65..45030137c3 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -90,7 +90,11 @@ ivas_error init_decoder( st->last_core = -1; st->last_extl = st->extl; +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); +#endif /*-----------------------------------------------------------------* * ACELP core parameters diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 3717501c83..3b71a06569 100755 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -305,7 +305,11 @@ ivas_error ivas_cpe_dec( for ( n = 0; n < n_channels; n++ ) { /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ +#ifdef ISM_16_KHZ_CORE + sts[n]->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, hCPE->element_mode, hCPE->element_brate, sts[n]->total_brate, n, ( hCPE->hStereoTD != NULL ? hCPE->hStereoTD->tdm_LRTD_flag : 0 ), sts[n]->bwidth, sts[n]->cng_type ); +#else sts[n]->flag_ACELP16k = set_ACELP_flag( hCPE->element_mode, hCPE->element_brate, sts[n]->total_brate, n, ( hCPE->hStereoTD != NULL ? hCPE->hStereoTD->tdm_LRTD_flag : 0 ), sts[n]->bwidth, sts[n]->cng_type ); +#endif } for ( n = 0; n < n_channels; n++ ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 5706261093..aa0db9cb17 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -91,7 +91,11 @@ static ivas_error ivas_ism_bitrate_switching( #endif #ifdef ISM_NON_DIEGETIC_PAN +#ifdef ISM_16_KHZ_CORE + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, ism_mode, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index b7bf89e026..bc095ae8ad 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -500,7 +500,11 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { #ifdef ISM_NON_DIEGETIC_PAN +#ifdef ISM_16_KHZ_CORE + if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_mode, ism_extmeta_bitstream, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) #endif @@ -614,7 +618,11 @@ ivas_error ivas_ism_metadata_dec_create( } #ifdef ISM_NON_DIEGETIC_PAN +#ifdef ISM_16_KHZ_CORE + if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, st_ivas->ism_mode, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 9a940b9b6d..a9ae521f74 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -212,7 +212,11 @@ ivas_error ivas_sce_dec( } else { +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( st_ivas->ism_mode, IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); +#endif } if ( is_DTXrate( ivas_total_brate ) ) diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index da0556dd72..d900090552 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -122,9 +122,12 @@ ivas_error evs_enc( st->mdct_sw = 0; st->rate_switching_reset = 0; - st->idchan = 0; +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); +#endif /*----------------------------------------------------------------* * set input samples buffer diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 9efd3c7f16..7b57389ad8 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -100,7 +100,11 @@ ivas_error init_encoder( st->coder_type_raw = VOICED; st->last_coder_type_raw = st->coder_type_raw; +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); +#endif /*-----------------------------------------------------------------* * Bitstream diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 522cfb885d..416614bf6e 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -513,11 +513,19 @@ ivas_error ivas_cpe_enc( { if ( ( sts[0]->core_brate == SID_2k40 || sts[0]->core_brate == FRAME_NO_DATA ) && hCPE->element_mode == IVAS_CPE_DFT ) { +#ifdef ISM_16_KHZ_CORE + sts[n]->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, hCPE->element_mode, hCPE->element_brate, sts[n]->core_brate, n, sts[0]->tdm_LRTD_flag, sts[n]->bwidth, sts[n]->cng_type ); +#else sts[n]->flag_ACELP16k = set_ACELP_flag( hCPE->element_mode, hCPE->element_brate, sts[n]->core_brate, n, sts[0]->tdm_LRTD_flag, sts[n]->bwidth, sts[n]->cng_type ); +#endif } else { +#ifdef ISM_16_KHZ_CORE + sts[n]->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, hCPE->element_mode, hCPE->element_brate, sts[n]->total_brate, n, sts[0]->tdm_LRTD_flag, sts[n]->bwidth, sts[n]->cng_type ); +#else sts[n]->flag_ACELP16k = set_ACELP_flag( hCPE->element_mode, hCPE->element_brate, sts[n]->total_brate, n, sts[0]->tdm_LRTD_flag, sts[n]->bwidth, sts[n]->cng_type ); +#endif } } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 5c310ac30f..b78f218811 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -268,7 +268,11 @@ ivas_error ivas_ism_enc( /* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */ if ( st->core_brate == SID_2k40 || st->core_brate == FRAME_NO_DATA ) { +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( st_ivas->ism_mode, IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); +#endif } else if ( st->low_rate_mode ) { @@ -276,7 +280,11 @@ ivas_error ivas_ism_enc( } else { +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( st_ivas->ism_mode, IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); +#endif } /* modify the coder_type depending on the total_brate per channel */ @@ -403,7 +411,11 @@ ivas_error ivas_ism_enc_config( st_ivas->nCPE = 0; #ifdef ISM_NON_DIEGETIC_PAN +#ifdef ISM_16_KHZ_CORE + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, st_ivas->ism_mode, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) #endif diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index 732ffec21b..3f9d5c959a 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -577,7 +577,11 @@ ivas_error ivas_ism_metadata_enc( *----------------------------------------------------------------*/ #ifdef ISM_NON_DIEGETIC_PAN +#ifdef ISM_16_KHZ_CORE + if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_mode, ism_extended_metadata_flag, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) +#endif #else if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) #endif @@ -699,7 +703,11 @@ ivas_error ivas_ism_metadata_enc_create( } #ifdef ISM_NON_DIEGETIC_PAN +#ifdef ISM_16_KHZ_CORE + if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, st_ivas->ism_mode, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#else if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) +#endif #else 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 ) #endif diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index c8577a85ba..df0faf71c0 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -223,11 +223,19 @@ ivas_error ivas_sce_enc( /* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */ if ( st->core_brate == SID_2k40 || st->core_brate == FRAME_NO_DATA ) { +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); +#endif } else { +#ifdef ISM_16_KHZ_CORE + st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); +#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); +#endif } /* modify the coder_type depending on the total_brate per channel */ -- GitLab From ae9a8e48ce3367693e28c18b51c68a33f3346c37 Mon Sep 17 00:00:00 2001 From: vaclav Date: Fri, 19 May 2023 11:09:39 +0200 Subject: [PATCH 2/6] change ISM_NB_BITS_METADATA_NOMINAL macro --- lib_com/ivas_cnst.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index c8eab50f29..f709195ad0 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -334,7 +334,7 @@ typedef enum * ISM Constants *----------------------------------------------------------------------------------*/ -#ifdef ISM_16_KHZ_COREaa // VE: to be verified !!!!! +#ifdef ISM_16_KHZ_CORE #define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT_ISM - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ #else #define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ -- GitLab From 874d1940d6136fba2e766aad2b57c274196e2fe1 Mon Sep 17 00:00:00 2001 From: vaclav Date: Tue, 23 May 2023 08:22:00 +0200 Subject: [PATCH 3/6] ISM_FB - 1ISM 32 kbps: change SWB to FB coding ISM_25k6_HZ_CORE - 1ISM 48 kbps: change ACELP/TCX 16 kHz core to TCX only 25.6 kHz core --- lib_com/core_com_config.c | 41 ++++++++++++++++++++++++++++++ lib_com/ivas_cnst.h | 6 +++++ lib_com/ivas_prot.h | 7 +++++ lib_com/options.h | 7 +++-- lib_com/prot.h | 12 +++++++++ lib_dec/core_dec_init.c | 15 +++++++++-- lib_dec/core_dec_switch.c | 7 ++++- lib_dec/evs_dec.c | 7 ++++- lib_dec/init_dec.c | 3 ++- lib_dec/ivas_sce_dec.c | 11 ++++++++ lib_dec/ivas_tcx_core_dec.c | 14 ++++++++-- lib_enc/bw_detect.c | 15 ++++++++++- lib_enc/core_enc_init.c | 14 ++++++++-- lib_enc/core_enc_switch.c | 21 ++++++++++++--- lib_enc/init_enc.c | 8 ++++++ lib_enc/ivas_core_enc.c | 7 ++++- lib_enc/ivas_core_pre_proc.c | 14 +++++++++- lib_enc/ivas_core_pre_proc_front.c | 11 +++++++- lib_enc/ivas_cpe_enc.c | 17 +++++++++++-- lib_enc/ivas_decision_matrix_enc.c | 15 +++++++++++ lib_enc/ivas_ism_dtx_enc.c | 7 ++++- lib_enc/ivas_ism_enc.c | 8 +++++- lib_enc/ivas_sce_enc.c | 7 ++++- lib_enc/ivas_tcx_core_enc.c | 7 ++++- lib_enc/pre_proc.c | 7 ++++- lib_enc/stat_enc.h | 4 +++ lib_enc/updt_enc.c | 7 ++++- 27 files changed, 273 insertions(+), 26 deletions(-) diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 7f9b385c3f..3d37fb03b6 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -166,6 +166,10 @@ int16_t getTcxonly( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ +#ifdef ISM_25k6_HZ_CORE + , + const int16_t is_ism_format +#endif ) { int16_t tcxonly = 0; @@ -179,6 +183,24 @@ int16_t getTcxonly( } break; case IVAS_SCE: +#ifdef ISM_25k6_HZ_CORE + if ( is_ism_format ) + { + if ( total_brate > MAX_ACELP_BRATE_ISM ) + { + tcxonly = 1; + } + } + else + { + if ( total_brate > MAX_ACELP_BRATE ) + { + tcxonly = 1; + } + } + break; + +#endif case IVAS_CPE_DFT: case IVAS_CPE_TD: if ( total_brate > MAX_ACELP_BRATE ) @@ -341,6 +363,10 @@ int32_t getCoreSamplerateMode2( const int16_t bwidth, /* i : audio bandwidth */ const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ const int16_t rf_mode /* i : flag to signal the RF mode */ +#ifdef ISM_25k6_HZ_CORE + , + const IVAS_FORMAT is_ism_format +#endif ) { int32_t sr_core = 0; @@ -361,10 +387,25 @@ int32_t getCoreSamplerateMode2( { sr_core = INT_FS_16k; } +#ifdef ISM_25k6_HZ_CORE + else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && !is_ism_format ) + { + sr_core = INT_FS_16k; + } + else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE_ISM && element_mode == IVAS_SCE && is_ism_format ) + { + sr_core = INT_FS_16k; + } + else if ( ( bwidth == SWB || bwidth == FB ) && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && is_ism_format ) + { + sr_core = 25600; + } +#else else if ( ( bwidth == SWB && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE ) || ( bwidth == FB && total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE ) ) { sr_core = INT_FS_16k; } +#endif else if ( ( ( bwidth == SWB || bwidth == FB ) && element_mode == EVS_MONO && total_brate <= HQ_64k ) || ( element_mode > IVAS_SCE && ( ( bwidth == SWB && total_brate <= IVAS_96k ) || ( bwidth == FB && total_brate <= IVAS_96k ) ) ) ) { sr_core = 25600; diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index f709195ad0..38cbd94a72 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -290,6 +290,9 @@ typedef enum #define MAX_VOICED_BRATE ACELP_13k20 /* max. per channel bitrate where VOICED is supported */ #define MIN_TC_BRATE 6450 /* min. per channel bitrate where TRANSITION is supported */ #define MAX_ACELP_BRATE 48000 /* max. per channel bitrate where ACELP core is supported */ +#ifdef ISM_25k6_HZ_CORE +#define MAX_ACELP_BRATE_ISM 40000 /* max. per channel bitrate where ACELP core is supported in ISM format */ +#endif #define ACELP_12k8_HIGH_LIMIT 24350 /* max. per channel bitrate where the ACELP@12.8kHz is supported */ #define ACELP_16k_LOW_LIMIT 13250 /* min. per channel bitrate where the ACELP@16kHz is supported */ @@ -317,6 +320,9 @@ typedef enum #define MIN_BRATE_SWB_SCE ACELP_9k60 /* min. SCE bitrate where SWB is supported */ #define MIN_BRATE_SWB_STEREO IVAS_13k2 /* min. stereo bitrate where SWB is supported */ #define MIN_BRATE_FB_STEREO IVAS_32k /* min. SCE and stereo bitrate where FB is supported */ +#ifdef ISM_FB +#define MIN_BRATE_FB_STEREO_ISM 24000 /* min. SCE bitrate where FB is supported in ISM format */ +#endif #define MIN_TDM_BRATE_WB_TBE_1k05 12000 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ #define MIN_BRATE_WB_TBE_1k05 9650 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ace91a63eb..44962f68e3 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -203,6 +203,9 @@ ivas_error pre_proc_front_ivas( const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const int32_t ivas_total_brate /* i : IVAS total bitrate */ +#ifdef ISM_FB + ,const ISM_MODE ism_mode +#endif ); ivas_error pre_proc_ivas( @@ -584,6 +587,10 @@ void ivas_signaling_enc( const int32_t element_brate, /* i : element bitrate */ const int16_t tdm_SM_flag, /* i : channel combination scheme flag in TD stereo */ const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo*/ +#ifdef ISM_FB + , + const ISM_MODE ism_mode +#endif ); void ivas_decision_matrix_dec( diff --git a/lib_com/options.h b/lib_com/options.h index 240263cf77..53a524d740 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -222,8 +222,11 @@ -#define ISM_16_KHZ_CORE // change starting bitrate of core-coder with 16kHz internal sampling rate from 17 kbps to 15.9 kbps - // VE: 4ISM 64 kbps extend metadata cases might fail due to too high bitbudget for ext. MD + 4 x 16kHz core +#define ISM_16_KHZ_CORE // 1ISM 16.4 kbps: change starting bitrate of core-coder with 16kHz internal sampling rate from 17 kbps to 15.9 kbps +#define ISM_FB // 1ISM 32 kbps: change SWB to FB coding +#define ISM_25k6_HZ_CORE // 1ISM 48 kbps: change ACELP/TCX 16 kHz core to TCX only 25.6 kHz core + + /* ################## End DEVELOPMENT switches ######################### */ /* clang-format on */ diff --git a/lib_com/prot.h b/lib_com/prot.h index b290372d4f..dee228e4c4 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3834,6 +3834,10 @@ void set_bw( const int32_t element_brate, /* i : element bitrate */ Encoder_State *st, /* i/o: Encoder State */ const int16_t codec_mode /* i : codec mode */ +#ifdef ISM_FB + , + const ISM_MODE ism_mode +#endif ); float gaus_encode( @@ -9712,6 +9716,10 @@ int16_t getTcxonly( const int16_t element_mode, /* i : IVAS element mode */ const int32_t total_brate, /* i : total bitrate */ const int16_t MCT_flag /* i : hMCT handle allocated (1) or not (0)*/ +#ifdef ISM_25k6_HZ_CORE + , + const int16_t is_ism_format +#endif ); int16_t getTnsAllowed( @@ -9749,6 +9757,10 @@ int32_t getCoreSamplerateMode2( const int16_t bwidth, /* i : audio bandwidth */ const int16_t flag_ACELP16k, /* i : ACELP@16kHz flag */ const int16_t rf_mode /* i : flag to signal the RF mode */ +#ifdef ISM_25k6_HZ_CORE + , + const IVAS_FORMAT is_ism_format +#endif ); float getTcxBandwidth( diff --git a/lib_dec/core_dec_init.c b/lib_dec/core_dec_init.c index aa8f576cec..d54ffe330e 100644 --- a/lib_dec/core_dec_init.c +++ b/lib_dec/core_dec_init.c @@ -73,7 +73,13 @@ void open_decoder_LPD( { st->fscale_old = st->fscale; } - st->sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag ); + + st->sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->fscale = sr2fscale( st->sr_core ); fscaleFB = sr2fscale( st->output_Fs ); @@ -92,7 +98,12 @@ void open_decoder_LPD( } } - st->tcxonly = getTcxonly( st->element_mode, total_brate, MCT_flag ); + st->tcxonly = getTcxonly( st->element_mode, total_brate, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); /* the TD TCX PLC in MODE1 still runs with 80ms subframes */ if ( ( st->element_mode == EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= ACELP_32k ) || ( st->element_mode > EVS_MONO && st->L_frame == L_FRAME16k && total_brate <= MAX_ACELP_BRATE ) || ( st->tcxonly && ( st->sr_core == 32000 || st->sr_core == 16000 ) ) ) diff --git a/lib_dec/core_dec_switch.c b/lib_dec/core_dec_switch.c index ef0a12696f..3a5f163343 100644 --- a/lib_dec/core_dec_switch.c +++ b/lib_dec/core_dec_switch.c @@ -72,7 +72,12 @@ void mode_switch_decoder_LPD( { bSwitchFromAmrwbIO = 1; } - sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag ); + sr_core = getCoreSamplerateMode2( st->element_mode, total_brate, bwidth, st->flag_ACELP16k, st->rf_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); fscale = sr2fscale( sr_core ); /* set number of coded lines */ diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 0d55b54762..74454a4676 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -187,7 +187,12 @@ ivas_error evs_dec( } /* if previous frame was HQ Core/TCX10/TCX20 (high bitrate), drop partial copy info and continue HQ Core/TCX10/TCX20 concealment */ - if ( st->use_partial_copy && ( st->last_core == HQ_CORE || st->last_core == TCX_10_CORE || ( st->last_core == TCX_20_CORE && getTcxonly( EVS_MONO, st->last_total_brate, 0 ) ) ) ) + if ( st->use_partial_copy && ( st->last_core == HQ_CORE || st->last_core == TCX_10_CORE || ( st->last_core == TCX_20_CORE && getTcxonly( EVS_MONO, st->last_total_brate, 0 +#ifdef ISM_25k6_HZ_CORE + , + 0 +#endif + ) ) ) ) { st->bfi = 1; st->codec_mode = st->last_codec_mode; diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index 45030137c3..c90672a29a 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -743,8 +743,9 @@ ivas_error init_decoder( #ifndef FIX_ISM_DTX_CNG_BWIDTH_ALT st->read_sid_info = 1; /* by default read the sid info from bitstream */ #endif +#ifndef ISM_25k6_HZ_CORE st->is_ism_format = 0; - +#endif return error; } diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index a9ae521f74..b27fc9de88 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -129,7 +129,11 @@ ivas_error ivas_sce_dec( /* only WB is supported */ st->bwidth = WB; } +#ifdef ISM_FB + else if ( ( hSCE->element_brate < MIN_BRATE_FB_STEREO_ISM && st_ivas->ism_mode != ISM_MODE_NONE ) || ( hSCE->element_brate < MIN_BRATE_FB_STEREO && st_ivas->ism_mode == ISM_MODE_NONE ) ) +#else else if ( hSCE->element_brate < MIN_BRATE_FB_STEREO ) +#endif { /* WB and SWB are supported */ st->bwidth = get_next_indice( st, 1 ) + WB; @@ -370,6 +374,13 @@ ivas_error create_sce_dec( st->total_brate = hSCE->element_brate; /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifdef ISM_25k6_HZ_CORE + st->is_ism_format = 0; + if ( st_ivas->ivas_format == ISM_FORMAT ) + { + st->is_ism_format = 1; + } +#endif if ( ( error = init_decoder( st, 0, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_tcx_core_dec.c b/lib_dec/ivas_tcx_core_dec.c index ab82fb4e07..20811618bd 100644 --- a/lib_dec/ivas_tcx_core_dec.c +++ b/lib_dec/ivas_tcx_core_dec.c @@ -75,7 +75,12 @@ void stereo_tcx_init_dec( st->core_brate = st->total_brate; /*sampling rate*/ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->fscale = sr2fscale( st->sr_core ); /*frame size*/ @@ -109,7 +114,12 @@ void stereo_tcx_init_dec( if ( st->element_mode == IVAS_SCE ) { - st->tcxonly = getTcxonly( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, MCT_flag ); + st->tcxonly = getTcxonly( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); /* LPC quantization */ if ( st->sr_core <= INT_FS_16k && st->tcxonly == 0 ) diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 6de35a211a..2c92fe5a59 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -512,7 +512,12 @@ void bw_detect( if ( st->element_mode == EVS_MONO ) { - set_bw( -1, -1, st, st->codec_mode ); + set_bw( -1, -1, st, st->codec_mode +#ifdef ISM_FB + , + ISM_MODE_NONE +#endif + ); } return; @@ -529,6 +534,10 @@ void set_bw( const int32_t element_brate, /* i : element bitrate */ Encoder_State *st, /* i/o: Encoder State */ const int16_t codec_mode /* i : codec mode */ +#ifdef ISM_FB + , + const ISM_MODE ism_mode +#endif ) { /* initialization */ @@ -573,7 +582,11 @@ void set_bw( { st->bwidth = WB; } +#ifdef ISM_FB + else if ( ( ( element_brate < MIN_BRATE_FB_STEREO_ISM && ism_mode != ISM_MODE_NONE ) || ( element_brate < MIN_BRATE_FB_STEREO && ism_mode == ISM_MODE_NONE ) ) && st->bwidth > SWB ) +#else else if ( element_brate < MIN_BRATE_FB_STEREO && st->bwidth > SWB ) +#endif { st->bwidth = SWB; } diff --git a/lib_enc/core_enc_init.c b/lib_enc/core_enc_init.c index 774b1398c5..65190ce992 100644 --- a/lib_enc/core_enc_init.c +++ b/lib_enc/core_enc_init.c @@ -72,10 +72,20 @@ void init_coder_ace_plus( int16_t L_subfr; /* Bitrate */ - st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); + st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); /* Core Sampling Rate */ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->fscale = sr2fscale( st->sr_core ); /* Narrowband? */ diff --git a/lib_enc/core_enc_switch.c b/lib_enc/core_enc_switch.c index d6c866d4c5..4ccf86eb21 100644 --- a/lib_enc/core_enc_switch.c +++ b/lib_enc/core_enc_switch.c @@ -69,7 +69,12 @@ void core_coder_mode_switch( } /* force active frame for the first frame when switching from high bitrates when DTX is enabled*/ - sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + sr_core = getCoreSamplerateMode2( st->element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); fscale = sr2fscale( sr_core ); @@ -79,7 +84,12 @@ void core_coder_mode_switch( switchWB = 1; /*force init when coming from MODE1*/ } - tcxonly_tmp = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); + tcxonly_tmp = getTcxonly( st->element_mode, st->total_brate, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); if ( tcxonly_tmp != st->tcxonly ) { @@ -91,7 +101,12 @@ void core_coder_mode_switch( st->sr_core = sr_core; st->L_frame = (int16_t) ( sr_core / FRAMES_PER_SEC ); - st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag ); + st->tcxonly = getTcxonly( st->element_mode, st->total_brate, MCT_flag +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->bits_frame_nominal = (int16_t) ( (float) st->L_frame / (float) st->fscale * (float) FSCALE_DENOM / 128.0f * (float) st->total_brate / 100.0f + 0.49f ); diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 7b57389ad8..c80f06f732 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -106,6 +106,14 @@ ivas_error init_encoder( st->flag_ACELP16k = set_ACELP_flag( st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); #endif +#ifdef ISM_25k6_HZ_CORE + st->is_ism_format = 0; + if ( ism_mode != ISM_MODE_NONE ) + { + st->is_ism_format = 1; + } +#endif + /*-----------------------------------------------------------------* * Bitstream *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index c2627b923b..ab730db9f1 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -201,7 +201,12 @@ ivas_error ivas_core_enc( if ( !MCT_flag || ( MCT_flag && cpe_id == 0 ) ) { - ivas_signaling_enc( st, MCT_flag, element_brate, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag ); + ivas_signaling_enc( st, MCT_flag, element_brate, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag +#ifdef ISM_FB + , + ivas_format == ISM_FORMAT ? ISM_MODE_DISC : ISM_MODE_NONE +#endif + ); } /*---------------------------------------------------------------------* diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index 7a0d25ddfa..ef6465162d 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -129,6 +129,12 @@ ivas_error pre_proc_ivas( { st->L_frame = L_FRAME32k; } +#ifdef ISM_25k6_HZ_CORE + else if ( st->bwidth >= FB && st->total_brate > MAX_ACELP_BRATE_ISM && st->total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && st->is_ism_format && st->tcxonly ) + { + st->L_frame = L_FRAME25_6k; + } +#endif else if ( st->flag_ACELP16k ) { st->L_frame = L_FRAME16k; @@ -236,7 +242,13 @@ ivas_error pre_proc_ivas( total_brate_tmp = st->total_brate; st->total_brate = st->bits_frame_nominal * FRAMES_PER_SEC; SetModeIndex( st, st->last_bits_frame_nominal * FRAMES_PER_SEC, last_element_mode, MCT_flag ); - st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + + st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->total_brate = total_brate_tmp; st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 5f775d2403..acfb27da72 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -108,6 +108,10 @@ ivas_error pre_proc_front_ivas( const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ +#ifdef ISM_FB + , + const ISM_MODE ism_mode +#endif ) { @@ -485,7 +489,12 @@ ivas_error pre_proc_front_ivas( if ( element_mode != IVAS_CPE_MDCT ) /* in MDCT stereo, set_bw_stereo() is used instead */ { - set_bw( element_mode, element_brate, st, MODE1 ); + set_bw( element_mode, element_brate, st, MODE1 +#ifdef ISM_FB + , + ism_mode +#endif + ); } /* set the BW of the TD secondary channel in LRTD mode same as BW of the primary channel (only at higher bitrates) */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 416614bf6e..d45e6f6af6 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -392,7 +392,14 @@ ivas_error ivas_cpe_enc( { int32_t internal_Fs; - internal_Fs = getTcxonly( IVAS_CPE_MDCT, sts[0]->bits_frame_nominal * FRAMES_PER_SEC, 0 ) == 0 ? INT_FS_16k : max( INT_FS_16k, sts[0]->sr_core ); + internal_Fs = getTcxonly( IVAS_CPE_MDCT, sts[0]->bits_frame_nominal * FRAMES_PER_SEC, 0 +#ifdef ISM_25k6_HZ_CORE + , + sts[0]->is_ism_format +#endif + ) == 0 + ? INT_FS_16k + : max( INT_FS_16k, sts[0]->sr_core ); /* iDFT at input sampling rate */ stereo_dft_enc_synthesize( hCPE->hStereoDft, sts[0]->input, 0, input_Fs, input_Fs, 0 ); @@ -442,7 +449,13 @@ ivas_error ivas_cpe_enc( &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, - ivas_total_brate ); + ivas_total_brate +#ifdef ISM_FB + , + ISM_MODE_NONE +#endif + + ); if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index b894932958..2f5f9e0201 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -179,6 +179,13 @@ void ivas_decision_matrix_enc( st->core = ACELP_CORE; } +#ifdef ISM_25k6_HZ_CORE + if ( st->is_ism_format && st->tcxonly ) + { + st->core = TCX_20_CORE; + } +#endif + #ifdef DEBUGGING if ( st->idchan == 0 ) { @@ -379,6 +386,10 @@ void ivas_signaling_enc( const int32_t element_brate, /* i : element bitrate */ const int16_t tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo */ +#ifdef ISM_FB + , + const ISM_MODE ism_mode +#endif ) { int16_t ind; @@ -420,7 +431,11 @@ void ivas_signaling_enc( { /* only WB is supported */ } +#ifdef ISM_FB + else if ( ( element_brate < MIN_BRATE_FB_STEREO_ISM && ism_mode != ISM_MODE_NONE ) || ( element_brate < MIN_BRATE_FB_STEREO && ism_mode == ISM_MODE_NONE ) ) +#else else if ( element_brate < MIN_BRATE_FB_STEREO ) +#endif { /* WB and SWB are supported */ ind = st->bwidth - WB; diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index 3a216b6164..a99c00128a 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -242,7 +242,12 @@ int16_t ivas_ism_dtx_enc( for ( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->core_brate = -1; - set_bw( IVAS_SCE, hSCE[ch]->element_brate, hSCE[ch]->hCoreCoder[0], MODE1 ); + set_bw( IVAS_SCE, hSCE[ch]->element_brate, hSCE[ch]->hCoreCoder[0], MODE1 +#ifdef ISM_FB + , + -1 // VE: not really correct !!!!! +#endif + ); } hISMDTX->cnt_SID_ISM = -1; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index b78f218811..307c4161cc 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -162,7 +162,13 @@ ivas_error ivas_ism_enc( &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, - st_ivas->hEncoderConfig->ivas_total_brate ); + st_ivas->hEncoderConfig->ivas_total_brate +#ifdef ISM_FB + , + st_ivas->ism_mode +#endif + + ); if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index df0faf71c0..abe12d41bd 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -185,7 +185,12 @@ ivas_error ivas_sce_enc( &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, - st_ivas->hEncoderConfig->ivas_total_brate ); + st_ivas->hEncoderConfig->ivas_total_brate +#ifdef ISM_FB + , + ISM_MODE_NONE +#endif + ); if ( error != IVAS_ERR_OK ) { return error; diff --git a/lib_enc/ivas_tcx_core_enc.c b/lib_enc/ivas_tcx_core_enc.c index e334f4d029..b57ab9a649 100644 --- a/lib_enc/ivas_tcx_core_enc.c +++ b/lib_enc/ivas_tcx_core_enc.c @@ -79,7 +79,12 @@ void stereo_tcx_init_enc( } /*sampling rate*/ - st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + st->sr_core = getCoreSamplerateMode2( st->element_mode, st->bits_frame_nominal * FRAMES_PER_SEC, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + st->is_ism_format +#endif + ); st->fscale = sr2fscale( st->sr_core ); /*frame size*/ diff --git a/lib_enc/pre_proc.c b/lib_enc/pre_proc.c index 82436a7dfc..e3f672c101 100644 --- a/lib_enc/pre_proc.c +++ b/lib_enc/pre_proc.c @@ -600,7 +600,12 @@ void pre_proc( else { SetModeIndex( st, st->last_total_brate, EVS_MONO, 0 ); - st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + 0 +#endif + ); st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); st->encoderLookahead_enc = NS2SA( st->sr_core, ACELP_LOOK_NS ); st->encoderPastSamples_enc = ( st->L_frame * 9 ) >> 4; diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index ec7fb594d1..928f883c0a 100644 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1550,6 +1550,10 @@ typedef struct enc_core_structure /* MCT Channel mode indication: LFE, ignore channel? */ MCT_CHAN_MODE mct_chan_mode; +#ifdef ISM_25k6_HZ_CORE + int16_t is_ism_format; /* Indication whether the codec operates in ISM format */ +#endif + int16_t dtx_sce_sba; /* enable use of FD CNG with transform domain cores in SCE SBA */ } Encoder_State, *ENC_CORE_HANDLE; diff --git a/lib_enc/updt_enc.c b/lib_enc/updt_enc.c index 6b8c595f5e..ecfd51b659 100644 --- a/lib_enc/updt_enc.c +++ b/lib_enc/updt_enc.c @@ -393,7 +393,12 @@ void updt_enc_common( { st->codec_mode = MODE2; - st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode ); + st->sr_core = getCoreSamplerateMode2( EVS_MONO, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode +#ifdef ISM_25k6_HZ_CORE + , + 0 +#endif + ); st->L_frame = (int16_t) ( st->sr_core / FRAMES_PER_SEC ); -- GitLab From 6f22a699279870c62f2c1ee7d3303f6741f1cee4 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 7 Jun 2023 15:54:57 +0200 Subject: [PATCH 4/6] keep only ISM_25k6_HZ_CORE switch - correct FB -> SWB decision logic --- lib_com/bits_alloc.c | 9 -------- lib_com/core_com_config.c | 2 +- lib_com/ivas_cnst.h | 10 --------- lib_com/ivas_ism_com.c | 34 ++++-------------------------- lib_com/ivas_prot.h | 10 --------- lib_com/options.h | 6 +----- lib_com/prot.h | 9 +------- lib_dec/evs_dec.c | 4 ---- lib_dec/init_dec.c | 4 ---- lib_dec/ivas_cpe_dec.c | 4 ---- lib_dec/ivas_ism_dec.c | 4 ---- lib_dec/ivas_ism_metadata_dec.c | 8 ------- lib_dec/ivas_sce_dec.c | 8 ------- lib_enc/bw_detect.c | 15 +------------ lib_enc/evs_enc.c | 4 ---- lib_enc/init_enc.c | 4 ---- lib_enc/ivas_core_enc.c | 7 +----- lib_enc/ivas_core_pre_proc.c | 2 +- lib_enc/ivas_core_pre_proc_front.c | 12 +---------- lib_enc/ivas_cpe_enc.c | 16 +------------- lib_enc/ivas_decision_matrix_enc.c | 8 ------- lib_enc/ivas_ism_dtx_enc.c | 7 +----- lib_enc/ivas_ism_enc.c | 20 +----------------- lib_enc/ivas_ism_metadata_enc.c | 8 ------- lib_enc/ivas_sce_enc.c | 15 +------------ 25 files changed, 15 insertions(+), 215 deletions(-) diff --git a/lib_com/bits_alloc.c b/lib_com/bits_alloc.c index 14f75199be..56e523b392 100644 --- a/lib_com/bits_alloc.c +++ b/lib_com/bits_alloc.c @@ -1477,9 +1477,6 @@ static int16_t allocate_unused( /*! r: ACELP16k flag */ int16_t set_ACELP_flag( -#ifdef ISM_16_KHZ_CORE - const ISM_MODE ism_mode, /* i : ISM mode */ -#endif const int16_t element_mode, /* i : element mode */ const int32_t element_brate, /* i : element bitrate */ const int32_t total_brate, /* i : total bitrate per channel */ @@ -1518,12 +1515,6 @@ int16_t set_ACELP_flag( } else if ( element_mode == IVAS_SCE ) { -#ifdef ISM_16_KHZ_CORE - if ( ism_mode == ISM_MODE_DISC && element_brate >= SCE_CORE_16k_LOW_LIMIT_ISM ) - { - return 1; - } -#endif if ( element_brate >= SCE_CORE_16k_LOW_LIMIT ) { return 1; diff --git a/lib_com/core_com_config.c b/lib_com/core_com_config.c index 787d2f0c6e..20f5032e14 100644 --- a/lib_com/core_com_config.c +++ b/lib_com/core_com_config.c @@ -365,7 +365,7 @@ int32_t getCoreSamplerateMode2( const int16_t rf_mode /* i : flag to signal the RF mode */ #ifdef ISM_25k6_HZ_CORE , - const IVAS_FORMAT is_ism_format + const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */ #endif ) { diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 662fdfc358..416bb914fe 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -291,9 +291,6 @@ typedef enum #define ACELP_12k8_HIGH_LIMIT 24350 /* max. per channel bitrate where the ACELP@12.8kHz is supported */ #define ACELP_16k_LOW_LIMIT 13250 /* min. per channel bitrate where the ACELP@16kHz is supported */ #define SCE_CORE_16k_LOW_LIMIT 17000 /* min. SCE bitrate where the ACELP@16kHz is supported; must be >= (ACELP_16k_LOW_LIMIT + SWB_TBE_1k6) */ -#ifdef ISM_16_KHZ_CORE -#define SCE_CORE_16k_LOW_LIMIT_ISM 15900 /* min. SCE bitrate where the ACELP@16kHz is supported; must be >= (ACELP_16k_LOW_LIMIT + SWB_TBE_1k6) */ -#endif #define MIN_BRATE_AVQ_EXC ACELP_29k00 /* min. per channel bitrate where the AVQ excitation stage is supported */ #define MAX_BRATE_AVQ_EXC_TD 40000 /* max. per channel bitrate where the AVQ excitation stage in time domain is supported */ @@ -314,9 +311,6 @@ typedef enum #define MIN_BRATE_SWB_SCE ACELP_9k60 /* min. SCE bitrate where SWB is supported */ #define MIN_BRATE_SWB_STEREO IVAS_13k2 /* min. stereo bitrate where SWB is supported */ #define MIN_BRATE_FB_STEREO IVAS_32k /* min. SCE and stereo bitrate where FB is supported */ -#ifdef ISM_FB -#define MIN_BRATE_FB_STEREO_ISM 24000 /* min. SCE bitrate where FB is supported in ISM format */ -#endif #define MIN_TDM_BRATE_WB_TBE_1k05 12000 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ #define MIN_BRATE_WB_TBE_1k05 9650 /* min. per channel bitrate where WB TBE @1.05 kbps is supported (0.35kbs at lower bitrates) */ @@ -334,11 +328,7 @@ typedef enum * ISM Constants *----------------------------------------------------------------------------------*/ -#ifdef ISM_16_KHZ_CORE -#define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT_ISM - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ -#else #define ISM_NB_BITS_METADATA_NOMINAL ( ( SCE_CORE_16k_LOW_LIMIT - ACELP_16k_LOW_LIMIT ) / FRAMES_PER_SEC ) /* nominal number of metadata bits - used for configuration of Core-Coder modules */ -#endif #define ISM_METADATA_VAD_FLAG_BITS 1 #define ISM_METADATA_FLAG_BITS 2 diff --git a/lib_com/ivas_ism_com.c b/lib_com/ivas_ism_com.c index ac073e6481..a28fb77d20 100644 --- a/lib_com/ivas_ism_com.c +++ b/lib_com/ivas_ism_com.c @@ -88,13 +88,10 @@ static void bitbudget_to_brate( *-------------------------------------------------------------------*/ ivas_error ivas_ism_config( - const int32_t ism_total_brate, /* i : ISM total bitrate */ - const int16_t nchan_transport, /* i : number of transport channels */ - const int16_t nchan_ism, /* i : number of objects */ - ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ -#ifdef ISM_16_KHZ_CORE - const ISM_MODE ism_mode, /* i : ISM mode */ -#endif + const int32_t ism_total_brate, /* i : ISM total bitrate */ + const int16_t nchan_transport, /* i : number of transport channels */ + const int16_t nchan_ism, /* i : number of objects */ + ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ const int16_t ism_imp[], /* i : ISM importance flags */ @@ -110,23 +107,12 @@ ivas_error ivas_ism_config( int16_t tmp; int16_t ism_metadata_flag_global; int16_t n_ISms; -#ifdef ISM_16_KHZ_CORE - int32_t sce_core_16k_limit; -#endif ivas_error error; error = IVAS_ERR_OK; n_ISms = nchan_transport; -#ifdef ISM_16_KHZ_CORE - sce_core_16k_limit = SCE_CORE_16k_LOW_LIMIT_ISM; - if ( ism_mode == ISM_MODE_PARAM || ism_extended_metadata_flag ) - { - sce_core_16k_limit = SCE_CORE_16k_LOW_LIMIT; - } -#endif - /* initialization */ ism_metadata_flag_global = 0; bits_side = 0; @@ -231,17 +217,9 @@ ivas_error ivas_ism_config( { limit = MIN_BRATE_WB_BWE / FRMS_PER_SECOND; } -#ifdef ISM_16_KHZ_CORE - else if ( element_brate[ch] >= sce_core_16k_limit ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ -#else else if ( element_brate[ch] >= SCE_CORE_16k_LOW_LIMIT ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ -#endif { -#ifdef ISM_16_KHZ_CORE - /*limit = sce_core_16k_limit;*/ -#else /*limit = SCE_CORE_16k_LOW_LIMIT;*/ -#endif limit = ( ACELP_16k_LOW_LIMIT + SWB_TBE_1k6 ) / FRMS_PER_SECOND; } @@ -293,11 +271,7 @@ ivas_error ivas_ism_config( for ( ch = 0; ch < n_ISms; ch++ ) { limit_high = IVAS_512k / FRMS_PER_SECOND; -#ifdef ISM_16_KHZ_CORE - if ( element_brate[ch] < sce_core_16k_limit ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ -#else if ( element_brate[ch] < SCE_CORE_16k_LOW_LIMIT ) /* replicate function set_ACELP_flag() -> it is not intended to switch the ACELP internal sampling rate within an object */ -#endif { limit_high = ACELP_12k8_HIGH_LIMIT / FRMS_PER_SECOND; } diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 4f494116f8..ae25a9f898 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -214,9 +214,6 @@ ivas_error pre_proc_front_ivas( const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const int32_t ivas_total_brate /* i : IVAS total bitrate */ -#ifdef ISM_FB - ,const ISM_MODE ism_mode -#endif ); ivas_error pre_proc_ivas( @@ -591,10 +588,6 @@ void ivas_signaling_enc( const int32_t element_brate, /* i : element bitrate */ const int16_t tdm_SM_flag, /* i : channel combination scheme flag in TD stereo */ const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo*/ -#ifdef ISM_FB - , - const ISM_MODE ism_mode -#endif ); void ivas_decision_matrix_dec( @@ -879,9 +872,6 @@ ivas_error ivas_ism_config( const int16_t nchan_transport, /* i : number of transport channels */ const int16_t nchan_ism, /* i : number of objects */ ISM_METADATA_HANDLE hIsmMeta[], /* i/o: ISM metadata handles */ -#ifdef ISM_16_KHZ_CORE - const ISM_MODE ism_mode, /* i : ISM mode */ -#endif const int16_t ism_extended_metadata_flag, /* i : extended metadata flag */ const int16_t localVAD[MAX_NUM_OBJECTS], /* i : local VAD flag */ const int16_t ism_imp[], /* i : ISM importance flags */ diff --git a/lib_com/options.h b/lib_com/options.h index e756e035cc..fd47747186 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -174,11 +174,7 @@ #define EXTERNAL_ORIENTATIONS /* Nokia: Contribution 41: (external) orientation information handling */ #define MASA_PREREND /* Nokia: Contribution 42: Support for IVAS_rend to merge MASA + other format to MASA */ - - -#define ISM_16_KHZ_CORE // 1ISM 16.4 kbps: change starting bitrate of core-coder with 16kHz internal sampling rate from 17 kbps to 15.9 kbps -#define ISM_FB // 1ISM 32 kbps: change SWB to FB coding -#define ISM_25k6_HZ_CORE // 1ISM 48 kbps: change ACELP/TCX 16 kHz core to TCX only 25.6 kHz core +#define ISM_25k6_HZ_CORE /* VA: issue 540: 1ISM 48 kbps - change ACELP/TCX 16 kHz core to TCX only 25.6 kHz core */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 6ea66971dc..39b2f6372e 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -3899,10 +3899,6 @@ void set_bw( const int32_t element_brate, /* i : element bitrate */ Encoder_State *st, /* i/o: Encoder State */ const int16_t codec_mode /* i : codec mode */ -#ifdef ISM_FB - , - const ISM_MODE ism_mode -#endif ); float gaus_encode( @@ -9137,9 +9133,6 @@ ivas_error config_acelp1( /*! r: ACELP16k flag */ int16_t set_ACELP_flag( -#ifdef ISM_16_KHZ_CORE - const ISM_MODE ism_mode, /* i : ISM mode */ -#endif const int16_t element_mode, /* i : element mode */ const int32_t element_brate, /* i : element bitrate */ const int32_t total_brate, /* i : total bitrate per channel */ @@ -9816,7 +9809,7 @@ int32_t getCoreSamplerateMode2( const int16_t rf_mode /* i : flag to signal the RF mode */ #ifdef ISM_25k6_HZ_CORE , - const IVAS_FORMAT is_ism_format + const IVAS_FORMAT is_ism_format /* i : flag indicating ISM format */ #endif ); diff --git a/lib_dec/evs_dec.c b/lib_dec/evs_dec.c index 05dc675ab0..1be8873271 100644 --- a/lib_dec/evs_dec.c +++ b/lib_dec/evs_dec.c @@ -92,11 +92,7 @@ ivas_error evs_dec( *-----------------------------------------------------------------*/ st->idchan = 0; -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); -#endif tmps = 0; delay_tdbwe = 0; diff --git a/lib_dec/init_dec.c b/lib_dec/init_dec.c index df5edf3baa..23656c924e 100644 --- a/lib_dec/init_dec.c +++ b/lib_dec/init_dec.c @@ -90,11 +90,7 @@ ivas_error init_decoder( st->last_core = -1; st->last_extl = st->extl; -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); -#endif /*-----------------------------------------------------------------* * ACELP core parameters diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index d183f8e09e..948b475c74 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -305,11 +305,7 @@ ivas_error ivas_cpe_dec( for ( n = 0; n < n_channels; n++ ) { /* set ACELP12k8 / ACELP16k flag for flexible ACELP core */ -#ifdef ISM_16_KHZ_CORE - sts[n]->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, hCPE->element_mode, hCPE->element_brate, sts[n]->total_brate, n, ( hCPE->hStereoTD != NULL ? hCPE->hStereoTD->tdm_LRTD_flag : 0 ), sts[n]->bwidth, sts[n]->cng_type ); -#else sts[n]->flag_ACELP16k = set_ACELP_flag( hCPE->element_mode, hCPE->element_brate, sts[n]->total_brate, n, ( hCPE->hStereoTD != NULL ? hCPE->hStereoTD->tdm_LRTD_flag : 0 ), sts[n]->bwidth, sts[n]->cng_type ); -#endif } for ( n = 0; n < n_channels; n++ ) diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 6e083f464b..5ad0ce08c7 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -77,11 +77,7 @@ static ivas_error ivas_ism_bitrate_switching( ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses_old, &numCldfbSyntheses_old ); st_ivas->ism_mode = ism_mode; -#ifdef ISM_16_KHZ_CORE - if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, ism_mode, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->nchan_ism, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index 6f526bfb7f..a39c496ab6 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -478,11 +478,7 @@ ivas_error ivas_ism_metadata_dec( if ( !bfi ) { -#ifdef ISM_16_KHZ_CORE - if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_mode, ism_extmeta_bitstream, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_config( ism_total_brate, *nchan_transport, nchan_ism, hIsmMeta, ism_extmeta_bitstream, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -587,11 +583,7 @@ ivas_error ivas_ism_metadata_dec_create( ivas_ism_reset_metadata( st_ivas->hIsmMetaData[ch] ); } -#ifdef ISM_16_KHZ_CORE - if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, st_ivas->ism_mode, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_config( st_ivas->hDecoderConfig->ivas_total_brate, n_ISms, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index 785fb851c8..37a283e451 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -123,11 +123,7 @@ ivas_error ivas_sce_dec( /* only WB is supported */ st->bwidth = WB; } -#ifdef ISM_FB - else if ( ( hSCE->element_brate < MIN_BRATE_FB_STEREO_ISM && st_ivas->ism_mode != ISM_MODE_NONE ) || ( hSCE->element_brate < MIN_BRATE_FB_STEREO && st_ivas->ism_mode == ISM_MODE_NONE ) ) -#else else if ( hSCE->element_brate < MIN_BRATE_FB_STEREO ) -#endif { /* WB and SWB are supported */ st->bwidth = get_next_indice( st, 1 ) + WB; @@ -204,11 +200,7 @@ ivas_error ivas_sce_dec( } else { -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( st_ivas->ism_mode, IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); -#endif } if ( is_DTXrate( ivas_total_brate ) ) diff --git a/lib_enc/bw_detect.c b/lib_enc/bw_detect.c index 570ea4412d..2e315608b3 100644 --- a/lib_enc/bw_detect.c +++ b/lib_enc/bw_detect.c @@ -511,12 +511,7 @@ void bw_detect( if ( st->element_mode == EVS_MONO ) { - set_bw( -1, -1, st, st->codec_mode -#ifdef ISM_FB - , - ISM_MODE_NONE -#endif - ); + set_bw( -1, -1, st, st->codec_mode ); } return; @@ -533,10 +528,6 @@ void set_bw( const int32_t element_brate, /* i : element bitrate */ Encoder_State *st, /* i/o: Encoder State */ const int16_t codec_mode /* i : codec mode */ -#ifdef ISM_FB - , - const ISM_MODE ism_mode -#endif ) { /* initialization */ @@ -581,11 +572,7 @@ void set_bw( { st->bwidth = WB; } -#ifdef ISM_FB - else if ( ( ( element_brate < MIN_BRATE_FB_STEREO_ISM && ism_mode != ISM_MODE_NONE ) || ( element_brate < MIN_BRATE_FB_STEREO && ism_mode == ISM_MODE_NONE ) ) && st->bwidth > SWB ) -#else else if ( element_brate < MIN_BRATE_FB_STEREO && st->bwidth > SWB ) -#endif { st->bwidth = SWB; } diff --git a/lib_enc/evs_enc.c b/lib_enc/evs_enc.c index f376a97d51..cc01594b79 100644 --- a/lib_enc/evs_enc.c +++ b/lib_enc/evs_enc.c @@ -124,11 +124,7 @@ ivas_error evs_enc( st->rate_switching_reset = 0; st->idchan = 0; -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( EVS_MONO, -1, st->total_brate, 0, 0, -1, -1 ); -#endif /*----------------------------------------------------------------* * set input samples buffer diff --git a/lib_enc/init_enc.c b/lib_enc/init_enc.c index 03658c107b..9e9a7ca4b2 100644 --- a/lib_enc/init_enc.c +++ b/lib_enc/init_enc.c @@ -103,11 +103,7 @@ ivas_error init_encoder( st->coder_type_raw = VOICED; st->last_coder_type_raw = st->coder_type_raw; -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( st->element_mode, st->total_brate, st->total_brate, idchan, 0, -1, -1 ); -#endif #ifdef ISM_25k6_HZ_CORE st->is_ism_format = 0; diff --git a/lib_enc/ivas_core_enc.c b/lib_enc/ivas_core_enc.c index d2c96df162..6536ee333e 100644 --- a/lib_enc/ivas_core_enc.c +++ b/lib_enc/ivas_core_enc.c @@ -221,12 +221,7 @@ ivas_error ivas_core_enc( if ( !MCT_flag || ( MCT_flag && cpe_id == 0 ) ) { - ivas_signaling_enc( st, MCT_flag, element_brate, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag -#ifdef ISM_FB - , - ivas_format == ISM_FORMAT ? ISM_MODE_DISC : ISM_MODE_NONE -#endif - ); + ivas_signaling_enc( st, MCT_flag, element_brate, tdm_SM_or_LRTD_Pri, tdm_Pitch_reuse_flag ); } /*---------------------------------------------------------------------* diff --git a/lib_enc/ivas_core_pre_proc.c b/lib_enc/ivas_core_pre_proc.c index ef6465162d..b6f86bb887 100644 --- a/lib_enc/ivas_core_pre_proc.c +++ b/lib_enc/ivas_core_pre_proc.c @@ -130,7 +130,7 @@ ivas_error pre_proc_ivas( st->L_frame = L_FRAME32k; } #ifdef ISM_25k6_HZ_CORE - else if ( st->bwidth >= FB && st->total_brate > MAX_ACELP_BRATE_ISM && st->total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && st->is_ism_format && st->tcxonly ) + else if ( st->bwidth >= SWB && st->total_brate > MAX_ACELP_BRATE_ISM && st->total_brate <= MAX_ACELP_BRATE && element_mode == IVAS_SCE && st->is_ism_format && st->tcxonly ) { st->L_frame = L_FRAME25_6k; } diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 12db1ac55c..cadecf5083 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -108,11 +108,6 @@ ivas_error pre_proc_front_ivas( const int16_t force_front_vad, /* i : flag to force VAD decision */ const int16_t front_vad_dtx_flag, /* i : front-VAD DTX flag to overwrite VAD decision*/ const int32_t ivas_total_brate /* i : IVAS total bitrate - for setting the DTX */ -#ifdef ISM_FB - , - const ISM_MODE ism_mode -#endif - ) { float *inp_12k8, *new_inp_12k8; /* pointers to current frame and new data */ @@ -489,12 +484,7 @@ ivas_error pre_proc_front_ivas( if ( element_mode != IVAS_CPE_MDCT ) /* in MDCT stereo, set_bw_stereo() is used instead */ { - set_bw( element_mode, element_brate, st, MODE1 -#ifdef ISM_FB - , - ism_mode -#endif - ); + set_bw( element_mode, element_brate, st, MODE1 ); } /* set the BW of the TD secondary channel in LRTD mode same as BW of the primary channel (only at higher bitrates) */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 4581f1c145..c66ee4e1a5 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -445,13 +445,7 @@ ivas_error ivas_cpe_enc( &ener[n], &relE[n], A[n], Aw[n], epsP[n], lsp_new[n], lsp_mid[n], &vad_hover_flag[n], &attack_flag[n], realBuffer[n], imagBuffer[n], old_wsp[n], pitch_fr[n], voicing_fr[n], &loc_harm[n], &cor_map_sum[n], &vad_flag_dtx[n], enerBuffer[n], fft_buff[n], A[0], lsp_new[0], currFlatness[n], tdm_ratio_idx, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, band_energies_LR, 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, 0, 0, - ivas_total_brate -#ifdef ISM_FB - , - ISM_MODE_NONE -#endif - - ); + ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -522,19 +516,11 @@ ivas_error ivas_cpe_enc( { if ( ( sts[0]->core_brate == SID_2k40 || sts[0]->core_brate == FRAME_NO_DATA ) && hCPE->element_mode == IVAS_CPE_DFT ) { -#ifdef ISM_16_KHZ_CORE - sts[n]->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, hCPE->element_mode, hCPE->element_brate, sts[n]->core_brate, n, sts[0]->tdm_LRTD_flag, sts[n]->bwidth, sts[n]->cng_type ); -#else sts[n]->flag_ACELP16k = set_ACELP_flag( hCPE->element_mode, hCPE->element_brate, sts[n]->core_brate, n, sts[0]->tdm_LRTD_flag, sts[n]->bwidth, sts[n]->cng_type ); -#endif } else { -#ifdef ISM_16_KHZ_CORE - sts[n]->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, hCPE->element_mode, hCPE->element_brate, sts[n]->total_brate, n, sts[0]->tdm_LRTD_flag, sts[n]->bwidth, sts[n]->cng_type ); -#else sts[n]->flag_ACELP16k = set_ACELP_flag( hCPE->element_mode, hCPE->element_brate, sts[n]->total_brate, n, sts[0]->tdm_LRTD_flag, sts[n]->bwidth, sts[n]->cng_type ); -#endif } } diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index 2f5f9e0201..f182a28a32 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -386,10 +386,6 @@ void ivas_signaling_enc( const int32_t element_brate, /* i : element bitrate */ const int16_t tdm_SM_or_LRTD_Pri, /* i : channel combination scheme flag in TD stereo OR LRTD primary channel */ const int16_t tdm_Pitch_reuse_flag /* i : primary channel pitch reuse flag in TD stereo */ -#ifdef ISM_FB - , - const ISM_MODE ism_mode -#endif ) { int16_t ind; @@ -431,11 +427,7 @@ void ivas_signaling_enc( { /* only WB is supported */ } -#ifdef ISM_FB - else if ( ( element_brate < MIN_BRATE_FB_STEREO_ISM && ism_mode != ISM_MODE_NONE ) || ( element_brate < MIN_BRATE_FB_STEREO && ism_mode == ISM_MODE_NONE ) ) -#else else if ( element_brate < MIN_BRATE_FB_STEREO ) -#endif { /* WB and SWB are supported */ ind = st->bwidth - WB; diff --git a/lib_enc/ivas_ism_dtx_enc.c b/lib_enc/ivas_ism_dtx_enc.c index f097feb202..907997cf98 100644 --- a/lib_enc/ivas_ism_dtx_enc.c +++ b/lib_enc/ivas_ism_dtx_enc.c @@ -249,12 +249,7 @@ int16_t ivas_ism_dtx_enc( for ( ch = 0; ch < nchan_transport; ch++ ) { hSCE[ch]->hCoreCoder[0]->core_brate = -1; - set_bw( IVAS_SCE, hSCE[ch]->element_brate, hSCE[ch]->hCoreCoder[0], MODE1 -#ifdef ISM_FB - , - -1 // VE: not really correct !!!!! -#endif - ); + set_bw( IVAS_SCE, hSCE[ch]->element_brate, hSCE[ch]->hCoreCoder[0], MODE1 ); } hISMDTX->cnt_SID_ISM = -1; diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index dc12943621..6c6a0c8837 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -165,13 +165,7 @@ ivas_error ivas_ism_enc( &ener[sce_id][0], &relE[sce_id][0], A[sce_id][0], Aw[sce_id][0], epsP[sce_id][0], lsp_new[sce_id][0], lsp_mid[sce_id][0], &vad_hover_flag[sce_id][0], &attack_flag[sce_id][0], realBuffer[sce_id][0], imagBuffer[sce_id][0], old_wsp[sce_id][0], pitch_fr[sce_id][0], voicing_fr[sce_id][0], &loc_harm[sce_id][0], &cor_map_sum[sce_id][0], &vad_flag_dtx[sce_id][0], enerBuffer[sce_id][0], fft_buff[sce_id][0], A[sce_id][0], lsp_new[sce_id][0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, 0, 0, 0, 0, - st_ivas->hEncoderConfig->ivas_total_brate -#ifdef ISM_FB - , - st_ivas->ism_mode -#endif - - ); + st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -280,11 +274,7 @@ ivas_error ivas_ism_enc( /* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */ if ( st->core_brate == SID_2k40 || st->core_brate == FRAME_NO_DATA ) { -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( st_ivas->ism_mode, IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); -#endif } else if ( st->low_rate_mode ) { @@ -292,11 +282,7 @@ ivas_error ivas_ism_enc( } else { -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( st_ivas->ism_mode, IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); -#endif } /* modify the coder_type depending on the total_brate per channel */ @@ -426,11 +412,7 @@ ivas_error ivas_ism_enc_config( st_ivas->nSCE = st_ivas->nchan_transport; st_ivas->nCPE = 0; -#ifdef ISM_16_KHZ_CORE - if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, st_ivas->ism_mode, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nchan_transport, st_ivas->hEncoderConfig->nchan_inp, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_ism_metadata_enc.c b/lib_enc/ivas_ism_metadata_enc.c index a359e09100..a8c4982e4b 100644 --- a/lib_enc/ivas_ism_metadata_enc.c +++ b/lib_enc/ivas_ism_metadata_enc.c @@ -532,11 +532,7 @@ ivas_error ivas_ism_metadata_enc( * Configuration and decision about bitrates per channel *----------------------------------------------------------------*/ -#ifdef ISM_16_KHZ_CORE - if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_mode, ism_extended_metadata_flag, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_config( ism_total_brate, nchan_transport, nchan_ism, hIsmMeta, ism_extended_metadata_flag, localVAD, ism_imp, element_brate, total_brate, nb_bits_metadata ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -647,11 +643,7 @@ ivas_error ivas_ism_metadata_enc_create( st_ivas->hIsmMetaData[ch]->last_true_radius = 1.0f; } -#ifdef ISM_16_KHZ_CORE - if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, st_ivas->ism_mode, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_ism_config( st_ivas->hEncoderConfig->ivas_total_brate, nchan_transport, n_ISms, NULL, 0, NULL, NULL, element_brate_tmp, NULL, NULL ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index b264ebc3bd..3dde94fd33 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -185,12 +185,7 @@ ivas_error ivas_sce_enc( &vad_hover_flag[0], &attack_flag[0], realBuffer[0], imagBuffer[0], old_wsp[0], pitch_fr[0], voicing_fr[0], &loc_harm[0], &cor_map_sum[0], &vad_flag_dtx[0], enerBuffer[0], fft_buff[0], A[0], lsp_new[0], currFlatness[0], 0, fr_bands, Etot_LR, lf_E, localVAD_HE_SAD, NULL, flag_16k_smc, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_flag : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->force_front_vad : 0, st_ivas->hSpar != NULL ? st_ivas->hSpar->front_vad_dtx_flag : 0, - st_ivas->hEncoderConfig->ivas_total_brate -#ifdef ISM_FB - , - ISM_MODE_NONE -#endif - ); + st_ivas->hEncoderConfig->ivas_total_brate ); if ( error != IVAS_ERR_OK ) { return error; @@ -228,19 +223,11 @@ ivas_error ivas_sce_enc( /* set ACELP@12k8 / ACELP@16k flag for flexible ACELP core */ if ( st->core_brate == SID_2k40 || st->core_brate == FRAME_NO_DATA ) { -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->core_brate, 0, 0, -1, -1 ); -#endif } else { -#ifdef ISM_16_KHZ_CORE - st->flag_ACELP16k = set_ACELP_flag( ISM_MODE_NONE, IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); -#else st->flag_ACELP16k = set_ACELP_flag( IVAS_SCE, hSCE->element_brate, st->total_brate, 0, 0, -1, -1 ); -#endif } /* modify the coder_type depending on the total_brate per channel */ -- GitLab From 5b03dcf50c676474b6382d4da8f5b08320ffb23c Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 7 Jun 2023 17:12:29 +0200 Subject: [PATCH 5/6] fix uninitialized parameter --- lib_dec/ivas_cpe_dec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 948b475c74..8db688760d 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -688,6 +688,9 @@ ivas_error create_cpe_dec( st->total_brate = hCPE->element_brate / ( CPE_CHANNELS ); /* dummy initialization for getting right pointers initialization of input buffers in init_coder_ace_plus() */ st->mct_chan_mode = MCT_CHAN_MODE_REGULAR; +#ifdef ISM_25k6_HZ_CORE + st->is_ism_format = 0; +#endif if ( ( error = init_decoder( st, n, st_ivas->mc_mode ) ) != IVAS_ERR_OK ) { -- GitLab From 8ba8f7002220a69063132d9f9837ea18985e5548 Mon Sep 17 00:00:00 2001 From: vaclav Date: Wed, 7 Jun 2023 18:20:05 +0200 Subject: [PATCH 6/6] fix crash to due low_rate vs. TCX mismatch --- lib_enc/ivas_decision_matrix_enc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib_enc/ivas_decision_matrix_enc.c b/lib_enc/ivas_decision_matrix_enc.c index f182a28a32..a8a220641d 100644 --- a/lib_enc/ivas_decision_matrix_enc.c +++ b/lib_enc/ivas_decision_matrix_enc.c @@ -170,6 +170,12 @@ void ivas_decision_matrix_enc( st->core = ACELP_CORE; st->coder_type = AUDIO; st->sp_aud_decision2 = 0; +#ifdef ISM_25k6_HZ_CORE + if ( st->low_rate_mode ) + { + st->coder_type = INACTIVE; + } +#endif } } @@ -224,6 +230,13 @@ void ivas_decision_matrix_enc( st->core = ACELP_CORE; st->coder_type = AUDIO; st->sp_aud_decision2 = 0; + +#ifdef ISM_25k6_HZ_CORE + if ( st->low_rate_mode ) + { + st->coder_type = INACTIVE; + } +#endif } } #endif -- GitLab