diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index ccf395ce55d0bf8dad925eab012f94a1ec872c60..33a48c1363a90dfe2ee331c1a0b322b4436aa34c 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1341,8 +1341,13 @@ typedef enum #define MCMASA_SEPARATE_BRATE IVAS_64k /* minimum bitrate from which separated channel coding is supported */ #define MCMASA_MAX_ANA_CHANS 11 /* Maximum number of channels currently used in analysis of multichannel formats */ +#ifdef IVAS_FLOAT_FIXED +#define MCMASA_MONOBITRATIO_64k_Q31 ( 536870912 ) +#define MCMASA_MONOBITRATIO_Q31 ( 644245095 ) +#else #define MCMASA_MONOBITRATIO 0.3f #define MCMASA_MONOBITRATIO_64k 0.25f +#endif #define MC_MASA_THR_ELEVATION 40 #define MCMASA_LFE_QLOW -6.5f diff --git a/lib_com/ivas_mc_com.c b/lib_com/ivas_mc_com.c index ec3b5333e033ab61092605643ac9e5dbdeb691b7..abaed7ae45eb70fbb5236416a33a6421fe29efdc 100644 --- a/lib_com/ivas_mc_com.c +++ b/lib_com/ivas_mc_com.c @@ -37,6 +37,9 @@ #include "prot.h" #include "ivas_prot.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_prot_fx.h" +#endif /*--------------------------------------------------------------- @@ -46,13 +49,84 @@ * ---------------------------------------------------------------*/ /*! r : MC format mode */ +#ifndef IVAS_FLOAT_FIXED MC_MODE ivas_mc_mode_select( + const MC_LS_SETUP mc_ls_setup, /* i : MC loudspeaker setup */ + const int32_t total_brate /* i : IVAS total bitrate */ +) +{ + MC_MODE mc_mode = MC_MODE_MCT; + + switch ( mc_ls_setup ) + { + case MC_LS_SETUP_5_1: + if ( total_brate < IVAS_48k ) + { + mc_mode = MC_MODE_MCMASA; + } + else if ( total_brate < IVAS_96k ) + { + mc_mode = MC_MODE_PARAMMC; + } + break; + case MC_LS_SETUP_7_1: + if ( total_brate < IVAS_48k ) + { + mc_mode = MC_MODE_MCMASA; + } + else if ( total_brate < IVAS_128k ) + { + mc_mode = MC_MODE_PARAMMC; + } + break; + case MC_LS_SETUP_5_1_2: + if ( total_brate < IVAS_48k ) + { + mc_mode = MC_MODE_MCMASA; + } + else if ( total_brate < IVAS_128k ) + { + mc_mode = MC_MODE_PARAMMC; + } + break; + case MC_LS_SETUP_5_1_4: + if ( total_brate < IVAS_96k ) + { + mc_mode = MC_MODE_MCMASA; + } + else if ( total_brate < IVAS_160k ) + { + mc_mode = MC_MODE_PARAMMC; + } + break; + case MC_LS_SETUP_7_1_4: + if ( total_brate < IVAS_128k ) + { + mc_mode = MC_MODE_MCMASA; + } + else if ( total_brate < IVAS_160k ) + { + mc_mode = MC_MODE_PARAMMC; + } + else if ( total_brate < IVAS_192k ) + { + mc_mode = MC_MODE_PARAMUPMIX; + } + break; + default: + assert( 0 && "LS Setup not supported or defined for MC mode!\n" ); + } + + return mc_mode; +} +#else +MC_MODE ivas_mc_mode_select_fx( const MC_LS_SETUP mc_ls_setup, /* i : MC loudspeaker setup */ const Word32 total_brate /* i : IVAS total bitrate */ ) { MC_MODE mc_mode = MC_MODE_MCT; - move16(); + move32(); SWITCH( mc_ls_setup ) { @@ -60,65 +134,65 @@ MC_MODE ivas_mc_mode_select( IF( LT_32( total_brate, IVAS_48k ) ) { mc_mode = MC_MODE_MCMASA; - move16(); + move32(); } ELSE IF( LT_32( total_brate, IVAS_96k ) ) { mc_mode = MC_MODE_PARAMMC; - move16(); + move32(); } BREAK; case MC_LS_SETUP_7_1: IF( LT_32( total_brate, IVAS_48k ) ) { mc_mode = MC_MODE_MCMASA; - move16(); + move32(); } ELSE IF( LT_32( total_brate, IVAS_128k ) ) { mc_mode = MC_MODE_PARAMMC; - move16(); + move32(); } BREAK; case MC_LS_SETUP_5_1_2: IF( LT_32( total_brate, IVAS_48k ) ) { mc_mode = MC_MODE_MCMASA; - move16(); + move32(); } ELSE IF( LT_32( total_brate, IVAS_128k ) ) { mc_mode = MC_MODE_PARAMMC; - move16(); + move32(); } BREAK; case MC_LS_SETUP_5_1_4: IF( LT_32( total_brate, IVAS_96k ) ) { mc_mode = MC_MODE_MCMASA; - move16(); + move32(); } ELSE IF( LT_32( total_brate, IVAS_160k ) ) { mc_mode = MC_MODE_PARAMMC; - move16(); + move32(); } BREAK; case MC_LS_SETUP_7_1_4: IF( LT_32( total_brate, IVAS_128k ) ) { mc_mode = MC_MODE_MCMASA; - move16(); + move32(); } ELSE IF( LT_32( total_brate, IVAS_160k ) ) { mc_mode = MC_MODE_PARAMMC; - move16(); + move32(); } ELSE IF( LT_32( total_brate, IVAS_192k ) ) { mc_mode = MC_MODE_PARAMUPMIX; - move16(); + move32(); } BREAK; default: @@ -127,6 +201,7 @@ MC_MODE ivas_mc_mode_select( return mc_mode; } +#endif /*--------------------------------------------------------------- @@ -137,7 +212,7 @@ MC_MODE ivas_mc_mode_select( /*! r : number of loudspeaker channels */ #ifdef IVAS_FLOAT_FIXED -Word16 ivas_mc_ls_setup_get_num_channels( +Word16 ivas_mc_ls_setup_get_num_channels_fx( const MC_LS_SETUP mc_ls_setup /* i : multi channel loudspeaker setup */ ) { @@ -216,6 +291,7 @@ int16_t ivas_mc_ls_setup_get_num_channels( * ---------------------------------------------------------------*/ /*! r : multi channel loudspeaker setup */ +#ifndef IVAS_FLOAT_FIXED MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( const AUDIO_CONFIG output_config /* i : output audio configuration */ ) @@ -223,29 +299,61 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( MC_LS_SETUP mc_ls_setup; mc_ls_setup = MC_LS_SETUP_INVALID; - move16(); + + switch ( output_config ) + { + case IVAS_AUDIO_CONFIG_5_1: + mc_ls_setup = MC_LS_SETUP_5_1; + break; + case IVAS_AUDIO_CONFIG_7_1: + mc_ls_setup = MC_LS_SETUP_7_1; + break; + case IVAS_AUDIO_CONFIG_5_1_2: + mc_ls_setup = MC_LS_SETUP_5_1_2; + break; + case IVAS_AUDIO_CONFIG_5_1_4: + mc_ls_setup = MC_LS_SETUP_5_1_4; + break; + case IVAS_AUDIO_CONFIG_7_1_4: + mc_ls_setup = MC_LS_SETUP_7_1_4; + break; + default: + assert( 0 && "Output config is not a valid MC loudspeaker setup!\n" ); + } + + return mc_ls_setup; +} +#else +MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup_fx( + const AUDIO_CONFIG output_config /* i : output audio configuration */ +) +{ + MC_LS_SETUP mc_ls_setup; + + mc_ls_setup = MC_LS_SETUP_INVALID; + move32(); SWITCH( output_config ) { case IVAS_AUDIO_CONFIG_5_1: mc_ls_setup = MC_LS_SETUP_5_1; - move16(); + move32(); BREAK; case IVAS_AUDIO_CONFIG_7_1: mc_ls_setup = MC_LS_SETUP_7_1; - move16(); + move32(); BREAK; case IVAS_AUDIO_CONFIG_5_1_2: mc_ls_setup = MC_LS_SETUP_5_1_2; - move16(); + move32(); BREAK; case IVAS_AUDIO_CONFIG_5_1_4: mc_ls_setup = MC_LS_SETUP_5_1_4; - move16(); + move32(); BREAK; case IVAS_AUDIO_CONFIG_7_1_4: mc_ls_setup = MC_LS_SETUP_7_1_4; - move16(); + move32(); BREAK; default: assert( 0 && "Output config is not a valid MC loudspeaker setup!\n" ); @@ -253,6 +361,7 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( return mc_ls_setup; } +#endif /*--------------------------------------------------------------- @@ -262,35 +371,72 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( * ---------------------------------------------------------------*/ /*! r: audio configuration*/ +#ifndef IVAS_FLOAT_FIXED AUDIO_CONFIG ivas_mc_map_ls_setup_to_output_config( const MC_LS_SETUP mc_ls_setup /* i : multi channel loudspeaker setup*/ ) { AUDIO_CONFIG audio_config; audio_config = IVAS_AUDIO_CONFIG_INVALID; - move16(); + + switch ( mc_ls_setup ) + { + case MC_LS_SETUP_5_1: + audio_config = IVAS_AUDIO_CONFIG_5_1; + break; + case MC_LS_SETUP_7_1: + audio_config = IVAS_AUDIO_CONFIG_7_1; + break; + case MC_LS_SETUP_5_1_2: + audio_config = IVAS_AUDIO_CONFIG_5_1_2; + break; + case MC_LS_SETUP_5_1_4: + audio_config = IVAS_AUDIO_CONFIG_5_1_4; + break; + case MC_LS_SETUP_7_1_4: + audio_config = IVAS_AUDIO_CONFIG_7_1_4; + break; + default: + assert( 0 && "MC loudspeaker setup is not valid!\n" ); + } + + return audio_config; +} +#else +AUDIO_CONFIG ivas_mc_map_ls_setup_to_output_config_fx( + const MC_LS_SETUP mc_ls_setup /* i : multi channel loudspeaker setup*/ +) +{ + AUDIO_CONFIG audio_config; + audio_config = IVAS_AUDIO_CONFIG_INVALID; + move32(); SWITCH( mc_ls_setup ) { case MC_LS_SETUP_5_1: audio_config = IVAS_AUDIO_CONFIG_5_1; + move32(); BREAK; case MC_LS_SETUP_7_1: audio_config = IVAS_AUDIO_CONFIG_7_1; + move32(); BREAK; case MC_LS_SETUP_5_1_2: audio_config = IVAS_AUDIO_CONFIG_5_1_2; + move32(); BREAK; case MC_LS_SETUP_5_1_4: audio_config = IVAS_AUDIO_CONFIG_5_1_4; + move32(); BREAK; case MC_LS_SETUP_7_1_4: audio_config = IVAS_AUDIO_CONFIG_7_1_4; + move32(); BREAK; default: assert( 0 && "MC loudspeaker setup is not valid!\n" ); } - move16(); return audio_config; } +#endif diff --git a/lib_com/ivas_mc_param_com.c b/lib_com/ivas_mc_param_com.c index 07c646cb7d560475bd941f80ec889681af4c1a80..07ab1f9b8b71c6e9e088412728db3138224fca68 100644 --- a/lib_com/ivas_mc_param_com.c +++ b/lib_com/ivas_mc_param_com.c @@ -117,7 +117,7 @@ void ivas_param_mc_metadata_open( #ifndef FIX_901_PARAMMC_DEAD_CODE Word16 nchan_setup; - nchan_setup = ivas_mc_ls_setup_get_num_channels( mc_ls_setup ); + nchan_setup = ivas_mc_ls_setup_get_num_channels_fx( mc_ls_setup ); #endif /* get coding band mappings */ diff --git a/lib_com/ivas_mcmasa_com.c b/lib_com/ivas_mcmasa_com.c index 53693bf0b99403ecdf6a9b117c1d1a28ce02b1ee..f8550d48efcff47c2cbaf9b0f1920346da953072 100644 --- a/lib_com/ivas_mcmasa_com.c +++ b/lib_com/ivas_mcmasa_com.c @@ -39,15 +39,13 @@ #endif -#ifdef IVAS_FLOAT_FIXED -#define MCMASA_MONOBITRATIO_64k_Q31 ( 536870912 ) -#define MCMASA_MONOBITRATIO_Q31 ( 644245095 ) /*--------------------------------------------------------------------------* * ivas_mcmasa_setNumTransportChannels() * * Set number of transport channels in McMASA *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void ivas_mcmasa_setNumTransportChannels_fx( Word16 *nchan_transport, /* o : Pointer to number of transport channels to be set */ Word16 *element_mode, /* o : Pointer to element mode to be set */ @@ -71,6 +69,27 @@ void ivas_mcmasa_setNumTransportChannels_fx( return; } +#else +void ivas_mcmasa_setNumTransportChannels( + int16_t *nchan_transport, /* o : Pointer to number of transport channels to be set */ + int16_t *element_mode, /* o : Pointer to element mode to be set */ + const int32_t ivas_total_brate /* i : Total bitrate of IVAS */ +) +{ + if ( ivas_total_brate >= IVAS_48k ) + { + *nchan_transport = 2; + *element_mode = IVAS_CPE_MDCT; + } + else + { + *nchan_transport = 1; + *element_mode = IVAS_SCE; + } + + return; +} +#endif /*--------------------------------------------------------------------------* @@ -79,6 +98,7 @@ void ivas_mcmasa_setNumTransportChannels_fx( * Set separate channel parameters in McMASA based on bitrate *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void ivas_mcmasa_set_separate_channel_mode_fx( UWord8 *separateChannelEnabled, /* o : Pointer to separate channel toggle */ Word16 *separateChannelIndex, /* o : Pointer to separate channel index */ @@ -100,6 +120,27 @@ void ivas_mcmasa_set_separate_channel_mode_fx( return; } +#else +void ivas_mcmasa_set_separate_channel_mode( + uint8_t *separateChannelEnabled, /* o : Pointer to separate channel toggle */ + int16_t *separateChannelIndex, /* o : Pointer to separate channel index */ + const int32_t ivas_total_brate /* i : Total bitrate of IVAS */ +) +{ + if ( ivas_total_brate >= MCMASA_SEPARATE_BRATE ) + { + *separateChannelEnabled = 1; + *separateChannelIndex = 2; /* Center channel */ + } + else + { + *separateChannelEnabled = 0; + *separateChannelIndex = 0; + } + + return; +} +#endif /*--------------------------------------------------------------------------* @@ -108,6 +149,7 @@ void ivas_mcmasa_set_separate_channel_mode_fx( * Split the total bitrate to elements in McMASA *--------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED void ivas_mcmasa_split_brate_fx( const UWord8 separateChannelEnabled, /* i : Transport running in "separate channel" mode */ const Word32 ivas_total_brate, /* i : IVAS total bitrate available to be split */ @@ -122,11 +164,11 @@ void ivas_mcmasa_split_brate_fx( /* 25% of total bitrate is used for SCE below 96 kb/s (separated mono channel), otherwise 30% */ IF( LT_32( ivas_total_brate, IVAS_96k ) ) { - *brate_sce = (Word32) ( Mpy_32_32( MCMASA_MONOBITRATIO_64k_Q31, ivas_total_brate ) ); // Q0 + *brate_sce = Mpy_32_32( MCMASA_MONOBITRATIO_64k_Q31, ivas_total_brate ); /* Q0 */ } ELSE { - *brate_sce = (Word32) ( Mpy_32_32( MCMASA_MONOBITRATIO_Q31, ivas_total_brate ) ); // Q0 + *brate_sce = Mpy_32_32( MCMASA_MONOBITRATIO_Q31, ivas_total_brate ); /* Q0 */ } *brate_cpe = L_sub( ivas_total_brate, *brate_sce ); @@ -134,6 +176,7 @@ void ivas_mcmasa_split_brate_fx( ELSE { Word16 tmp_e = 0; + move16(); Word16 tmp = BASOP_Util_Divide3216_Scale( ivas_total_brate, ( add( nCPE, nSCE ) ), &tmp_e ); *brate_sce = GT_16( nSCE, 0 ) ? ( L_shr( (Word32) tmp, negate( add( 1, tmp_e ) ) ) ) : 0; move32(); @@ -143,67 +186,7 @@ void ivas_mcmasa_split_brate_fx( return; } -#endif -/*--------------------------------------------------------------------------* - * ivas_mcmasa_setNumTransportChannels() - * - * Set number of transport channels in McMASA - *--------------------------------------------------------------------------*/ - -void ivas_mcmasa_setNumTransportChannels( - int16_t *nchan_transport, /* o : Pointer to number of transport channels to be set */ - int16_t *element_mode, /* o : Pointer to element mode to be set */ - const int32_t ivas_total_brate /* i : Total bitrate of IVAS */ -) -{ - if ( ivas_total_brate >= IVAS_48k ) - { - *nchan_transport = 2; - *element_mode = IVAS_CPE_MDCT; - } - else - { - *nchan_transport = 1; - *element_mode = IVAS_SCE; - } - - return; -} - - -/*--------------------------------------------------------------------------* - * ivas_mcmasa_set_separate_channel_mode() - * - * Set separate channel parameters in McMASA based on bitrate - *--------------------------------------------------------------------------*/ - -void ivas_mcmasa_set_separate_channel_mode( - uint8_t *separateChannelEnabled, /* o : Pointer to separate channel toggle */ - int16_t *separateChannelIndex, /* o : Pointer to separate channel index */ - const int32_t ivas_total_brate /* i : Total bitrate of IVAS */ -) -{ - if ( ivas_total_brate >= MCMASA_SEPARATE_BRATE ) - { - *separateChannelEnabled = 1; - *separateChannelIndex = 2; /* Center channel */ - } - else - { - *separateChannelEnabled = 0; - *separateChannelIndex = 0; - } - - return; -} - - -/*--------------------------------------------------------------------------* - * ivas_mcmasa_split_brate() - * - * Split the total bitrate to elements in McMASA - *--------------------------------------------------------------------------*/ - +#else void ivas_mcmasa_split_brate( const uint8_t separateChannelEnabled, /* i : Transport running in "separate channel" mode */ const int32_t ivas_total_brate, /* i : IVAS total bitrate available to be split */ @@ -235,3 +218,4 @@ void ivas_mcmasa_split_brate( return; } +#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 15826bdecc849dcca16c4368e237ef1300b3b5e0..1aab20d0ec84e3c559fadb210b1ecbd4be5ae403 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -788,20 +788,14 @@ ivas_error ivas_mc_dec_config( /*! r: MC format mode (MCT, McMASA, ParamMC) */ MC_MODE ivas_mc_mode_select( - const MC_LS_SETUP mc_ls_setup, /* i : loudspeaker setup (CICP) */ - const Word32 total_brate /* i : IVAS total bitrate */ + const MC_LS_SETUP mc_ls_setup, /* i : MC loudspeaker setup */ + const int32_t total_brate /* i : IVAS total bitrate */ ); /*! r: number of loudspeaker channels */ -#ifdef IVAS_FLOAT_FIXED -Word16 ivas_mc_ls_setup_get_num_channels( - const MC_LS_SETUP mc_ls_setup /* i : loudspeaker setup (CICP) */ -); -#else int16_t ivas_mc_ls_setup_get_num_channels( const MC_LS_SETUP mc_ls_setup /* i : loudspeaker setup (CICP) */ ); -#endif /*! r: output configuration*/ AUDIO_CONFIG ivas_mc_map_ls_setup_to_output_config( diff --git a/lib_com/ivas_prot_fx.h b/lib_com/ivas_prot_fx.h index 659ae5827e0155b9d92fbf0c65f808d4508e72be..e91e31d232ffa985866bd50a8ae600e8eec6c2c5 100644 --- a/lib_com/ivas_prot_fx.h +++ b/lib_com/ivas_prot_fx.h @@ -2282,4 +2282,25 @@ ivas_error ivas_jbm_dec_render_fx( UWord16 *nSamplesAvailableNext, /* o : number of samples still available in the rendering pipeline */ Word16 *data /* o : output synthesis signal */ ); + +/*! r: MC format mode (MCT, McMASA, ParamMC) */ +MC_MODE ivas_mc_mode_select_fx( + const MC_LS_SETUP mc_ls_setup, /* i : MC loudspeaker setup */ + const Word32 total_brate /* i : IVAS total bitrate */ +); + +/*! r: number of loudspeaker channels */ +Word16 ivas_mc_ls_setup_get_num_channels_fx( + const MC_LS_SETUP mc_ls_setup /* i : loudspeaker setup (CICP) */ +); + +/*! r: multi channel loudspeaker setup */ +MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup_fx( + const AUDIO_CONFIG output_config /* i : output audio configuration */ +); + +/*! r: output configuration */ +AUDIO_CONFIG ivas_mc_map_ls_setup_to_output_config_fx( + const MC_LS_SETUP mc_ls_setup /* i : multi channel loudspeaker setup*/ +); #endif diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 87c1c17b0d8fb7fbd123c84bba6f9de9552560e6..862ecaa112efafebd90005382ccc980ca79aa73e 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -82,7 +82,7 @@ ivas_error ivas_corecoder_dec_reconfig_fx( IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) ) { - last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ + last_mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ } ELSE { diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 9d528f8df45ee6c4ca1d8b02a8a9c9711e4f4e41..5e18e1750804834d110c20d76b21f4db0b56dba4 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2253,7 +2253,7 @@ ivas_error ivas_init_decoder_fx( } } - st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ) ); st_ivas->nSCE = 0; st_ivas->nCPE = st_ivas->nchan_transport / CPE_CHANNELS; diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index a638ee537f89ee9c20e46fdda485b8807e7dc3db..6dce33f67cb5e7c2b026244167650202cd1f48d0 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -1002,7 +1002,7 @@ ivas_error ivas_masa_decode_fx( test(); IF( EQ_16( ivas_format, MC_FORMAT ) && EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { - hQMetaData->q_direction->cfg.mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + hQMetaData->q_direction->cfg.mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ); } ELSE { @@ -1728,7 +1728,7 @@ static ivas_error ivas_masa_dec_config_fx( test(); IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && EQ_16( st_ivas->mc_mode, MC_MODE_MCMASA ) ) { - st_ivas->hQMetaData->q_direction[i].cfg.mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + st_ivas->hQMetaData->q_direction[i].cfg.mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ); } ELSE { diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 23d454fbd1a94a3d4947dd624f684397a9f527a9..2badc75fe8c305eaad49e57fce71e49deb527360 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -211,7 +211,7 @@ ivas_error ivas_param_mc_dec_open_fx( #ifndef FIX_901_PARAMMC_DEAD_CODE hTransportSetup = st_ivas->hTransSetup; #endif - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ); nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; hParamMC->hoa_encoder_fx = NULL; #if 1 /*TODO: To be removed later(floating pointer initialization)*/ @@ -1109,7 +1109,7 @@ ivas_error ivas_param_mc_dec_reconfig_fx( #ifndef FIX_901_PARAMMC_DEAD_CODE hTransportSetup = st_ivas->hTransSetup; #endif - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ); nchan_out_transport = add( st_ivas->hTransSetup.nchan_out_woLFE, st_ivas->hTransSetup.num_lfe ); IF( EQ_16( hParamMC->synthesis_conf, PARAM_MC_SYNTH_LS_CONV_COV ) || EQ_16( hParamMC->synthesis_conf, PARAM_MC_SYNTH_MONO_STEREO ) ) diff --git a/lib_dec/ivas_mcmasa_dec.c b/lib_dec/ivas_mcmasa_dec.c index c010fb175f2f3e405fa0d430b454309d42c62a1d..1ccf304df9b628c564c89937b5b62247fce891e0 100644 --- a/lib_dec/ivas_mcmasa_dec.c +++ b/lib_dec/ivas_mcmasa_dec.c @@ -114,24 +114,15 @@ ivas_error ivas_mcmasa_dec_reconfig( #endif /* get new McMASA settings */ -#ifdef IVAS_FLOAT_FIXED - ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); - ivas_mcmasa_set_separate_channel_mode_fx( &( st_ivas->hOutSetup.separateChannelEnabled ), &( st_ivas->hOutSetup.separateChannelIndex ), ivas_total_brate ); -#else ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->element_mode_init ), ivas_total_brate ); ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hOutSetup.separateChannelEnabled ), &( st_ivas->hOutSetup.separateChannelIndex ), ivas_total_brate ); -#endif /* transport channel settings may affect renderer */ ivas_renderer_select( st_ivas ); /* renderer change may affect internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); -#ifdef IVAS_FLOAT_FIXED - ivas_mcmasa_set_separate_channel_mode_fx( &( st_ivas->hIntSetup.separateChannelEnabled ), &( st_ivas->hIntSetup.separateChannelIndex ), ivas_total_brate ); -#else ivas_mcmasa_set_separate_channel_mode( &( st_ivas->hIntSetup.separateChannelEnabled ), &( st_ivas->hIntSetup.separateChannelIndex ), ivas_total_brate ); -#endif #ifdef IVAS_FLOAT_FIXED if ( ( error = ivas_masa_dec_open_fx( st_ivas ) ) != IVAS_ERR_OK ) diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 8e4d8f4b17e1a61aa8d4b0b6725d981b7ffb2ee8..88605f83763d5febd686726ce74fcfa48cfd3de6 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -339,7 +339,7 @@ ivas_error ivas_mct_dec_fx( IF( EQ_16( st_ivas->ivas_format, MC_FORMAT ) && EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) && EQ_16( st_ivas->bfi, 0 ) ) { /* get the number of channels from the signalled MC LS setup */ - n = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); + n = ivas_mc_ls_setup_get_num_channels_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ) ); IF( NE_16( n, st_ivas->nchan_transport ) ) { @@ -1346,7 +1346,7 @@ ivas_error ivas_mc_dec_config_fx( IF( EQ_16( st_ivas->bfi, 0 ) ) { /* set transported MC LS setup */ - signaled_config = ivas_mc_map_ls_setup_to_output_config( idx ); + signaled_config = ivas_mc_map_ls_setup_to_output_config_fx( idx ); IF( EQ_16( st_ivas->ini_frame, 0 ) ) { @@ -1354,7 +1354,7 @@ ivas_error ivas_mc_dec_config_fx( } /* select MC format mode */ - st_ivas->mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); + st_ivas->mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( signaled_config ), st_ivas->hDecoderConfig->ivas_total_brate ); /* MC format switching */ IF( st_ivas->ini_frame != 0 ) @@ -1468,7 +1468,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate; nchan_transport_old = st_ivas->nchan_transport; nchan_out_buff_old = ivas_get_nchan_buffers_dec( st_ivas, -1, -1 ); - last_mc_mode = ivas_mc_mode_select( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ + last_mc_mode = ivas_mc_mode_select_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ), st_ivas->hDecoderConfig->last_ivas_total_brate ); /* NB: this assumes that LS config remains the same between frames */ /* temporally set the current mc_mode back to the previous one to make sure the following call to ivas_init_dec_get_num_cldfb_instances() returns the correct counts */ @@ -1543,7 +1543,7 @@ static ivas_error ivas_mc_dec_reconfig_fx( } IF( EQ_16( st_ivas->mc_mode, MC_MODE_MCT ) ) { - st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ) ); + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels_fx( ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ) ); st_ivas->nSCE = 0; st_ivas->nCPE = st_ivas->nchan_transport / 2; diff --git a/lib_dec/lib_dec_fx.c b/lib_dec/lib_dec_fx.c index 8e036270b3016cb82fd4f9a1c20d47256d5b8795..5edade576b23dbec4f8aea63fb09e416f46e06b9 100644 --- a/lib_dec/lib_dec_fx.c +++ b/lib_dec/lib_dec_fx.c @@ -784,7 +784,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial( hParamMC = hIvasDec->st_ivas->hParamMC; MC_LS_SETUP mc_ls_setup; Word16 i; - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( hIvasDec->st_ivas->transport_config ); + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( hIvasDec->st_ivas->transport_config ); hIvasDec->st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); IF( hParamMC ) { @@ -1207,7 +1207,7 @@ static ivas_error IVAS_DEC_Setup( PARAM_MC_DEC_HANDLE hParamMC; hParamMC = st_ivas->hParamMC; MC_LS_SETUP mc_ls_setup; - mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup( st_ivas->transport_config ); + mc_ls_setup = ivas_mc_map_output_config_to_mc_ls_setup_fx( st_ivas->transport_config ); st_ivas->nchan_transport = ivas_param_mc_getNumTransportChannels( ivas_total_brate, mc_ls_setup ); IF( hParamMC ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index d48aa69979c633684eb5513117fe3f5e99d0454a..cc7ee8f2cfc163babef5ce0e1cb1e117ffb60379 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -800,7 +800,11 @@ ivas_error ivas_init_encoder( } else if ( ivas_format == MC_FORMAT ) { +#ifndef IVAS_FLOAT_FIXED st_ivas->mc_mode = ivas_mc_mode_select( hEncoderConfig->mc_input_setup, ivas_total_brate ); +#else + st_ivas->mc_mode = ivas_mc_mode_select_fx( hEncoderConfig->mc_input_setup, ivas_total_brate ); +#endif if ( ( error = ivas_create_lfe_lpf_enc( &st_ivas->hLfeLpf, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) { @@ -830,7 +834,11 @@ ivas_error ivas_init_encoder( return error; } +#ifndef IVAS_FLOAT_FIXED st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( st_ivas->hEncoderConfig->mc_input_setup ); +#else + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels_fx( st_ivas->hEncoderConfig->mc_input_setup ); +#endif } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { @@ -888,7 +896,11 @@ ivas_error ivas_init_encoder( { int32_t brate_sce, brate_cpe; +#ifndef IVAS_FLOAT_FIXED ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( hEncoderConfig->element_mode_init ), ivas_total_brate ); +#else + ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( hEncoderConfig->element_mode_init ), ivas_total_brate ); +#endif if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { @@ -905,7 +917,11 @@ ivas_error ivas_init_encoder( return error; } +#ifndef IVAS_FLOAT_FIXED ivas_mcmasa_split_brate( st_ivas->hMcMasa->separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); +#else + ivas_mcmasa_split_brate_fx( st_ivas->hMcMasa->separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); +#endif for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { @@ -1361,7 +1377,11 @@ ivas_error ivas_init_encoder_fx( } else if ( ivas_format == MC_FORMAT ) { +#ifndef IVAS_FLOAT_FIXED st_ivas->mc_mode = ivas_mc_mode_select( hEncoderConfig->mc_input_setup, ivas_total_brate ); +#else + st_ivas->mc_mode = ivas_mc_mode_select_fx( hEncoderConfig->mc_input_setup, ivas_total_brate ); +#endif if ( ( error = ivas_create_lfe_lpf_enc( &st_ivas->hLfeLpf, hEncoderConfig->input_Fs ) ) != IVAS_ERR_OK ) { @@ -1391,7 +1411,11 @@ ivas_error ivas_init_encoder_fx( return error; } +#ifndef IVAS_FLOAT_FIXED st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( st_ivas->hEncoderConfig->mc_input_setup ); +#else + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels_fx( st_ivas->hEncoderConfig->mc_input_setup ); +#endif } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { @@ -1449,7 +1473,11 @@ ivas_error ivas_init_encoder_fx( { int32_t brate_sce, brate_cpe; +#ifndef IVAS_FLOAT_FIXED ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( hEncoderConfig->element_mode_init ), ivas_total_brate ); +#else + ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( hEncoderConfig->element_mode_init ), ivas_total_brate ); +#endif if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { @@ -1466,7 +1494,11 @@ ivas_error ivas_init_encoder_fx( return error; } +#ifndef IVAS_FLOAT_FIXED ivas_mcmasa_split_brate( st_ivas->hMcMasa->separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); +#else + ivas_mcmasa_split_brate_fx( st_ivas->hMcMasa->separateChannelEnabled, ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &brate_sce, &brate_cpe ); +#endif for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) { diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 02c99e1ffe14335baeccd3bd62da6ce600794f66..56800005b449c0fdc8c0e3f1aa6a99eebd1147ee 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -41,6 +41,9 @@ #include "ivas_rom_com.h" #include "ivas_rom_enc.h" #include "wmc_auto.h" +#ifdef IVAS_FLOAT_FIXED +#include "ivas_prot_fx.h" +#endif /*------------------------------------------------------------------------- @@ -116,7 +119,11 @@ ivas_error ivas_mcmasa_enc_open( input_Fs = st_ivas->hEncoderConfig->input_Fs; /* Determine if to separate some channels from the analysis */ +#ifndef IVAS_FLOAT_FIXED ivas_mcmasa_set_separate_channel_mode( &( hMcMasa->separateChannelEnabled ), &( hMcMasa->separateChannelIndex ), st_ivas->hEncoderConfig->ivas_total_brate ); +#else + ivas_mcmasa_set_separate_channel_mode_fx( &( hMcMasa->separateChannelEnabled ), &( hMcMasa->separateChannelIndex ), st_ivas->hEncoderConfig->ivas_total_brate ); +#endif numAnalysisChannels = nchan_inp - 1; if ( hMcMasa->separateChannelEnabled ) @@ -451,7 +458,11 @@ ivas_error ivas_mcmasa_enc_reconfig( ivas_mcmasa_enc_close( &( st_ivas->hMcMasa ), st_ivas->hEncoderConfig->input_Fs ); /* Determine if to separate some channels from the analysis */ +#ifndef IVAS_FLOAT_FIXED ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->hEncoderConfig->element_mode_init ), ivas_total_brate ); +#else + ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->hEncoderConfig->element_mode_init ), ivas_total_brate ); +#endif if ( ( error = ivas_masa_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 50b7d7ab8caada7b05af22395455766b3c0041ad..49364ad7f608158910448fc736e2f798645bfd94 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -620,7 +620,11 @@ ivas_error ivas_mc_enc_config( last_mc_mode = st_ivas->mc_mode; /* select MC format mode */ +#ifndef IVAS_FLOAT_FIXED st_ivas->mc_mode = ivas_mc_mode_select( st_ivas->hEncoderConfig->mc_input_setup, st_ivas->hEncoderConfig->ivas_total_brate ); +#else + st_ivas->mc_mode = ivas_mc_mode_select_fx( st_ivas->hEncoderConfig->mc_input_setup, st_ivas->hEncoderConfig->ivas_total_brate ); +#endif /* write MC LS setup */ st0 = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; @@ -669,7 +673,11 @@ static ivas_error ivas_mc_enc_reconfig( st_ivas->nSCE = 0; st_ivas->nCPE = st_ivas->hEncoderConfig->nchan_inp / 2; +#ifndef IVAS_FLOAT_FIXED st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels( st_ivas->hEncoderConfig->mc_input_setup ); +#else + st_ivas->nchan_transport = ivas_mc_ls_setup_get_num_channels_fx( st_ivas->hEncoderConfig->mc_input_setup ); +#endif if ( last_mc_mode != MC_MODE_MCT ) { @@ -789,7 +797,11 @@ static ivas_error ivas_mc_enc_reconfig( { if ( last_mc_mode != MC_MODE_MCMASA ) { +#ifndef IVAS_FLOAT_FIXED ivas_mcmasa_setNumTransportChannels( &( st_ivas->nchan_transport ), &( st_ivas->hEncoderConfig->element_mode_init ), st_ivas->hEncoderConfig->ivas_total_brate ); +#else + ivas_mcmasa_setNumTransportChannels_fx( &( st_ivas->nchan_transport ), &( st_ivas->hEncoderConfig->element_mode_init ), st_ivas->hEncoderConfig->ivas_total_brate ); +#endif if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) { @@ -893,7 +905,11 @@ static ivas_error ivas_mc_enc_reconfig( if ( st_ivas->mc_mode == MC_MODE_MCMASA ) { +#ifndef IVAS_FLOAT_FIXED ivas_mcmasa_split_brate( st_ivas->hMcMasa->separateChannelEnabled, st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); +#else + ivas_mcmasa_split_brate_fx( st_ivas->hMcMasa->separateChannelEnabled, st_ivas->hEncoderConfig->ivas_total_brate, st_ivas->nSCE, st_ivas->nCPE, &new_brate_SCE, &new_brate_CPE ); +#endif } else if ( st_ivas->mc_mode == MC_MODE_MCT ) { diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 33c01705dfe2b9a5bb8fa3b7f1294248a11eaeb8..b2eaa480076ec2a7a0e66b860c4fbf16927977da 100644 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -762,7 +762,11 @@ ivas_error IVAS_ENC_ConfigureForMultichannel( break; } +#ifndef IVAS_FLOAT_FIXED hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels( hEncoderConfig->mc_input_setup ); +#else + hEncoderConfig->nchan_inp = ivas_mc_ls_setup_get_num_channels_fx( hEncoderConfig->mc_input_setup ); +#endif hIvasEnc->maxBandwidthUser = max_bwidth_user;