Loading lib_com/ivas_cnst.h +5 −0 Original line number Diff line number Diff line Loading @@ -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 Loading lib_com/ivas_mc_com.c +167 −21 Original line number Diff line number Diff line Loading @@ -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 /*--------------------------------------------------------------- Loading @@ -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 ) { Loading @@ -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: Loading @@ -127,6 +201,7 @@ MC_MODE ivas_mc_mode_select( return mc_mode; } #endif /*--------------------------------------------------------------- Loading @@ -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 */ ) { Loading Loading @@ -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 */ ) Loading @@ -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" ); Loading @@ -253,6 +361,7 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( return mc_ls_setup; } #endif /*--------------------------------------------------------------- Loading @@ -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 lib_com/ivas_mc_param_com.c +1 −1 Original line number Diff line number Diff line Loading @@ -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 */ Loading lib_com/ivas_mcmasa_com.c +50 −66 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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 /*--------------------------------------------------------------------------* Loading @@ -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 */ Loading @@ -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 /*--------------------------------------------------------------------------* Loading @@ -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 */ Loading @@ -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 ); Loading @@ -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(); Loading @@ -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 */ Loading Loading @@ -235,3 +218,4 @@ void ivas_mcmasa_split_brate( return; } #endif lib_com/ivas_prot.h +2 −8 Original line number Diff line number Diff line Loading @@ -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( Loading Loading
lib_com/ivas_cnst.h +5 −0 Original line number Diff line number Diff line Loading @@ -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 Loading
lib_com/ivas_mc_com.c +167 −21 Original line number Diff line number Diff line Loading @@ -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 /*--------------------------------------------------------------- Loading @@ -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 ) { Loading @@ -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: Loading @@ -127,6 +201,7 @@ MC_MODE ivas_mc_mode_select( return mc_mode; } #endif /*--------------------------------------------------------------- Loading @@ -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 */ ) { Loading Loading @@ -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 */ ) Loading @@ -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" ); Loading @@ -253,6 +361,7 @@ MC_LS_SETUP ivas_mc_map_output_config_to_mc_ls_setup( return mc_ls_setup; } #endif /*--------------------------------------------------------------- Loading @@ -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
lib_com/ivas_mc_param_com.c +1 −1 Original line number Diff line number Diff line Loading @@ -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 */ Loading
lib_com/ivas_mcmasa_com.c +50 −66 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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 /*--------------------------------------------------------------------------* Loading @@ -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 */ Loading @@ -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 /*--------------------------------------------------------------------------* Loading @@ -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 */ Loading @@ -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 ); Loading @@ -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(); Loading @@ -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 */ Loading Loading @@ -235,3 +218,4 @@ void ivas_mcmasa_split_brate( return; } #endif
lib_com/ivas_prot.h +2 −8 Original line number Diff line number Diff line Loading @@ -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( Loading