diff --git a/lib_com/options.h b/lib_com/options.h index cc9a0d7f87b76d61d1e418f056c120aaa06987af..1d498d32d22e67e3ae3c85b8cce3ec589fba08fd 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -93,6 +93,7 @@ #define NONBE_FIX_ISSUE_2206_SWB_EXPERIMENT_FIX_2527 /* Fix crash from issue #2527 */ #define FIX_FLOAT_1539_G192_FORMAT_SWITCH /* VA/Nokia: reintroduce format switching for g192 bitstreams */ #define HARMONIZE_2595_reconfig_decoder_LPD /* FhG: Harmonize reconfig_decoder_LPD with its ivas derivate */ +#define HARMONIZE_2596_SetModeIndex /* FhG: Harmonize SetModeIndex with its ivas derivate */ /* #################### End BE switches ################################## */ diff --git a/lib_com/prot_fx.h b/lib_com/prot_fx.h index 55fbb9362a5afac17f73730ae9d73c4bab6987f9..056cba33b9d37452d383c03c0f6d70182e65eb40 100644 --- a/lib_com/prot_fx.h +++ b/lib_com/prot_fx.h @@ -9547,11 +9547,19 @@ void core_coder_mode_switch_ivas_fx( ); +#ifdef HARMONIZE_2596_SetModeIndex +void SetModeIndex_fx( +#else void SetModeIndex_ivas_fx( +#endif Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate Q0*/ const Word16 last_element_mode, /* i : last IVAS element mode Q0*/ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) Q0*/ +#ifdef HARMONIZE_2596_SetModeIndex + , + const Word16 shift +#endif ); void init_tcx_cfg_ivas_fx( diff --git a/lib_enc/ivas_core_pre_proc_front_fx.c b/lib_enc/ivas_core_pre_proc_front_fx.c index b90cdacc8b7dbe76ed0d3b6715b7e84e0666aae8..0cb69bfdec2075472ef8dee0efc065ccaf1b6b78 100644 --- a/lib_enc/ivas_core_pre_proc_front_fx.c +++ b/lib_enc/ivas_core_pre_proc_front_fx.c @@ -1501,7 +1501,11 @@ void pre_proc_front_ivas_fx( test(); IF( EQ_32( ivas_format, SBA_FORMAT ) && st->core_brate != FRAME_NO_DATA && st->last_core_brate == FRAME_NO_DATA && st->sba_br_sw_while_no_data ) { +#ifdef HARMONIZE_2596_SetModeIndex + SetModeIndex_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag, 0 ); +#else SetModeIndex_ivas_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag ); +#endif st->sba_br_sw_while_no_data = 0; move16(); diff --git a/lib_enc/ivas_core_pre_proc_fx.c b/lib_enc/ivas_core_pre_proc_fx.c index cbb28d43cffcae7fe9dd9045d9626771dbe25e26..2ca70b60579a9bed9aadb50021c80466cd72ba5f 100644 --- a/lib_enc/ivas_core_pre_proc_fx.c +++ b/lib_enc/ivas_core_pre_proc_fx.c @@ -351,7 +351,11 @@ void pre_proc_ivas_fx( st->total_brate = L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ); /* Q0 */ move32(); +#ifdef HARMONIZE_2596_SetModeIndex + SetModeIndex_fx( st, imult3216( st->last_bits_frame_nominal, FRAMES_PER_SEC ), last_element_mode, MCT_flag, 0 ); +#else SetModeIndex_ivas_fx( st, imult3216( st->last_bits_frame_nominal, FRAMES_PER_SEC ), last_element_mode, MCT_flag ); +#endif st->sr_core = getCoreSamplerateMode2( element_mode, st->total_brate, st->bwidth, st->flag_ACELP16k, st->rf_mode, st->is_ism_format ); /* Q0 */ move16(); @@ -411,7 +415,12 @@ void pre_proc_ivas_fx( { IF( NE_32( st->core_brate, FRAME_NO_DATA ) ) { + +#ifdef HARMONIZE_2596_SetModeIndex + SetModeIndex_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag, 0 ); +#else SetModeIndex_ivas_fx( st, L_mult0( st->bits_frame_nominal, FRAMES_PER_SEC ), element_mode, MCT_flag ); +#endif } test(); diff --git a/lib_enc/prot_fx_enc.h b/lib_enc/prot_fx_enc.h index 675710bcb017ce3ecc67642aa3d2e7179b181db7..7b20bddd1f2a019ac237efbdb45e81be2b2d5d29 100644 --- a/lib_enc/prot_fx_enc.h +++ b/lib_enc/prot_fx_enc.h @@ -2672,12 +2672,14 @@ void spec_flatness_fx( Word16 sSFM[SFM_NUM] /*(o) spectral flatness rate*/ ); +#ifndef HARMONIZE_2596_SetModeIndex void SetModeIndex_fx( Encoder_State *st, Word32 last_total_brate, /* Q0 */ const Word16 last_element_mode, /* Q0 */ const Word16 is_mct, /* Q0 */ const Word16 shift ); +#endif void MDCT_selector_fx( Encoder_State *st, /* i/o: Encoder State */ diff --git a/lib_enc/setmodeindex_fx.c b/lib_enc/setmodeindex_fx.c index 6c34efb0f914e00a1d8ba810db6c4ab1fba7a964..7183e452f3448992a32f0f229399a1851f2f23d2 100644 --- a/lib_enc/setmodeindex_fx.c +++ b/lib_enc/setmodeindex_fx.c @@ -21,6 +21,7 @@ ---------------------------------------------------------------------------*/ +#ifndef HARMONIZE_2596_SetModeIndex void SetModeIndex_fx( Encoder_State *st, Word32 last_total_brate, /* Q0 */ @@ -56,13 +57,21 @@ void SetModeIndex_fx( return; } +#endif - +#ifdef HARMONIZE_2596_SetModeIndex +void SetModeIndex_fx( +#else void SetModeIndex_ivas_fx( +#endif Encoder_State *st, /* i : Encoder state */ const Word32 last_total_brate, /* i : last total bitrate Q0*/ const Word16 last_element_mode, /* i : last IVAS element mode Q0*/ const Word16 MCT_flag /* i : hMCT handle allocated (1) or not (0) Q0*/ +#ifdef HARMONIZE_2596_SetModeIndex + , + const Word16 shift +#endif ) { Word16 ini_frame_loc = st->ini_frame; // Q0 @@ -93,7 +102,18 @@ void SetModeIndex_ivas_fx( ( NE_16( st->rf_mode_last, st->rf_mode ) ) || ( st->element_mode > EVS_MONO && st->ini_frame == 0 ) ) { - core_coder_mode_switch_ivas_fx( st, last_total_brate, MCT_flag ); +#ifdef HARMONIZE_2596_SetModeIndex + IF( EQ_16( st->element_mode, EVS_MONO ) ) + { + core_coder_mode_switch_fx( st, last_total_brate, MCT_flag, shift ); + } + ELSE + { +#endif + core_coder_mode_switch_ivas_fx( st, last_total_brate, MCT_flag ); +#ifdef HARMONIZE_2596_SetModeIndex + } +#endif } st->ini_frame = ini_frame_loc; // Q0