diff --git a/apps/decoder.c b/apps/decoder.c index 1d991b8ad34e243ba81967698f6a9f5df83245e2..bbbee76c883f924717f62aa12f8957bef5d562a1 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -535,11 +535,9 @@ cleanup: IVAS_DEC_HRTF_HANDLE hHrtfTD; IVAS_DEC_GetHrtfHandle( hIvasDec, &hHrtfTD ); dealloc_HRTF_binary( hHrtfTD ); -#ifdef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF; IVAS_DEC_GetHrtfCRendHandle( hIvasDec, &hSetOfHRTF ); destroy_SetOfHRTF( hSetOfHRTF ); -#endif } IVAS_DEC_Close( &hIvasDec ); CustomLsReader_close( &hLsCustomReader ); @@ -588,9 +586,7 @@ static IVAS_DEC_AUDIO_CONFIG cmdline2config( char argv_to_upper[FILENAME_MAX]; strncpy( argv_to_upper, argv, sizeof( argv_to_upper ) - 1 ); -#ifdef FIX_343_TO_UPPER argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; -#endif to_upper( argv_to_upper ); if ( strcmp( argv_to_upper, "EXT" ) == 0 ) /* external renderer */ @@ -669,9 +665,6 @@ static bool parseCmdlIVAS_dec( char argv_to_upper[FILENAME_MAX]; #ifdef DEBUGGING float ftmp; -#ifndef FIX_343_TO_UPPER - char stmp[FILENAME_MAX]; -#endif arg->forcedRendMode = IVAS_DEC_FORCE_REND_UNFORCED; arg->forceSubframeBinauralization = false; @@ -733,9 +726,7 @@ static bool parseCmdlIVAS_dec( while ( argv[i][0] == '-' ) { strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); -#ifdef FIX_343_TO_UPPER argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; -#endif to_upper( argv_to_upper ); if ( strcmp( argv_to_upper, "-VOIP" ) == 0 ) @@ -743,21 +734,13 @@ static bool parseCmdlIVAS_dec( arg->voipMode = 1; i++; } -#ifdef FIX_343_TO_UPPER else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=0" ) == 0 ) -#else - else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=0" ) == 0 ) -#endif { arg->voipMode = 1; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP; i++; } -#ifdef FIX_343_TO_UPPER else if ( strcmp( argv_to_upper, "-VOIP_HF_ONLY=1" ) == 0 ) -#else - else if ( strcmp( to_upper( argv[i] ), "-VOIP_HF_ONLY=1" ) == 0 ) -#endif { arg->voipMode = 1; arg->inputFormat = IVAS_DEC_INPUT_FORMAT_RTPDUMP_HF; @@ -830,14 +813,9 @@ static bool parseCmdlIVAS_dec( i++; if ( i < argc - 3 ) { -#ifdef FIX_343_TO_UPPER strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; arg->forcedRendMode = parseForcedRendModeDec( argv_to_upper ); -#else - strncpy( stmp, argv[i], sizeof( stmp ) ); - arg->forcedRendMode = parseForcedRendModeDec( stmp ); -#endif i++; } } @@ -890,7 +868,6 @@ static bool parseCmdlIVAS_dec( return false; } -#ifdef FIX_343_TO_UPPER strncpy( argv_to_upper, argv[i + 1], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; to_upper( argv_to_upper ); @@ -909,25 +886,6 @@ static bool parseCmdlIVAS_dec( usage_dec(); return false; } -#else - char tmp[4]; - strcpy( tmp, argv[i + 1] ); - - if ( strcmp( to_upper( tmp ), "REF" ) == 0 ) - { - arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_REF; - } - else if ( strcmp( to_upper( tmp ), "AVG" ) == 0 ) - { - arg->orientation_tracking = IVAS_PUBLIC_ORIENT_TRK_AVG; - } - else - { - fprintf( stderr, "Error: Invalid orientation tracking type %s \n\n", tmp ); - usage_dec(); - return false; - } -#endif i += 2; } else if ( strcmp( argv_to_upper, "-RENDER_CONFIG" ) == 0 ) @@ -954,7 +912,6 @@ static bool parseCmdlIVAS_dec( return false; } -#ifdef FIX_343_TO_UPPER strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; if ( ( strcmp( argv_to_upper, "CENTER" ) == 0 ) || ( strchr( argv_to_upper, 'C' ) != NULL ) ) @@ -980,32 +937,6 @@ static bool parseCmdlIVAS_dec( return false; } } -#else - char *param = to_upper( argv[i] ); - if ( ( strcmp( param, "CENTER" ) == 0 ) || ( strchr( param, 'C' ) != NULL ) ) - { - arg->no_diegetic_pan = 0.f; - } - else if ( ( strcmp( param, "LEFT" ) == 0 ) || ( strchr( param, 'L' ) != NULL ) ) - { - arg->no_diegetic_pan = -1.f; - } - else if ( ( strcmp( param, "RIGHT" ) == 0 ) || ( strchr( param, 'R' ) != NULL ) ) - { - arg->no_diegetic_pan = 1.f; - } - else - { - arg->no_diegetic_pan = (float) atof( param ); - - if ( arg->no_diegetic_pan > 1.0f || arg->no_diegetic_pan < -1.0f ) - { - fprintf( stderr, "Error: Incorrect value for panning option argument specified!\n\n" ); - usage_dec(); - return false; - } - } -#endif i++; } diff --git a/apps/encoder.c b/apps/encoder.c index 2aab6d5ae859b310082f95426104ce294914035f..09baa814aef7be0e841531f81f9127eaaf28578f 100644 --- a/apps/encoder.c +++ b/apps/encoder.c @@ -884,9 +884,7 @@ static bool parseCmdlIVAS_enc( while ( i < argc - 4 ) { strncpy( argv_to_upper, argv[i], sizeof( argv_to_upper ) - 1 ); -#ifdef FIX_343_TO_UPPER argv_to_upper[sizeof( argv_to_upper ) - 1] = '\0'; -#endif to_upper( argv_to_upper ); /*-----------------------------------------------------------------* @@ -898,9 +896,7 @@ static bool parseCmdlIVAS_enc( arg->max_bwidth_user = true; strncpy( stmp, argv[i + 1], sizeof( stmp ) - 1 ); -#ifdef FIX_343_TO_UPPER stmp[sizeof( stmp ) - 1] = '\0'; -#endif to_upper( stmp ); if ( strcmp( stmp, "-NB" ) == 0 || strcmp( stmp, "NB" ) == 0 ) @@ -1088,9 +1084,7 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { strncpy( stmp, argv[i], sizeof( stmp ) ); -#ifdef FIX_343_TO_UPPER stmp[sizeof( stmp ) - 1] = '\0'; -#endif to_upper( argv[i] ); if ( strcmp( argv[i], "LO" ) == 0 ) { @@ -1378,7 +1372,6 @@ static bool parseCmdlIVAS_enc( if ( i < argc - 4 ) { -#ifdef FIX_343_TO_UPPER if ( strcmp( argv[i], "5_1" ) == 0 ) { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1; @@ -1396,25 +1389,6 @@ static bool parseCmdlIVAS_enc( arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4; } else if ( strcmp( argv[i], "7_1_4" ) == 0 ) -#else - if ( strcmp( to_upper( argv[i] ), "5_1" ) == 0 ) - { - arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1; - } - else if ( strcmp( to_upper( argv[i] ), "7_1" ) == 0 ) - { - arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1; - } - else if ( strcmp( to_upper( argv[i] ), "5_1_2" ) == 0 ) - { - arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_2; - } - else if ( strcmp( to_upper( argv[i] ), "5_1_4" ) == 0 ) - { - arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_5_1_4; - } - else if ( strcmp( to_upper( argv[i] ), "7_1_4" ) == 0 ) -#endif { arg->inputFormatConfig.mcLayout = IVAS_ENC_MC_7_1_4; } diff --git a/apps/renderer.c b/apps/renderer.c index 64f1659b9d937096d93b4597983bdee128786088..66a1d666e3c27ea6fd6ae2cd55b83960b8fd470a 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -460,9 +460,7 @@ static void setupWithSingleFormatInput( /* It is allowed on CLI to have no metadata for an ISM input - skip opening if string is empty or contains "NULL" */ char charBuf[FILENAME_MAX]; strncpy( charBuf, args.inMetadataFilePaths[i], min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1 ); -#ifdef FIX_343_TO_UPPER charBuf[min( FILENAME_MAX, RENDERER_MAX_CLI_ARG_LENGTH ) - 1] = '\0'; -#endif to_upper( charBuf ); if ( isEmptyString( args.inMetadataFilePaths[i] ) || strncmp( charBuf, "NULL", 4 ) == 0 ) { @@ -1083,9 +1081,7 @@ static bool parseInConfig( /* First check if input is being set to scene description file - this is not covered by parseAudioConfig(). */ strncpy( charBuf, inFormatStr, sizeof( charBuf ) - 1 ); -#ifdef FIX_343_TO_UPPER charBuf[sizeof( charBuf ) - 1] = '\0'; -#endif to_upper( charBuf ); if ( strcmp( charBuf, "META" ) == 0 ) { @@ -1271,9 +1267,7 @@ static IVAS_REND_AudioConfig parseAudioConfig( charBuf[13] = '\0'; strncpy( charBuf, configString, sizeof( charBuf ) - 1 ); -#ifdef FIX_343_TO_UPPER charBuf[sizeof( charBuf ) - 1] = '\0'; -#endif to_upper( charBuf ); if ( ( strcmp( charBuf, "MONO" ) == 0 ) || ( strcmp( charBuf, "HOA0" ) == 0 ) || ( strcmp( charBuf, "SBA0" ) == 0 ) ) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 09134774c0420f7cde9fe6fceebaaa89e2c679ff..0db65bcf44575681c4f03c691b880bdfea0e2e18 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -585,11 +585,7 @@ typedef enum #define STEREO_DFT_RES_BW_MAX 66 /*Maximum number of bin for residual signal in each frame (res_cod_band_max == 6 in 48kHz)*/ -#ifdef DFT_STEREO_SPAR_MIXING #define SBA_DIRAC_STEREO_NUM_BANDS 12 -#else -#define SBA_DIRAC_STEREO_NUM_BANDS 5 -#endif #define SBA_DIRAC_NRG_SMOOTH_LONG 10 #define SBA_DIRAC_NRG_SMOOTH_SHORT 3 @@ -942,10 +938,8 @@ typedef enum { DIRAC_OPEN, /* initialize to default value */ DIRAC_RECONFIGURE /* HOA3 */ -#ifdef SBA_BR_SWITCHING , DIRAC_RECONFIGURE_MODE -#endif } DIRAC_CONFIG_FLAG; diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 9a69f81882c12273f5ce50a724a0a5085f40980d..7d0a42de93918c785ef1b8c24225491afae3a7b9 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -105,30 +105,12 @@ ivas_error mct_enc_reconfigure( Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ const uint16_t b_nchan_change /* i : flag indicating different channel count */ ); -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -ivas_error ivas_sba_enc_reinit( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -); -#endif -#endif -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -int16_t get_sba_reinit_flag( - int32_t ivas_total_bitrate, /* i : Current bitrate */ - int32_t last_ivas_total_brate /* i : Previous bitrate */ - , int16_t sba_order -); -#endif -#endif -#ifdef SBA_BR_SWITCHING ivas_error ivas_spar_md_enc_init ( ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -#endif ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); @@ -1089,10 +1071,8 @@ ivas_error stereo_dft_dec_create( const int32_t element_brate, /* i : element bitrate */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ -#ifdef DFT_STEREO_SPAR_MIXING , const int16_t nchan_transport -#endif ); void stereo_dft_dec_reset( @@ -1136,13 +1116,11 @@ void stereo_dft_dec( float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ -#ifdef DFT_STEREO_SPAR_MIXING , ivas_spar_md_dec_state_t *hMdDec, /* SPAR MD handle for upmixing */ int16_t cross_fade_start_offset, /* i: SPAR mixer delay compensation */ int32_t output_Fs, /* i: Fs for delay calculation */ int16_t nchan_transport /* i: number of transpor channels */ -#endif ); void stereo_dft_res_ecu( @@ -3161,13 +3139,6 @@ void ivas_sba_config( ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -ivas_error ivas_sba_dec_reinit( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -); -#endif -#endif void ivas_init_dec_get_num_cldfb_instances( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ @@ -3233,10 +3204,8 @@ void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[CPE_CHANNELS][L_FRAME48k], /* o : output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ -#ifdef DFT_STEREO_SPAR_MIXING , const int16_t mcmasa -#endif ); void ivas_sba_dirac_stereo_config( @@ -3245,12 +3214,10 @@ void ivas_sba_dirac_stereo_config( void ivas_sba_dirac_stereo_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: encoder DFT stereo handle */ -#ifdef DFT_STEREO_SPAR_MIXING , ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ int16_t cross_fade_start_offset, /* i: SPAR mixer delay compensation */ int32_t output_Fs /* i: Fs for delay calculation */ -#endif ); void ivas_sba2mc_cldfb( @@ -4065,9 +4032,7 @@ ivas_error ivas_spar_md_dec_open( const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels, /* i : number of internal channels */ const int16_t sba_order /* i : SBA order */ -#ifdef SBA_BR_SWITCHING_RECONFIG ,const int16_t sid_format -#endif ); void ivas_spar_md_dec_close( diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index d8ad889c3c5937a663726912ae24509ebd79e11e..44131d5bd237793d65aa0c9124e3c777ac6c9625 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -71,42 +71,6 @@ SBA_MODE ivas_sba_mode_select( return sba_mode; } -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -/*-------------------------------------------------------------------* - * get_sba_reinit_flag() - * - * Get SBA reinitialisation flag - *-------------------------------------------------------------------*/ - -int16_t get_sba_reinit_flag( - int32_t ivas_total_bitrate, /* i : Current bitrate */ - int32_t last_ivas_total_brate, /* i : Previous bitrate */ - int16_t sba_order ) -{ - int16_t sba_reinit_flag; - - sba_reinit_flag = 0; - if ( ivas_total_bitrate != last_ivas_total_brate && ( ivas_total_bitrate > IVAS_SID_5k2 ) ) - { - int16_t sba_analysis_order, nchan_transport_old, nchan_transport_new; - SBA_MODE last_sba_mode, current_sba_mode; - sba_analysis_order = ivas_sba_get_analysis_order( last_ivas_total_brate, sba_order ); - nchan_transport_old = ivas_get_sba_num_TCs( last_ivas_total_brate, min( sba_analysis_order, IVAS_MAX_SBA_ORDER ) ); - last_sba_mode = ivas_sba_mode_select( last_ivas_total_brate ); - current_sba_mode = ivas_sba_mode_select( ivas_total_bitrate ); - sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_bitrate, sba_order ); - nchan_transport_new = ivas_get_sba_num_TCs( ivas_total_bitrate, min( sba_analysis_order, IVAS_MAX_SBA_ORDER ) ); - if ( ( current_sba_mode != last_sba_mode ) || ( nchan_transport_new != nchan_transport_old ) ) - { - sba_reinit_flag = 1; - } - } - - return sba_reinit_flag; -} -#endif -#endif /*-------------------------------------------------------------------* * ivas_sba_config() * diff --git a/lib_com/options.h b/lib_com/options.h index 4ccaf4bdaa7096b48f6bc439110abfed842d2a0c..9a6a9d4c5bd9154708db4152dbd247a2eadda310 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -142,34 +142,12 @@ /*#define ITD_WINNER_GAIN_MODIFY */ /* ITD optimization - WORK IN PROGRESS */ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ -#define SBA_BR_SWITCHING /* Issue 114: Changes for SBA bit rate switching with reconfiguration for bitrates with same number of transport channels*/ -#ifdef SBA_BR_SWITCHING -#define SBA_BR_SWITCHING_RECONFIG /* Issue 114: Changes for SBA bitrate switching with reconfiguration for bitrates with different number of transport channels*/ -#endif - - #define LOW_RATE_TRANS_CORE_CODER /* Eri: Activate low-rate-encoding-of-transients contribution for core coder, affects MC, MASA and SBA */ - #define FIX_197_CREND_INTERFACE - #define FIX_329_ENABLE_TD_RENDERER_REVERB_MC /* Eri: Enable reverb for TD renderer for 5.1 and 7.1 with headtracking enabled for IVAS_dec */ - -#define FIX_MEMORY_COUNTING_HRTF_BINARY_FILE -#define FIX_334_DEBUG_BE_STEREO_SWITCHING /* FhG: Fix non-BE issue for stereo switching when DEBUGGING is enabled */ -#define FIX_198_TDREND_INTERFACE /* Issue 198: Harmonize interface for TD renderer between decoder and external renderer */ - -#define DFT_STEREO_SPAR_MIXING -#ifdef DFT_STEREO_SPAR_MIXING -#define FIX_345_MSAN_ERROR /* FhG: Fix memory sanitizer error in PLC modes */ -#define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ -/*#define DFT_STEREO_SPAR_MIXING_DEBUG*/ /* more debugging output for DFT_STEREO_SPAR_MIXING_DEBUG */ -#define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ -#endif - -#define FIX_343_TO_UPPER /* VA: issue 343: safeguard for function to_upper() */ - +#define FIX_347_DTX_CRASH /* FhG: Fix crash that can happen with DTX */ +#define DISABLE_RES_CHANNELS_MCT /* decode only W and residual for Y when outputting to stereo */ #define FIX_107_5MS_SUBFRAME_RENDERING - #define PARAM_ISM_DTX_CNG /* FhG: contribution 9 - DTX-CNG for ParamISM */ #define FIX_331_SBA_HBR_HOA_FIXES /* DLB: issue 331 - fix addressing low frequency stuttering with HOA inputs at high bitrates */ diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index be6f38d4581091b690f9d91ea1dc8fa4946e31d1..49429e0381c4645717e06756add56caf71b1893d 100755 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -449,11 +449,7 @@ ivas_error ivas_core_dec( *---------------------------------------------------------------------*/ /* save synth and output in case of SBA DirAC stereo output as core switching is done outside of core decoder */ -#ifdef DFT_STEREO_SPAR_MIXING if ( sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT && !( st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) -#else - if ( sba_dirac_stereo_flag && !( st->core_brate == SID_2k40 && st->cng_type == FD_CNG ) ) -#endif { mvr2r( synth[n], hSCE->save_synth, output_frame ); } @@ -676,11 +672,7 @@ ivas_error ivas_core_dec( } } -#ifdef DFT_STEREO_SPAR_MIXING if ( sba_dirac_stereo_flag && st->element_mode != IVAS_CPE_MDCT ) -#else - if ( sba_dirac_stereo_flag ) -#endif { /* for SBA DirAC stereo output DFT Stereo core switching and updates are done in ivas_sba_dirac_stereo_dec() as hCPE is not available at this point */ break; @@ -695,28 +687,16 @@ ivas_error ivas_core_dec( if ( st->element_mode != IVAS_CPE_DFT ) { -#ifdef DFT_STEREO_SPAR_MIXING if ( st->element_mode != IVAS_CPE_MDCT || sba_dirac_stereo_flag ) -#else - if ( st->element_mode != IVAS_CPE_MDCT ) -#endif { -#ifdef DFT_STEREO_SPAR_MIXING ivas_post_proc( hSCE, hCPE, n, synth[n], NULL, output_frame, sba_dirac_stereo_flag ); -#else - ivas_post_proc( hSCE, hCPE, n, synth[n], NULL, output_frame, 0 ); -#endif } /* update OLA buffers - needed for switching to DFT stereo */ -#ifdef DFT_STEREO_SPAR_MIXING if ( !sba_dirac_stereo_flag ) { stereo_td2dft_update( hCPE, n, output[n], synth[n], hb_synth[n], output_frame ); } -#else - stereo_td2dft_update( hCPE, n, output[n], synth[n], hb_synth[n], output_frame ); -#endif } else /* IVAS_CPE_DFT */ { diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index 21b8cdf05f5790ec88ab7b0a4321f871298bb212..bb2b75318116177bc34c6ed300d93135de535430 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -247,7 +247,6 @@ ivas_error ivas_corecoder_dec_reconfig( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->use_itd = 0; st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->reverse_dmx = 0; st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->smooth_ratio = 1.f; -#ifdef SBA_BR_SWITCHING_RECONFIG set_s( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->prev_ms_mask[0], 0, MAX_SFB ); set_s( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->prev_ms_mask[1], 0, MAX_SFB ); st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->lastCoh = 1.f; @@ -255,7 +254,6 @@ ivas_error ivas_corecoder_dec_reconfig( st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->mdct_stereo_mode[1] = SMDCT_DUAL_MONO; st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->IGFStereoMode[0] = -1; st_ivas->hCPE[st_ivas->nCPE - 1]->hStereoMdct->IGFStereoMode[1] = -1; -#endif for ( n = 0; n < CPE_CHANNELS; n++ ) { /* reset mct_chan_mode */ @@ -514,12 +512,10 @@ ivas_error ivas_cldfb_dec_reconfig( } } } -#ifdef SBA_BR_SWITCHING_RECONFIG /* CLDFB Interpolation weights */ if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) ) { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } -#endif return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c old mode 100755 new mode 100644 index b656f9255bd3bb13244c0d6b972696bee94f4099..e45dc9c6723ac1355cb20c1f19a448c8d5a26077 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -361,11 +361,7 @@ ivas_error ivas_cpe_dec( if ( hCPE->element_mode != IVAS_CPE_DFT || ( hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) { -#ifdef DFT_STEREO_SPAR_MIXING if ( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB, NULL, st_ivas->sba_dirac_stereo_flag ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_core_dec( st_ivas, NULL, hCPE, st_ivas->hMCT, n_channels, output, outputHB, NULL, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -410,12 +406,8 @@ ivas_error ivas_cpe_dec( } else { - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0 -#ifdef DFT_STEREO_SPAR_MIXING - , - 0, 0, 0, 0 -#endif - ); + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, + 0, 0, 0, 0 ); } /* synthesis iFFT */ @@ -463,9 +455,7 @@ ivas_error ivas_cpe_dec( /*----------------------------------------------------------------* * Synthesis synchronization between CPE modes *----------------------------------------------------------------*/ -#ifdef DFT_STEREO_SPAR_MIXING if ( !st_ivas->sba_dirac_stereo_flag ) -#endif { synchro_synthesis( ivas_total_brate, hCPE, output, output_frame, 0 ); } @@ -683,11 +673,7 @@ ivas_error create_cpe_dec( for ( n = 0; n < CPE_CHANNELS; n++ ) { - if ( st_ivas->sba_dirac_stereo_flag -#ifdef DFT_STEREO_SPAR_MIXING - && st_ivas->nchan_transport == 1 -#endif - ) + if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 ) { /* for SBA DirAC stereo output CPE element is only used for upmix, core coder is found in SCE element used for core decoding */ break; @@ -719,18 +705,10 @@ ivas_error create_cpe_dec( * DFT stereo initialization *-----------------------------------------------------------------*/ -#ifdef DFT_STEREO_SPAR_MIXING if ( hCPE->element_mode == IVAS_CPE_DFT || ( st_ivas->sba_dirac_stereo_flag && hCPE->cpe_id == 0 ) ) -#else - if ( hCPE->element_mode == IVAS_CPE_DFT || st_ivas->sba_dirac_stereo_flag ) -#endif { - if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, st_ivas->sba_dirac_stereo_flag -#ifdef DFT_STEREO_SPAR_MIXING - , - st_ivas->nchan_transport -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, st_ivas->sba_dirac_stereo_flag, + st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) { return error; } diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index db54bca1be96daecd7a47e507e317aa38b402a35..47f550f570cd51688054914b817e5903c832b25d 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -317,19 +317,13 @@ ivas_error ivas_dec( { nchan_remapped = CPE_CHANNELS; -#ifdef DFT_STEREO_SPAR_MIXING if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { ivas_spar_dec_gen_umx_mat( st_ivas->hSpar->hMdDec, st_ivas->nchan_transport, IVAS_MAX_NUM_BANDS, st_ivas->bfi ); } -#endif - ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame -#ifdef DFT_STEREO_SPAR_MIXING - , - st_ivas->ivas_format == MC_FORMAT -#endif - ); + ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame, + st_ivas->ivas_format == MC_FORMAT ); } else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( ivas_total_brate > IVAS_SID_5k2 || ( ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) { @@ -397,12 +391,10 @@ ivas_error ivas_dec( } } else /* SBA_MODE_SPAR */ -#ifdef DFT_STEREO_SPAR_MIXING if ( !st_ivas->sba_dirac_stereo_flag ) -#endif - { - ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ - } + { + ivas_sba_upmixer_renderer( st_ivas, output, output_frame ); /* Note: ivas_sba_linear_renderer() or ivas_dirac_dec() are called internally */ + } } else if ( st_ivas->ivas_format == MC_FORMAT ) { @@ -576,12 +568,8 @@ ivas_error ivas_dec( if ( st_ivas->sba_dirac_stereo_flag ) /* use the flag to trigger the DFT upmix */ { - ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame -#ifdef DFT_STEREO_SPAR_MIXING - , - 1 -#endif - ); + ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame, + 1 ); } /* HP filtering */ @@ -639,9 +627,7 @@ ivas_error ivas_dec( if ( !st_ivas->bfi ) /* do not update if first frame(s) are lost or NO_DATA */ { st_ivas->hDecoderConfig->last_ivas_total_brate = ivas_total_brate; -#ifdef SBA_BR_SWITCHING st_ivas->last_active_ivas_total_brate = ( ivas_total_brate <= IVAS_SID_5k2 ) ? st_ivas->last_active_ivas_total_brate : ivas_total_brate; -#endif } if ( st_ivas->ini_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) ) /* keep "st_ivas->ini_frame = 0" until first good received frame */ diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index f3090415ae70c33aac2ad9e8fdf578b7aa62428c..e6d5f846a399757539c15d3b5c428650cece669b 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -110,12 +110,8 @@ ivas_error ivas_dirac_dec_open( *-------------------------------------------------------------------------*/ ivas_error ivas_dirac_dec_config( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef SBA_BR_SWITCHING + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const DIRAC_CONFIG_FLAG flag_config_inp /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ -#else - const DIRAC_CONFIG_FLAG flag_config /* i/ : Flag determining if we open or reconfigure the DirAC decoder */ -#endif ) { DIRAC_DEC_HANDLE hDirAC; @@ -134,11 +130,9 @@ ivas_error ivas_dirac_dec_config( int32_t output_Fs, ivas_total_brate; ivas_error error; int16_t nchan_transport_orig; -#ifdef SBA_BR_SWITCHING DIRAC_CONFIG_FLAG flag_config; flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; -#endif error = IVAS_ERR_OK; hDirAC = NULL; @@ -190,11 +184,7 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_RECONFIGURE && st_ivas->ivas_format == SBA_FORMAT ) { int16_t tmp1, tmp2, tmp3; -#ifdef SBA_BR_SWITCHING_RECONFIG ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &nchan_transport_old, st_ivas->sba_planar, &tmp1, &tmp2, &tmp3 ); -#else - ivas_sba_config( st_ivas->hDecoderConfig->last_ivas_total_brate, st_ivas->sba_analysis_order, -1, &nchan_transport_old, st_ivas->sba_planar, &tmp1, &tmp2, &tmp3 ); -#endif } /*-----------------------------------------------------------------* @@ -649,11 +639,7 @@ ivas_error ivas_dirac_dec_config( } else if ( flag_config == DIRAC_RECONFIGURE && hDirAC->proto_signal_decorr_on && proto_signal_decorr_on_old ) { -#ifdef SBA_BR_SWITCHING if ( nchan_transport != nchan_transport_old || hDirAC->num_outputs_diff != num_outputs_diff_old || flag_config_inp == DIRAC_RECONFIGURE_MODE ) -#else - if ( ( nchan_transport != nchan_transport_old ) || ( hDirAC->num_outputs_diff != num_outputs_diff_old ) ) -#endif { /* close and reopen the decorrelator */ ivas_dirac_dec_decorr_close( &hDirAC->h_freq_domain_decorr_ap_params, &hDirAC->h_freq_domain_decorr_ap_state ); diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c old mode 100755 new mode 100644 index a8ea2a00a0bc1ca5e9c6593301df06ffa2443ffa..7f28bc4226fefcfec850a97c7443ad7c423668e2 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -125,35 +125,12 @@ ivas_error ivas_dec_setup( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); num_bits_read += SBA_ORDER_BITS; -#ifdef SBA_BR_SWITCHING if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->last_active_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate && ivas_total_brate > IVAS_SID_5k2 ) -#endif { -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING - int16_t sba_reinit_flag = get_sba_reinit_flag( ivas_total_brate, st_ivas->last_active_ivas_total_brate, st_ivas->sba_order ); - if ( sba_reinit_flag ) - { - if ( ( error = ivas_sba_dec_reinit( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else + if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { -#endif -#endif - if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING + return error; } -#endif -#endif } else { @@ -267,7 +244,6 @@ ivas_error ivas_dec_setup( st_ivas->element_mode_init = IVAS_CPE_MDCT; break; } -#ifdef SBA_BR_SWITCHING_RECONFIG if ( ( st_ivas->ini_frame > 0 ) && ( st_ivas->ivas_format == SBA_FORMAT ) ) { int16_t nchan_transport_old, nchan_transport; @@ -297,7 +273,6 @@ ivas_error ivas_dec_setup( st_ivas->hDecoderConfig->ivas_total_brate = ivas_total_brate; } } -#endif } /*-------------------------------------------------------------------* @@ -709,9 +684,7 @@ ivas_error ivas_init_decoder( ivas_total_brate = hDecoderConfig->ivas_total_brate; hDecoderConfig->last_ivas_total_brate = ivas_total_brate; -#ifdef SBA_BR_SWITCHING st_ivas->last_active_ivas_total_brate = ivas_total_brate; -#endif if ( output_config == AUDIO_CONFIG_EXTERNAL ) { @@ -920,9 +893,7 @@ ivas_error ivas_init_decoder( ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } -#ifdef DFT_STEREO_SPAR_MIXING st_ivas->sba_dirac_stereo_flag = ( output_config == AUDIO_CONFIG_STEREO ); -#endif } else /* SBA_MODE_DIRAC */ { @@ -968,11 +939,7 @@ ivas_error ivas_init_decoder( } /* create CPE element for DFT Stereo like upmix */ - if ( st_ivas->sba_dirac_stereo_flag -#ifdef DFT_STEREO_SPAR_MIXING - && st_ivas->nchan_transport == 1 -#endif - ) + if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 ) { if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) { @@ -1390,11 +1357,7 @@ ivas_error ivas_init_decoder( } /* CLDFB Interpolation weights */ - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR -#ifdef DFT_STEREO_SPAR_MIXING - && !st_ivas->sba_dirac_stereo_flag -#endif - ) + if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !st_ivas->sba_dirac_stereo_flag ) { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } @@ -1681,11 +1644,7 @@ void ivas_destroy_dec( if ( st_ivas->hCPE[i] != NULL ) { /* set pointer to NULL as core coder already deallocated in destroy_sce_dec() */ - if ( st_ivas->sba_dirac_stereo_flag -#ifdef DFT_STEREO_SPAR_MIXING - && st_ivas->nchan_transport == 1 -#endif - ) + if ( st_ivas->sba_dirac_stereo_flag && st_ivas->nchan_transport == 1 ) { st_ivas->hCPE[i]->hCoreCoder[0] = NULL; st_ivas->hCPE[i]->hCoreCoder[1] = NULL; @@ -1833,9 +1792,6 @@ void ivas_destroy_dec( /* CRend binaural renderer handle */ if ( st_ivas->hSetOfHRTF != NULL ) { -#ifndef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE - destroy_SetOfHRTF( st_ivas->hSetOfHRTF ); -#endif ivas_HRTF_CRend_binary_close( &st_ivas->hSetOfHRTF ); } @@ -1975,14 +1931,12 @@ void ivas_init_dec_get_num_cldfb_instances( case RENDERER_BINAURAL_FASTCONV_ROOM: if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { -#ifdef DFT_STEREO_SPAR_MIXING if ( st_ivas->sba_dirac_stereo_flag ) { *numCldfbAnalyses = 0; *numCldfbSyntheses = 0; } else -#endif { *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 69e96118fb51aabf37f03b4ee9be5d1d26d4c617..b5ed8f8cc985c0fe00bbe19f594d816538154b03 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -240,19 +240,13 @@ ivas_error ivas_mct_dec( break; } -#ifdef DFT_STEREO_SPAR_MIXING if ( st_ivas->sba_dirac_stereo_flag ) { ivas_post_proc( NULL, hCPE, n, synth[n], NULL, output_frame, 1 ); } -#endif /* Postprocessing for ACELP/MDCT core switching and synchronization */ -#ifdef DFT_STEREO_SPAR_MIXING if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, st_ivas->sba_dirac_stereo_flag, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = core_switching_post_dec( sts[n], synth[n], output[cpe_id * CPE_CHANNELS + n], hCPE->output_mem[1], 0, output_frame, 0 /*core_switching_flag*/, 0, -1, hCPE->last_element_mode ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -273,14 +267,10 @@ ivas_error ivas_mct_dec( /* synthesis synchronization between stereo modes */ -#ifdef DFT_STEREO_SPAR_MIXING if ( !st_ivas->sba_dirac_stereo_flag ) { synchro_synthesis( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); } -#else - synchro_synthesis( ivas_total_brate, hCPE, output + cpe_id * CPE_CHANNELS, output_frame, 0 ); -#endif #ifdef DEBUG_PLOT for ( n = 0; n < CPE_CHANNELS; n++ ) diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index 1daf799fe7f189c5b444a65bdadb2ec3ddc85d55..d2f08ffdd62086f599ca2e7ce1d552d5db2a83d0 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -43,8 +43,6 @@ #include "wmc_auto.h" -#ifdef FIX_198_TDREND_INTERFACE - /*---------------------------------------------------------------------* * ivas_td_binaural_open() * @@ -59,142 +57,6 @@ ivas_error ivas_td_binaural_open( st_ivas->transport_config, st_ivas->hTransSetup, &st_ivas->hBinRendererTd, &st_ivas->binaural_latency_ns ); } -#else - -/*---------------------------------------------------------------------* - * ivas_td_binaural_open() - * - * Open and initialize TD Object binaural renderer - *---------------------------------------------------------------------*/ - -ivas_error ivas_td_binaural_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; - TDREND_PosType_t PosType; - int16_t nS; - int16_t SrcInd[MAX_NUM_TDREND_CHANNELS]; - const float *ls_azimuth, *ls_elevation; - float Pos[3]; - float Dir[3]; - TDREND_DirAtten_t *DirAtten_p; - int16_t nchan_rend; - ivas_error error; - - error = IVAS_ERR_OK; - - if ( ( hBinRendererTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - - hBinRendererTd->NumOfSrcs = 0; - hBinRendererTd->MaxSrcInd = -1; - - /* Mixer spatial setup */ - hBinRendererTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; - hBinRendererTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ - - TDREND_MIX_Init( hBinRendererTd, &st_ivas->hHrtfTD, hBinRendererTd->TdRend_MixSpatSpec_p, st_ivas->hDecoderConfig->output_Fs ); - - /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ - TDREND_MIX_SetDistAttenModel( hBinRendererTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); - - /* Add sources to module and mixer, headphones */ - PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ - - nchan_rend = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MC_FORMAT ) - { - nchan_rend--; /* Skip LFE channel -- added to the others */ - } - - for ( nS = 0; nS < nchan_rend; nS++ ) - { - if ( ( error = TDREND_MIX_AddSrc( hBinRendererTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( st_ivas->ivas_format == MC_FORMAT ) - { - switch ( st_ivas->transport_config ) - { - case AUDIO_CONFIG_5_1: - ls_azimuth = ls_azimuth_CICP6; - ls_elevation = ls_elevation_CICP6; - break; - case AUDIO_CONFIG_7_1: - ls_azimuth = ls_azimuth_CICP12; - ls_elevation = ls_elevation_CICP12; - break; - case AUDIO_CONFIG_5_1_2: - ls_azimuth = ls_azimuth_CICP14; - ls_elevation = ls_elevation_CICP14; - break; - case AUDIO_CONFIG_5_1_4: - ls_azimuth = ls_azimuth_CICP16; - ls_elevation = ls_elevation_CICP16; - break; - case AUDIO_CONFIG_7_1_4: - ls_azimuth = ls_azimuth_CICP19; - ls_elevation = ls_elevation_CICP19; - break; - case AUDIO_CONFIG_LS_CUSTOM: - ls_azimuth = st_ivas->hTransSetup.ls_azimuth; - ls_elevation = st_ivas->hTransSetup.ls_elevation; - break; - default: - ls_azimuth = NULL; - ls_elevation = NULL; - } - - DirAtten_p = hBinRendererTd->DirAtten_p; - - for ( nS = 0; nS < nchan_rend; nS++ ) - { - /* Set source positions according to loudspeaker layout */ - Pos[0] = cosf( ls_elevation[nS] * PI_OVER_180 ) * cosf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[1] = cosf( ls_elevation[nS] * PI_OVER_180 ) * sinf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[2] = sinf( ls_elevation[nS] * PI_OVER_180 ); - Dir[0] = 1.0f; - Dir[1] = 0.0f; - Dir[2] = 0.0f; - - /* Source directivity info */ - DirAtten_p->ConeInnerAngle = 360.0f; - DirAtten_p->ConeOuterAngle = 360.0f; - DirAtten_p->ConeOuterGain = 1.0f; - - TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); - TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); - } - } - - st_ivas->hBinRendererTd = hBinRendererTd; - - st_ivas->binaural_latency_ns = (int32_t) ( hBinRendererTd->HrFiltSet_p->latency_s * 1000000000.f ); - - return error; -} -#endif - /*---------------------------------------------------------------------* * ivas_td_binaural_renderer() @@ -209,7 +71,6 @@ void ivas_td_binaural_renderer( const int16_t output_frame /* i : output frame length */ ) { -#ifdef FIX_198_TDREND_INTERFACE ivas_td_binaural_renderer_unwrap( st_ivas->hRenderConfig, st_ivas->ini_frame, #ifdef FIX_197_CREND_INTERFACE st_ivas->hCrendWrapper, @@ -219,58 +80,4 @@ void ivas_td_binaural_renderer( st_ivas->transport_config, st_ivas->hDecoderConfig->output_Fs, st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, output, output_frame ); -#else - int16_t subframe_length; - int16_t subframe_idx; - float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; - - subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; - if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - { - - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) - { -#ifdef FIX_197_CREND_INTERFACE - ivas_reverb_open( &st_ivas->hCrendWrapper->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); -#else - ivas_reverb_open( &st_ivas->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); -#endif - } - } - - /* Update object position(s) */ - TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, output ); - - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - /* Update the listener's location/orientation */ - TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, - st_ivas->hDecoderConfig->Opt_Headrotation, - ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[subframe_idx] : NULL ); - - if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) - { -#ifdef FIX_197_CREND_INTERFACE - ivas_reverb_process( st_ivas->hCrendWrapper->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); -#else - ivas_reverb_process( st_ivas->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); -#endif - } - - /* Render subframe */ - TDREND_GetMix( st_ivas->hBinRendererTd, output, subframe_length, subframe_idx ); - } - - if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - { - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) - { - /* add reverb to rendered signals */ - v_add( reverb_signal[0], output[0], output[0], output_frame ); - v_add( reverb_signal[1], output[1], output[1], output_frame ); - } - } - - return; -#endif } diff --git a/lib_dec/ivas_post_proc.c b/lib_dec/ivas_post_proc.c index 849f4b79c079273b7f05e38406e3ab51e46eda3e..da00426116a6db051a81bcc68a4994b85b15ebe6 100644 --- a/lib_dec/ivas_post_proc.c +++ b/lib_dec/ivas_post_proc.c @@ -81,11 +81,7 @@ void ivas_post_proc( output_Fs = sts[0]->output_Fs; -#ifdef DFT_STEREO_SPAR_MIXING if ( ( sts[n]->element_mode != IVAS_CPE_DFT && !( sba_dirac_stereo_flag && sts[n]->element_mode != IVAS_CPE_MDCT ) ) || ( sts[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) -#else - if ( ( sts[n]->element_mode != IVAS_CPE_DFT && !sba_dirac_stereo_flag ) || ( sts[n]->element_mode == IVAS_CPE_DFT && hCPE->nchan_out == 1 && hCPE->hStereoDft->hConfig->res_cod_mode == STEREO_DFT_RES_COD_OFF ) ) -#endif { if ( sts[n]->hTcxLtpDec != NULL ) { @@ -106,13 +102,11 @@ void ivas_post_proc( mvr2r( sts[n]->prev_synth_buffer, sts[n]->hTcxDec->FBTCXdelayBuf, 0 ); mvr2r( sts[n]->delay_buf_out, sts[n]->hTcxDec->FBTCXdelayBuf + 0, delay_comp ); } -#ifdef DFT_STEREO_SPAR_MIXING else if ( sba_dirac_stereo_flag && sts[n]->element_mode == IVAS_CPE_MDCT ) { int16_t numZeros = (int16_t) ( NS2SA( output_Fs, N_ZERO_MDCT_NS ) ); mvr2r( sts[n]->hHQ_core->old_out + numZeros, sts[n]->hTcxDec->FBTCXdelayBuf, delay_comp ); } -#endif tcx_ltp_post( sts[n], hTcxLtpDec, sts[n]->core, output_frame, NS2SA( output_Fs, ACELP_LOOK_NS ) + delay_comp, synth, sts[n]->hTcxDec->FBTCXdelayBuf ); } diff --git a/lib_dec/ivas_rom_dec.c b/lib_dec/ivas_rom_dec.c index 664c7308167cf9db41b843d450aa9c496ba78d8b..32c78bba05a2a983283182962a58e8d05dcd8f33 100644 --- a/lib_dec/ivas_rom_dec.c +++ b/lib_dec/ivas_rom_dec.c @@ -231,7 +231,6 @@ const int16_t cna_init_bands[MAX_CNA_NBANDS + 1] = 1, 4, 14, 33, 67, 171, 320 }; -#ifdef DFT_STEREO_SPAR_MIXING const float max_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS] = { 0.98f, 0.97f, 0.95f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f, 0.9f @@ -250,12 +249,6 @@ const float min_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS] = { 0.5f, 0.5f, 0.5, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.3f, 0.3f, 0.3f }; -#else -const float max_smooth_gains[SBA_DIRAC_STEREO_NUM_BANDS] = -{ - 0.98f, 0.97f, 0.95f, 0.9f, 0.9f -}; -#endif /*------------------------------------------------------------------------- * ECLVQ Stereo ROM tables diff --git a/lib_dec/ivas_rom_dec.h b/lib_dec/ivas_rom_dec.h index 3931d527514ea490cf2578d122897706dbb8ae2f..2f1dfa8239962681a351f48dc2d6e33e18edf4e0 100644 --- a/lib_dec/ivas_rom_dec.h +++ b/lib_dec/ivas_rom_dec.h @@ -71,14 +71,10 @@ extern const float dft_win_8k[70]; extern const int16_t cna_init_bands[MAX_CNA_NBANDS + 1]; -#ifdef DFT_STEREO_SPAR_MIXING extern const float min_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS]; extern const float max_smooth_gains1[SBA_DIRAC_STEREO_NUM_BANDS]; extern const float min_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS]; extern const float max_smooth_gains2[SBA_DIRAC_STEREO_NUM_BANDS]; -#else -extern const float max_smooth_gains[SBA_DIRAC_STEREO_NUM_BANDS]; -#endif /*----------------------------------------------------------------------------------* * ECLVQ Stereo ROM tables diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 7480e26801922c85e271f942ed91e6c7c74a17e5..8595aaf673f37778afa9a59a18055e53084c252e 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -38,9 +38,7 @@ #include "prot.h" #include "ivas_prot.h" #include "ivas_prot_rend.h" -#ifdef SBA_BR_SWITCHING #include "ivas_rom_com.h" -#endif #include "ivas_rom_dec.h" #include #ifdef DEBUGGING @@ -48,517 +46,6 @@ #endif #include "wmc_auto.h" -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -/*-------------------------------------------------------------------* - * ivas_sba_dec_reinit() - * - * Reinitialisation of IVAS SBA decoder - *-------------------------------------------------------------------*/ - -ivas_error ivas_sba_dec_reinit( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -{ - int16_t i, k, n; - int16_t sce_id, cpe_id; - int16_t numCldfbAnalyses; - int16_t numCldfbSyntheses; - int32_t output_Fs, ivas_total_brate; - AUDIO_CONFIG output_config; - DECODER_CONFIG_HANDLE hDecoderConfig; - ivas_error error; - - error = IVAS_ERR_OK; - - hDecoderConfig = st_ivas->hDecoderConfig; - output_Fs = hDecoderConfig->output_Fs; - output_config = hDecoderConfig->output_config; - ivas_total_brate = hDecoderConfig->ivas_total_brate; - - hDecoderConfig->last_ivas_total_brate = ivas_total_brate; - st_ivas->last_active_ivas_total_brate = ivas_total_brate; - - /*------------------------------------------------------------------------------------------* - * Closing Decoder handles before Reinitialisation - *------------------------------------------------------------------------------------------*/ - /* Qmetadata handle */ - ivas_qmetadata_close( &st_ivas->hQMetaData ); - - /* DirAC handle */ - if ( st_ivas->hDirAC != NULL ) - { - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - ivas_param_ism_dec_close( st_ivas->hDirAC, hDecoderConfig->output_config ); - } - else - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - } - st_ivas->hDirAC = NULL; - } - - /* Spar handle */ - if ( st_ivas->hSpar != NULL ) - { - ivas_spar_dec_close( st_ivas->hSpar, hDecoderConfig->output_Fs ); - st_ivas->hSpar = NULL; - } - - /* SCE handles */ - for ( i = 0; i < MAX_SCE; i++ ) - { - if ( st_ivas->hSCE[i] != NULL ) - { - destroy_sce_dec( st_ivas->hSCE[i] ); - st_ivas->hSCE[i] = NULL; - } - } - - /* CPE handles */ - for ( i = 0; i < MAX_CPE; i++ ) - { - if ( st_ivas->hCPE[i] != NULL ) - { - /* set pointer to NULL as core coder already deallocated in destroy_sce_dec() */ - if ( st_ivas->sba_dirac_stereo_flag ) - { - st_ivas->hCPE[i]->hCoreCoder[0] = NULL; - st_ivas->hCPE[i]->hCoreCoder[1] = NULL; - } - destroy_cpe_dec( st_ivas->hCPE[i] ); - st_ivas->hCPE[i] = NULL; - } - } - - /* MCT handle */ - ivas_mct_dec_close( &st_ivas->hMCT ); - - /* HP20 filter handles */ - if ( st_ivas->mem_hp20_out != NULL ) - { - for ( i = 0; i < getNumChanSynthesis( st_ivas ); i++ ) - { - free( st_ivas->mem_hp20_out[i] ); - st_ivas->mem_hp20_out[i] = NULL; - } - free( st_ivas->mem_hp20_out ); - st_ivas->mem_hp20_out = NULL; - } - - /* HOA decoder matrix */ - if ( st_ivas->hoa_dec_mtx != NULL ) - { - free( st_ivas->hoa_dec_mtx ); - st_ivas->hoa_dec_mtx = NULL; - } - - /* Parametric MC handle */ - ivas_param_mc_dec_close( &st_ivas->hParamMC ); - - /* EFAP handle */ - efap_free_data( &st_ivas->hEFAPdata ); - - /* VBAP handle */ - vbap_free_data( &( st_ivas->hVBAPdata ) ); - - /* Fastconv binaural renderer handle */ - ivas_binRenderer_close( &st_ivas->hBinRenderer ); - - /* Parametric binaural renderer handle */ - ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); - - /* Crend handle */ -#ifdef FIX_197_CREND_INTERFACE - ivas_rend_closeCrend( &st_ivas->hCrendWrapper ); -#else - ivas_crend_close( st_ivas ); -#endif - - /* LS config converter handle */ - ivas_ls_setup_conversion_close( &st_ivas->hLsSetUpConversion ); - - /* Custom LS configuration handle */ - if ( st_ivas->hLsSetupCustom != NULL ) - { - free( st_ivas->hLsSetupCustom ); - st_ivas->hLsSetupCustom = NULL; - } - - /* MASA decoder structure */ - if ( st_ivas->hMasa != NULL ) - { - ivas_masa_dec_close( st_ivas->hMasa ); - st_ivas->hMasa = NULL; - } - - /* Downmix structure */ - if ( st_ivas->hMonoDmxRenderer != NULL ) - { - free( st_ivas->hMonoDmxRenderer ); - st_ivas->hMonoDmxRenderer = NULL; - } - - /* Head track data handle */ - if ( st_ivas->hHeadTrackData != NULL ) - { - free( st_ivas->hHeadTrackData ); - st_ivas->hHeadTrackData = NULL; - } - - /* Time Domain binaural renderer handle */ - if ( st_ivas->hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - } - else if ( st_ivas->hHrtfTD != NULL ) - { - BSplineModelEvalDealloc( &st_ivas->hHrtfTD->ModelParams, &st_ivas->hHrtfTD->ModelEval ); - - ivas_HRTF_binary_close( &st_ivas->hHrtfTD ); - } - - /* Config. Renderer */ - ivas_render_config_close( &( st_ivas->hRenderConfig ) ); - - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) - { - if ( st_ivas->cldfbAnaDec[i] != NULL ) - { - deleteCldfb( &( st_ivas->cldfbAnaDec[i] ) ); - st_ivas->cldfbAnaDec[i] = NULL; - } - } - - for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) - { - if ( st_ivas->cldfbSynDec[i] != NULL ) - { - deleteCldfb( &( st_ivas->cldfbSynDec[i] ) ); - st_ivas->cldfbSynDec[i] = NULL; - } - } - - /*------------------------------------------------------------------------------------------* - * Reopening Decoder handles for Reinitialisation - *------------------------------------------------------------------------------------------*/ - - /* Allocate and initialize Custom loudspeaker layout handle */ - if ( hDecoderConfig->Opt_LsCustom ) - { - if ( ( error = ivas_ls_custom_open( &( st_ivas->hLsSetupCustom ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* Allocate and initialize Head-Tracking handle */ - if ( hDecoderConfig->Opt_Headrotation ) - { - if ( ( error = ivas_headTrack_open( &( st_ivas->hHeadTrackData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - /* Allocate HRTF binary handle */ - if ( hDecoderConfig->Opt_HRTF_binary ) - { - if ( ( error = ivas_HRTF_binary_open( &( st_ivas->hHrtfTD ) ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - st_ivas->sba_dirac_stereo_flag = 0; - /*Reconfigure output paramaters*/ - ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &( st_ivas->nchan_transport ), st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); - ivas_renderer_select( st_ivas ); - ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); - if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) - { - if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - for ( k = 0; k < DIRAC_MAX_NBANDS; k++ ) - { - st_ivas->hSpar->dirac_to_spar_md_bands[k] = st_ivas->hDirAC->dirac_to_spar_md_bands[k]; - } - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; - } - else - { - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - - st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), - st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); - } - } - else - { - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && output_config == AUDIO_CONFIG_STEREO ); - } - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && - st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - if ( ( error = create_sce_dec( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) - { - return error; - } - - reset_indices_dec( st_ivas->hSCE[sce_id]->hCoreCoder[0] ); - } - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - if ( ( error = create_cpe_dec( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - reset_indices_dec( st_ivas->hCPE[cpe_id]->hCoreCoder[n] ); - } - } - - /* create CPE element for DFT Stereo like upmix */ - if ( st_ivas->sba_dirac_stereo_flag ) - { - if ( ( error = create_cpe_dec( st_ivas, cpe_id, ivas_total_brate / ( st_ivas->nSCE + st_ivas->nCPE ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->hCPE[0]->hCoreCoder[0] = st_ivas->hSCE[0]->hCoreCoder[0]; /* don't allocate unnecessary core coder, simply point to core coder of SCE element */ - } - - /* set CNA/CNG flags */ - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 0; - } - else if ( st_ivas->nchan_transport == 1 && ( ( st_ivas->renderer_type == RENDERER_DIRAC && st_ivas->hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) || ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) ) ) - { - st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 1; - st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag = 1; - } - else if ( st_ivas->nchan_transport == 2 ) - { - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[0]->hCoreCoder[n]->cna_dirac_flag = 0; /* Todo: Check if these can be enabled */ - st_ivas->hCPE[0]->hCoreCoder[n]->cng_sba_flag = 1; - } - } - - if ( st_ivas->nCPE > 1 ) - { - if ( ( error = create_mct_dec( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - /* set number of output channels used for synthesis/decoding */ - n = getNumChanSynthesis( st_ivas ); - - if ( n > 0 ) - { - if ( ( st_ivas->mem_hp20_out = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - } - else - { - st_ivas->mem_hp20_out = NULL; - } - - for ( i = 0; i < n; i++ ) - { - if ( ( st_ivas->mem_hp20_out[i] = (float *) malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); - } - if ( hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) - { - if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ivas_render_config_init_from_rom( &st_ivas->hRenderConfig, hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ) != IVAS_ERR_OK ) - { - return IVAS_ERR_INTERNAL_FATAL; - } - } - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - if ( ( error = ivas_binRenderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) - { - if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) - { - if ( ( error = ivas_dirac_dec_binaural_copy_hrtfs( &st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_dec_init_binaural_data( st_ivas, st_ivas->hHrtfParambin ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) - { - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) - { -#ifdef FIX_197_CREND_INTERFACE -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC - if ( ( error = ivas_rend_initCrendWrapper( &st_ivas->hCrendWrapper ) ) != IVAS_ERR_OK ) -#else - if ( ( st_ivas->hCrendWrapper = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) -#endif - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for CrendWrapper\n" ); - } -#ifdef FIX_329_ENABLE_TD_RENDERER_REVERB_MC - st_ivas->hCrendWrapper->hCrend = NULL; - st_ivas->hCrendWrapper->hHrtfCrend = NULL; -#endif - if ( ( st_ivas->hCrendWrapper->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) -#else - if ( ( st_ivas->hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) -#endif - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend\n" ); - } - } - } - else if ( st_ivas->renderer_type == RENDERER_MC ) - { - if ( ( error = ivas_ls_setup_conversion_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX ) - { - if ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) - { -#ifdef FIX_197_CREND_INTERFACE - if ( ( error = ivas_rend_openCrend( &st_ivas->hCrendWrapper, - getRendAudioConfigFromIvasAudioConfig( st_ivas->intern_config ), - getRendAudioConfigFromIvasAudioConfig( st_ivas->hDecoderConfig->output_config ), - st_ivas->hRenderConfig, - t_ivas->hDecoderConfig->Opt_Headrotation, - st_ivas->hSetOfHRTF, - st_ivas->hDecoderConfig->output_Fs ) ) != IVAS_ERR_OK ) - { - return error; - } - st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#else - if ( ivas_crend_open( st_ivas ) != IVAS_ERR_OK ) - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "ivas_crend_open failed" ); - } -#endif - } - ivas_init_dec_get_num_cldfb_instances( st_ivas, &numCldfbAnalyses, &numCldfbSyntheses ); - - for ( i = 0; i < numCldfbAnalyses; i++ ) - { - if ( ( error = openCldfb( &( st_ivas->cldfbAnaDec[i] ), CLDFB_ANALYSIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) - { - return error; - } - } - for ( ; i < MAX_INTERN_CHANNELS; i++ ) - { - st_ivas->cldfbAnaDec[i] = NULL; - } - - for ( i = 0; i < numCldfbSyntheses; i++ ) - { - if ( ( error = openCldfb( &( st_ivas->cldfbSynDec[i] ), CLDFB_SYNTHESIS, output_Fs, CLDFB_PROTOTYPE_5_00MS ) ) != IVAS_ERR_OK ) - { - return error; - } - } - for ( ; i < MAX_OUTPUT_CHANNELS; i++ ) - { - st_ivas->cldfbSynDec[i] = NULL; - } - - /* CLDFB Interpolation weights */ - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) - { - ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); - } - return error; -} -#endif -#endif /*-------------------------------------------------------------------* * ivas_sba_dec_decoder() * @@ -573,16 +60,8 @@ ivas_error ivas_sba_dec_reconfigure( AUDIO_CONFIG intern_config_old; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old; int16_t sba_dirac_stereo_flag_old; -#ifdef SBA_BR_SWITCHING_RECONFIG SBA_MODE sba_mode_old; int32_t ivas_total_brate, last_ivas_total_brate; -#else -#ifndef SBA_BR_SWITCHING - int32_t ivas_total_brate, last_ivas_total_brate; -#else - int32_t ivas_total_brate; -#endif -#endif DECODER_CONFIG_HANDLE hDecoderConfig; ivas_error error; @@ -590,16 +69,10 @@ ivas_error ivas_sba_dec_reconfigure( hDecoderConfig = st_ivas->hDecoderConfig; ivas_total_brate = hDecoderConfig->ivas_total_brate; -#ifdef SBA_BR_SWITCHING_RECONFIG last_ivas_total_brate = st_ivas->last_active_ivas_total_brate; sba_mode_old = ivas_sba_mode_select( last_ivas_total_brate ); st_ivas->sba_mode = sba_mode_old; -#else -#ifndef SBA_BR_SWITCHING - last_ivas_total_brate = hDecoderConfig->last_ivas_total_brate; -#endif -#endif /*-----------------------------------------------------------------* * Set SBA high-level parameters * Save old SBA high-level parameters @@ -626,10 +99,7 @@ ivas_error ivas_sba_dec_reconfigure( sba_dirac_stereo_flag_old = st_ivas->sba_dirac_stereo_flag; st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); -#ifdef SBA_BR_SWITCHING_RECONFIG st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); -#endif -#ifdef SBA_BR_SWITCHING /*-----------------------------------------------------------------* * Allocate, initalize, and configure SBA handles *-----------------------------------------------------------------*/ @@ -648,16 +118,11 @@ ivas_error ivas_sba_dec_reconfigure( } else { -#ifdef SBA_BR_SWITCHING_RECONFIG int16_t i, sba_order_internal, nchan_internal; -#else - int16_t sba_order_internal; -#endif DIRAC_DEC_HANDLE hDirAC = st_ivas->hDirAC; SPAR_DEC_HANDLE hSpar = st_ivas->hSpar; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); -#ifdef SBA_BR_SWITCHING_RECONFIG nchan_internal = ivas_sba_get_nchan_metadata( sba_order_internal ); if ( hSpar != NULL && nchan_transport_old != ivas_get_sba_num_TCs( ivas_total_brate, sba_order_internal ) ) { @@ -719,7 +184,6 @@ ivas_error ivas_sba_dec_reconfigure( } hSpar->i_subframe = 0; } -#endif /* PCA handle */ if ( hSpar != NULL ) { @@ -738,7 +202,6 @@ ivas_error ivas_sba_dec_reconfigure( hSpar->hPCA = NULL; } } -#ifdef SBA_BR_SWITCHING_RECONFIG if ( hSpar == NULL && st_ivas->sba_mode == SBA_MODE_SPAR ) { if ( ( error = ivas_spar_dec_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -748,7 +211,6 @@ ivas_error ivas_sba_dec_reconfigure( hSpar = st_ivas->hSpar; } -#endif st_ivas->sba_dirac_stereo_flag = 0; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); @@ -763,17 +225,9 @@ ivas_error ivas_sba_dec_reconfigure( hDirAC = st_ivas->hDirAC; } -#ifndef SBA_BR_SWITCHING_RECONFIG - if ( hDirAC != NULL ) -#else if ( ( hDirAC != NULL ) && ( sba_mode_old == st_ivas->sba_mode ) ) -#endif { ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE_MODE ); -#ifndef SBA_BR_SWITCHING_RECONFIG - mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); - hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; -#endif } if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) { @@ -788,19 +242,13 @@ ivas_error ivas_sba_dec_reconfigure( { st_ivas->element_mode_init = IVAS_CPE_MDCT; } -#else - ivas_sba_config( ivas_total_brate, st_ivas->sba_analysis_order, -1, &st_ivas->nchan_transport, st_ivas->sba_planar, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init ); - -#endif /*-----------------------------------------------------------------* * Renderer selection *-----------------------------------------------------------------*/ /* renderer might have changed */ intern_config_old = st_ivas->intern_config; -#ifdef SBA_BR_SWITCHING RENDERER_TYPE old_renderer_type; old_renderer_type = st_ivas->renderer_type; -#endif ivas_renderer_select( st_ivas ); /* side effect of the renderer selection can be a changed internal config */ @@ -825,10 +273,8 @@ ivas_error ivas_sba_dec_reconfigure( { ivas_binRenderer_close( &st_ivas->hBinRenderer ); } -#ifdef SBA_BR_SWITCHING if ( st_ivas->renderer_type != old_renderer_type ) { -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM || st_ivas->renderer_type == RENDERER_STEREO_PARAMETRIC ) { if ( st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) @@ -844,14 +290,11 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } -#ifdef SBA_BR_SWITCHING } -#endif else if ( st_ivas->hDiracDecBin != NULL && ( st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) ) { ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); } -#ifdef SBA_BR_SWITCHING_RECONFIG if ( ( ( st_ivas->renderer_type != RENDERER_DISABLE ) && ( st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) || ( sba_mode_old != st_ivas->sba_mode ) ) { DIRAC_CONFIG_FLAG flag_config; @@ -871,28 +314,6 @@ ivas_error ivas_sba_dec_reconfigure( return error; } } -#else -#ifdef SBA_BR_SWITCHING - if ( ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC ) ) - { - if ( st_ivas->hDirAC != NULL ) - { - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } -#endif -#endif -#ifdef SBA_BR_SWITCHING else if ( st_ivas->renderer_type == RENDERER_DISABLE || ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) ) { if ( st_ivas->hDirAC != NULL ) @@ -912,67 +333,6 @@ ivas_error ivas_sba_dec_reconfigure( mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; } -#else - /*-----------------------------------------------------------------* - * hDirAC decoder handle configuration - *-----------------------------------------------------------------*/ - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) - { - st_ivas->sba_dirac_stereo_flag = ( st_ivas->nchan_transport == 1 && hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ); - - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - int16_t sba_order_internal; - - sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); - ivas_spar_config( hDecoderConfig->ivas_total_brate, sba_order_internal, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, st_ivas->sid_format ); - -#ifdef DFT_STEREO_SPAR_MIXING - st_ivas->sba_dirac_stereo_flag = ( hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ); -#endif - - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && ( last_ivas_total_brate > IVAS_SID_5k2 || st_ivas->nchan_transport != nchan_transport_old ) && ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) - { - if ( st_ivas->hDirAC != NULL ) - { - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_RECONFIGURE ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - if ( ( error = ivas_dirac_dec_config( st_ivas, DIRAC_OPEN ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } - else if ( st_ivas->renderer_type == RENDERER_DISABLE || ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) ) - { - if ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_dec_close( st_ivas->hDirAC ); - st_ivas->hDirAC = NULL; - } - - if ( st_ivas->hVBAPdata != NULL ) - { - vbap_free_data( &( st_ivas->hVBAPdata ) ); - } - } -#endif /*-----------------------------------------------------------------* * Allocate, initalize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c old mode 100755 new mode 100644 index f8f57ae53c5cdbbed24ba5706537028fb4e6b661..ca5b16104453b134244dafc00fadd7c885e1b060 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -91,10 +91,8 @@ static int16_t ivas_sba_dirac_stereo_band_config( int16_t *band_limits, /* o : DFT band limits */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t NFFT /* i : analysis/synthesis window length */ -#ifdef DFT_STEREO_SPAR_MIXING , const int16_t spar_flag /* i : SPAR or DirAC band grouping */ -#endif ) { int16_t i; @@ -103,7 +101,6 @@ static int16_t ivas_sba_dirac_stereo_band_config( nbands = SBA_DIRAC_STEREO_NUM_BANDS; -#ifdef DFT_STEREO_SPAR_MIXING if ( spar_flag ) { nbands = IVAS_MAX_NUM_BANDS; @@ -112,7 +109,6 @@ static int16_t ivas_sba_dirac_stereo_band_config( { nbands = 5; } -#endif num_cldfb_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); @@ -121,7 +117,6 @@ static int16_t ivas_sba_dirac_stereo_band_config( band_limits[0] = 1; for ( i = 1; i < nbands; i++ ) { -#ifdef DFT_STEREO_SPAR_MIXING if ( spar_flag ) { band_limits[i] = DirAC_band_grouping_12[i] * bins_per_cldfb_band; @@ -135,9 +130,6 @@ static int16_t ivas_sba_dirac_stereo_band_config( nbands = i; break; } -#else - band_limits[i] = DirAC_band_grouping_5[i] * bins_per_cldfb_band; -#endif } band_limits[nbands] = NFFT / 2; @@ -191,11 +183,8 @@ static void map_params_dirac_to_stereo( float DFT[STEREO_DFT_BUF_MAX], /* i/o: DFT buffer */ const uint8_t b_wide_panning, /* i : flag indicating wider panning */ const int16_t L_frame /* i : core signal length */ -#ifdef DFT_STEREO_SPAR_MIXING , - const int16_t mcmasa -#endif -) + const int16_t mcmasa ) { int16_t i, b, k; int16_t k_offset; @@ -218,11 +207,7 @@ static void map_params_dirac_to_stereo( IVAS_QDIRECTION *q_direction; nBlocks = MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef DFT_STEREO_SPAR_MIXING nbands = hStereoDft->nbands; -#else - nbands = SBA_DIRAC_STEREO_NUM_BANDS; -#endif k_offset = STEREO_DFT_OFFSET; side_gain = hStereoDft->side_gain + k_offset * STEREO_DFT_BAND_MAX; res_pred_gain = hStereoDft->res_pred_gain + k_offset * STEREO_DFT_BAND_MAX; @@ -274,20 +259,13 @@ static void map_params_dirac_to_stereo( } /* apply upper bounds depending on band */ -#ifdef DFT_STEREO_SPAR_MIXING hStereoDft->smooth_fac[0][b] = max( hStereoDft->min_smooth_gains[b], min( hStereoDft->max_smooth_gains[b], hStereoDft->smooth_fac[0][b] ) ); hStereoDft->smooth_fac[1][b] = max( hStereoDft->min_smooth_gains[b], min( hStereoDft->max_smooth_gains[b], hStereoDft->smooth_fac[1][b] ) ); -#else - hStereoDft->smooth_fac[0][b] = min( max_smooth_gains[b], hStereoDft->smooth_fac[0][b] ); - hStereoDft->smooth_fac[1][b] = min( max_smooth_gains[b], hStereoDft->smooth_fac[1][b] ); -#endif } pDFT += STEREO_DFT32MS_N_MAX; } -#ifdef DFT_STEREO_SPAR_MIXING if ( mcmasa ) -#endif { /* calculate block energies for side gain weighting (combine angles of 2 DirAC blocks to side gain for 1 DFT Stereo subframe; 4 blocks and 2 subframes overall) */ pSynth = synth; @@ -475,16 +453,13 @@ static void ivas_sba_dirac_stereo_upmix_hb( float hb_synth[L_FRAME48k], /* i : HB signal */ float hb_gain[NB_DIV], /* i : side gains for HB signal */ const int16_t output_frame /* i : output frame length per channel */ -#ifdef DFT_STEREO_SPAR_MIXING , const int16_t mcmasa, const STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i : Stereo DFT handle for mixing matrix */ -#endif ) { int16_t i; -#ifdef DFT_STEREO_SPAR_MIXING if ( !mcmasa ) { for ( i = 0; i < output_frame / 2; i++ ) @@ -519,7 +494,6 @@ static void ivas_sba_dirac_stereo_upmix_hb( } } else -#endif { for ( i = 0; i < output_frame / 2; i++ ) { @@ -549,11 +523,8 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ -#ifdef DFT_STEREO_SPAR_MIXING , - const int16_t spar_flag -#endif -) + const int16_t spar_flag ) { int16_t i; int16_t dftOvlLen; @@ -561,18 +532,7 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( float tmp; const float *win_dft; -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - - static FILE *f_stefi = 0; - if ( f_stefi == 0 ) - { - f_stefi = fopen( "stefi.txt", "w" ); - } - -#endif - -#ifdef DFT_STEREO_SPAR_MIXING if ( spar_flag ) { win_dft = hStereoDft->win32ms; @@ -604,9 +564,6 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( output[0][i] += stefi_L; output[1][i] += stefi_R; -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - fprintf( f_stefi, "%f %f\n", stefi_L, stefi_R ); -#endif } for ( i = dftOvlLen; i < output_frame; i++ ) { @@ -616,16 +573,11 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( output[0][i] += stefi_L; output[1][i] += stefi_R; -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - fprintf( f_stefi, "%f %f\n", stefi_L, stefi_R ); -#endif } hStereoDft->g_L_prev = g_L; hStereoDft->g_R_prev = g_R; } - else -#endif - if ( max( hStereoDft->td_gain[0], hStereoDft->td_gain[1] ) > 0 ) + else if ( max( hStereoDft->td_gain[0], hStereoDft->td_gain[1] ) > 0 ) { win_dft = hStereoDft->win32ms; dftOvlLen = hStereoDft->dft32ms_ovl; @@ -638,18 +590,12 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( output[0][i] += tmp; output[1][i] -= tmp; -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - fprintf( f_stefi, "%f %f\n", +tmp, -tmp ); -#endif } for ( i = dftOvlLen; i < output_frame; i++ ) { tmp = hStereoDft->td_gain[0] * 0.5f * hStereoDft->hb_stefi_sig[i]; output[0][i] += tmp; output[1][i] -= tmp; -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - fprintf( f_stefi, "%f %f\n", +tmp, -tmp ); -#endif } } @@ -665,18 +611,14 @@ static void ivas_sba_dirac_stereo_apply_td_stefi( void ivas_sba_dirac_stereo_smooth_parameters( STEREO_DFT_DEC_DATA_HANDLE hStereoDft /* i/o: decoder DFT stereo handle */ -#ifdef DFT_STEREO_SPAR_MIXING , ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ int16_t cross_fade_start_offset, /* i: SPAR mixer delay compensation */ int32_t output_Fs /* i: Fs for delay calculation */ -#endif ) { -#ifdef DFT_STEREO_SPAR_MIXING int16_t i, j, k, i_sf; -#endif int16_t b; int16_t k_offset; @@ -689,9 +631,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( prev_res_pred_gain = hStereoDft->res_pred_gain; res_pred_gain = hStereoDft->res_pred_gain + k_offset * STEREO_DFT_BAND_MAX; -#ifdef DFT_STEREO_SPAR_MIXING if ( !hMdDec ) -#endif { /* Smoothing of side and prediction gains between ftrames */ for ( b = hStereoDft->res_pred_band_min; b < hStereoDft->nbands; b++ ) @@ -711,20 +651,12 @@ void ivas_sba_dirac_stereo_smooth_parameters( } } -#ifdef DFT_STEREO_SPAR_MIXING if ( hMdDec != 0 ) { float xfade_start_ns; int16_t xfade_delay_subframes; int16_t i_hist; -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - static FILE *f_smoothing = 0; - if ( f_smoothing == 0 ) - { - f_smoothing = fopen( "stereo_param_smoothing.txt", "w" ); - } -#endif xfade_start_ns = cross_fade_start_offset / (float) output_Fs * 1000000000.f - IVAS_FB_ENC_DELAY_NS; xfade_delay_subframes = (int16_t) ( xfade_start_ns / ( FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) ); @@ -763,13 +695,6 @@ void ivas_sba_dirac_stereo_smooth_parameters( float beta = hStereoDft->smooth_fac[k][b]; hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] = beta * hStereoDft->mixer_mat_smooth[i][j][b + k * IVAS_MAX_NUM_BANDS] + ( 1 - beta ) * hMdDec->mixer_mat_prev[i_hist][i][j][b]; - -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - if ( i == 0 && j == 0 ) - { - fprintf( f_smoothing, "%d %f\n", b, beta ); - } -#endif } } } @@ -794,39 +719,8 @@ void ivas_sba_dirac_stereo_smooth_parameters( } // k ( DFT block ) hStereoDft->first_frame = 0; -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - { - static FILE *f_mat = 0; - - if ( f_mat == 0 ) - f_mat = fopen( "mixer_mat_stereo_smooth", "w" ); - - for ( i = 0; i < 2; i++ ) - { - for ( j = 0; j < 4; j++ ) - { - for ( b = 0; b < 12; b++ ) - { - fprintf( f_mat, "%f\n", hStereoDft->mixer_mat_smooth[i][j][b] ); - } - } - } - - for ( i = 0; i < 2; i++ ) - { - for ( j = 0; j < 4; j++ ) - { - for ( b = 0; b < 12; b++ ) - { - fprintf( f_mat, "%f\n", hStereoDft->mixer_mat_smooth[i][j][b + IVAS_MAX_NUM_BANDS] ); - } - } - } - } // debug output -#endif } // hMdDec != 0 -#endif return; } @@ -842,11 +736,8 @@ void ivas_sba_dirac_stereo_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float output[CPE_CHANNELS][L_FRAME48k], /* i/o: output synthesis signal */ const int16_t output_frame /* i : output frame length per channel */ -#ifdef DFT_STEREO_SPAR_MIXING , - const int16_t mcmasa -#endif -) + const int16_t mcmasa ) { int16_t dtx_flag, fd_cng_flag; int16_t memOffset; @@ -862,14 +753,12 @@ void ivas_sba_dirac_stereo_dec( hSCE = st_ivas->hSCE[0]; hCPE = st_ivas->hCPE[0]; hStereoDft = hCPE->hStereoDft; -#ifdef DFT_STEREO_SPAR_MIXING if ( st_ivas->nchan_transport > 1 && !mcmasa ) { dtx_flag = 0; fd_cng_flag = 0; } else -#endif { dtx_flag = ( hSCE->hCoreCoder[0]->core_brate <= SID_2k40 ); fd_cng_flag = ( dtx_flag && hSCE->hCoreCoder[0]->cng_type == FD_CNG ); @@ -881,15 +770,10 @@ void ivas_sba_dirac_stereo_dec( hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, - hStereoDft->NFFT -#ifdef DFT_STEREO_SPAR_MIXING - , - ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) -#endif - ); + hStereoDft->NFFT, + ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); stereo_dft_dec_update( hStereoDft, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); -#ifdef DFT_STEREO_SPAR_MIXING if ( st_ivas->nchan_transport > 1 ) { stereo_dft_dec_analyze( hCPE, output[0], DFT, 0, output_frame, output_frame, DFT_STEREO_DEC_ANA_FB, 0, 0 ); @@ -897,7 +781,6 @@ void ivas_sba_dirac_stereo_dec( hStereoDft->core_hist[0] = hCPE->hCoreCoder[0]->core; } else -#endif { /* nrg calculation for TD Stereo Filling, as done in ICBWE which is not used in this case */ ivas_sba_dirac_stereo_compute_td_stefi_nrgs( hStereoDft, hSCE->save_hb_synth, hSCE->hCoreCoder[0]->core, output_frame, fd_cng_flag ); @@ -917,31 +800,21 @@ void ivas_sba_dirac_stereo_dec( tmp_synth, DFT[0], st_ivas->ivas_format == MC_FORMAT, -#ifdef DFT_STEREO_SPAR_MIXING ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame, - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) -#else - hSCE->hCoreCoder[0]->L_frame -#endif - ); + ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ); -#ifdef DFT_STEREO_SPAR_MIXING if ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) { set_f( hStereoDft->res_pred_gain, 1.f, 3 * STEREO_DFT_BAND_MAX ); } -#endif /* DFT Stereo upmix */ stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/ -#ifdef DFT_STEREO_SPAR_MIXING , ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : 0, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, st_ivas->hDecoderConfig->output_Fs, - st_ivas->nchan_transport -#endif - ); + st_ivas->nchan_transport ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); @@ -954,9 +827,7 @@ void ivas_sba_dirac_stereo_dec( v_multc( output[1], 0.5f, output[1], output_frame ); /* delay HB synth */ -#ifdef DFT_STEREO_SPAR_MIXING if ( st_ivas->nchan_transport == 1 ) -#endif { mvr2r( hSCE->save_hb_synth + output_frame - memOffset, tmp_buf, memOffset ); mvr2r( hSCE->save_hb_synth, hSCE->save_hb_synth + memOffset, output_frame - memOffset ); @@ -964,30 +835,19 @@ void ivas_sba_dirac_stereo_dec( mvr2r( tmp_buf, hSCE->prev_hb_synth, memOffset ); } - if ( ( hCPE->hCoreCoder[0]->core == ACELP_CORE || hCPE->hCoreCoder[0]->last_core == ACELP_CORE ) && !fd_cng_flag -#if defined DFT_STEREO_SPAR_MIXING && defined FIX_345_MSAN_ERROR - && st_ivas->nchan_transport == 1 -#endif - ) + if ( ( hCPE->hCoreCoder[0]->core == ACELP_CORE || hCPE->hCoreCoder[0]->last_core == ACELP_CORE ) && !fd_cng_flag && st_ivas->nchan_transport == 1 ) { /* upmix ACELP BWE */ ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain ); -#if defined DFT_STEREO_SPAR_MIXING && !defined FIX_345_MSAN_ERROR - if ( st_ivas->nchan_transport == 1 ) -#endif { ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, - output_frame -#ifdef DFT_STEREO_SPAR_MIXING - , + output_frame, ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), - hStereoDft -#endif - ); + hStereoDft ); } /* add HB to ACELP core */ @@ -995,12 +855,8 @@ void ivas_sba_dirac_stereo_dec( v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); /* apply TD Stereo Filling as is done in ICBWE */ - ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame -#ifdef DFT_STEREO_SPAR_MIXING - , - ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) -#endif - ); + ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, + ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); } return; diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index fb7e74a208c8d317aeb95d1715d3459c610ca490..329391dfcd7022e2cfd8d19b054d0c9f86928c08 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -90,11 +90,7 @@ ivas_error ivas_spar_dec_open( } /* MD handle */ -#ifdef SBA_BR_SWITCHING_RECONFIG if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index cd14d7e132fe92447b0da9d48347f914422e06e6..0cd2d535078a1218fe825e6e4fad3f54dd7642ee 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -253,11 +253,8 @@ ivas_error ivas_spar_md_dec_open( const DECODER_CONFIG_HANDLE hDecoderConfig, /* i : configuration structure */ const int16_t num_channels, /* i : number of internal channels */ const int16_t sba_order /* i : SBA order */ -#ifdef SBA_BR_SWITCHING_RECONFIG , - const int16_t sid_format -#endif -) + const int16_t sid_format ) { ivas_spar_md_dec_state_t *hMdDec; ivas_error error; @@ -275,12 +272,10 @@ ivas_error ivas_spar_md_dec_open( } hMdDec->table_idx = 0; /* just to initialize state variables*/ -#ifdef SBA_BR_SWITCHING_RECONFIG if ( ( hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) && ( sid_format == SID_SBA_2TC ) ) { hMdDec->table_idx = ivas_get_spar_table_idx( IVAS_48k, sba_order, SPAR_CONFIG_BW, NULL, NULL ); } -#endif if ( ( error = ivas_spar_md_dec_init( hMdDec, hDecoderConfig, num_channels, sba_order ) ) != IVAS_ERR_OK ) { return error; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 1ceba1e3fd8025a93e85efb7621bafe55edcc1d9..7c6ac19f7ea56bf0c5e5f52953dbf55faac41c84 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -200,13 +200,11 @@ typedef struct stereo_dft_dec_data_struct float smooth_buf[SBA_DIRAC_STEREO_NUM_BANDS][SBA_DIRAC_NRG_SMOOTH_LONG + 1]; float smooth_fac[NB_DIV][SBA_DIRAC_STEREO_NUM_BANDS]; -#ifdef DFT_STEREO_SPAR_MIXING int16_t first_frame; float mixer_mat_smooth[2][4][2 * IVAS_MAX_NUM_BANDS]; float g_L_prev; float g_R_prev; const float *max_smooth_gains, *min_smooth_gains; -#endif } STEREO_DFT_DEC_DATA, *STEREO_DFT_DEC_DATA_HANDLE; @@ -1235,9 +1233,7 @@ typedef struct Decoder_Struct #ifdef DEBUGGING int32_t noClipping; /* number of clipped samples */ #endif -#ifdef SBA_BR_SWITCHING int32_t last_active_ivas_total_brate; -#endif } Decoder_Struct; /* clang-format on */ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c old mode 100755 new mode 100644 index 3be3c59428fde723477569fd99f1dde3dfcd737d..1a00522a7b93a907814fc647fa53bcdee31c27f3 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -76,12 +76,7 @@ * Local function prototypes *-------------------------------------------------------------------------*/ -static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const int32_t output_Fs -#ifdef DFT_STEREO_SPAR_MIXING - , - const int16_t nchan_transport -#endif -); +static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const int32_t output_Fs, const int16_t nchan_transport ); static void stereo_dft_compute_td_stefi_params( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, const float samp_ratio ); @@ -257,11 +252,8 @@ ivas_error stereo_dft_dec_create( const int32_t element_brate, /* i : element bitrate */ const int32_t output_Fs, /* i : output sampling rate */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ -#ifdef DFT_STEREO_SPAR_MIXING , - const int16_t nchan_transport -#endif -) + const int16_t nchan_transport ) { STEREO_DFT_DEC_DATA_HANDLE hStereoDft_loc; int16_t tmpS; @@ -302,12 +294,8 @@ ivas_error stereo_dft_dec_create( stereo_dft_config( hStereoDft_loc->hConfig, element_brate, &tmpS, &tmpS ); } - stereo_dft_dec_open( hStereoDft_loc, output_Fs -#ifdef DFT_STEREO_SPAR_MIXING - , - nchan_transport -#endif - ); + stereo_dft_dec_open( hStereoDft_loc, output_Fs, + nchan_transport ); *hStereoDft = hStereoDft_loc; @@ -324,11 +312,8 @@ ivas_error stereo_dft_dec_create( static void stereo_dft_dec_open( STEREO_DFT_DEC_DATA_HANDLE hStereoDft, /* i/o: decoder DFT stereo handle */ const int32_t output_Fs /* i : output sampling rate */ -#ifdef DFT_STEREO_SPAR_MIXING , - const int16_t nchan_transport -#endif -) + const int16_t nchan_transport ) { /*Sizes*/ @@ -383,7 +368,6 @@ static void stereo_dft_dec_open( hStereoDft->hb_stefi_delay = NS2SA( output_Fs, STEREO_DFT_TD_STEFI_DELAY_NS ); -#ifdef DFT_STEREO_SPAR_MIXING if ( nchan_transport > 2 ) { hStereoDft->min_smooth_gains = min_smooth_gains2; @@ -394,7 +378,6 @@ static void stereo_dft_dec_open( hStereoDft->min_smooth_gains = min_smooth_gains1; hStereoDft->max_smooth_gains = max_smooth_gains1; } -#endif /* reset DFT stereo memories */ stereo_dft_dec_reset( hStereoDft ); @@ -414,9 +397,7 @@ void stereo_dft_dec_reset( ) { int16_t i; -#ifdef DFT_STEREO_SPAR_MIXING int16_t j, b; -#endif /*Configuration*/ set_s( hStereoDft->prm_res, hStereoDft->hConfig->prm_res, STEREO_DFT_DEC_DFT_NB ); @@ -524,7 +505,6 @@ void stereo_dft_dec_reset( hStereoDft->ipd_xfade_counter = 0; hStereoDft->ipd_xfade_prev = 0.0f; -#ifdef DFT_STEREO_SPAR_MIXING for ( b = 0; b < hStereoDft->nbands; b++ ) { for ( i = 0; i < 2; i++ ) @@ -538,7 +518,6 @@ void stereo_dft_dec_reset( hStereoDft->first_frame = 1; hStereoDft->g_L_prev = 0.f; hStereoDft->g_R_prev = 0.f; -#endif return; @@ -1148,13 +1127,11 @@ void stereo_dft_dec( float *input_mem, /* i/o: mem of buffer DFT analysis */ STEREO_CNG_DEC_HANDLE hStereoCng, /* i/o: Stereo CNG data structure */ const int16_t sba_dirac_stereo_flag /* i : signal stereo output for SBA DirAC */ -#ifdef DFT_STEREO_SPAR_MIXING , ivas_spar_md_dec_state_t *hMdDec, /* i: SPAR MD handle for upmixing */ int16_t cross_fade_start_offset, /* i: SPAR mixer delay compensation */ int32_t output_Fs, /* i: Fs for delay calculation */ int16_t nchan_transport /* i: number of transpor channels */ -#endif ) { int16_t i, k, b, N_div, stop; @@ -1162,9 +1139,7 @@ void stereo_dft_dec( float DFT_R[STEREO_DFT32MS_N_MAX]; float DFT_PRED_RES[STEREO_DFT32MS_N_32k]; float *pDFT_DMX; -#ifdef DFT_STEREO_SPAR_MIXING float *pDFT_DMX1; -#endif float *pDFT_RES; float g, tmp; float *pPredGain; @@ -1188,9 +1163,7 @@ void stereo_dft_dec( HANDLE_FD_CNG_COM hFdCngCom = hFdCngDec->hFdCngCom; int16_t *cna_seed = &( hFdCngCom->seed ); -#ifdef DFT_STEREO_SPAR_MIXING float DFT_W, DFT_Y; -#endif output_frame = (int16_t) ( st0->output_Fs / FRAMES_PER_SEC ); @@ -1233,14 +1206,10 @@ void stereo_dft_dec( /* Smoothing for the current frame */ if ( sba_dirac_stereo_flag ) { - ivas_sba_dirac_stereo_smooth_parameters( hStereoDft -#ifdef DFT_STEREO_SPAR_MIXING - , + ivas_sba_dirac_stereo_smooth_parameters( hStereoDft, hMdDec, cross_fade_start_offset, - output_Fs -#endif - ); + output_Fs ); } else { @@ -1265,13 +1234,11 @@ void stereo_dft_dec( { pDFT_DMX = DFT[0] + k * STEREO_DFT32MS_N_MAX; pDFT_RES = DFT[1] + k * STEREO_DFT32MS_N_MAX; -#ifdef DFT_STEREO_SPAR_MIXING pDFT_DMX1 = 0; if ( nchan_transport > 1 ) { pDFT_DMX1 = DFT[1] + k * STEREO_DFT32MS_N_MAX; } -#endif /*Apply Stereo*/ if ( hStereoDft->hConfig->dmx_active ) @@ -1315,14 +1282,10 @@ void stereo_dft_dec( hStereoDft->past_DMX_pos = ( hStereoDft->past_DMX_pos + STEREO_DFT_PAST_MAX - 1 ) % STEREO_DFT_PAST_MAX; } -#ifdef DFT_STEREO_SPAR_MIXING if ( !( sba_dirac_stereo_flag && nchan_transport >= 2 ) ) { stereo_dft_generate_res_pred( hStereoDft, samp_ratio, pDFT_DMX, DFT_PRED_RES, pPredGain, k, DFT[1] + k * STEREO_DFT32MS_N_MAX, &stop, st0->bfi ); } -#else - stereo_dft_generate_res_pred( hStereoDft, samp_ratio, pDFT_DMX, DFT_PRED_RES, pPredGain, k, DFT[1] + k * STEREO_DFT32MS_N_MAX, &stop, st0->bfi ); -#endif if ( hStereoDft->res_cod_band_max > 0 ) { @@ -1394,11 +1357,7 @@ void stereo_dft_dec( #endif /* No residual coding in inactive frames, instead pDFT_RES is used for the second channel */ -#ifdef DFT_STEREO_SPAR_MIXING if ( b >= hStereoDft->res_cod_band_max && !hStereoDft->frame_sid_nodata && !( sba_dirac_stereo_flag && hMdDec ) ) -#else - if ( b >= hStereoDft->res_cod_band_max && !hStereoDft->frame_sid_nodata ) -#endif { /*filter non-coded frequencies. It removes some MDCT frequency aliasing*/ for ( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) @@ -1448,53 +1407,8 @@ void stereo_dft_dec( } } } -#ifdef DFT_STEREO_SPAR_MIXING else if ( sba_dirac_stereo_flag && hMdDec ) { -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - { - static FILE *f_dmx = 0, *f_res = 0, *f_dmx1 = 0; - - if ( f_dmx == 0 ) - { - f_dmx = fopen( "dft_dmx.txt", "w" ); - f_res = fopen( "dft_pred_res.txt", "w" ); - if ( nchan_transport >= 2 ) - { - f_dmx1 = fopen( "dft_dmx1.txt", "w" ); - } - } - - if ( b == 0 ) - { - i = 0; - fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); - if ( nchan_transport >= 2 ) - { - fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); - } - fprintf( f_res, "%d %f %f\n", i, 0.0f, 0.0f ); - } - for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) - { - fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); - if ( nchan_transport >= 2 ) - { - fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); - } - fprintf( f_res, "%d %f %f\n", i, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i + 1] ); - } - for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) - { - fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); - if ( nchan_transport >= 2 ) - { - fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); - } - fprintf( f_res, "%d %f %f\n", i, 0.0f, 0.0f ); - } - } -#endif if ( nchan_transport == 1 ) { @@ -1580,70 +1494,10 @@ void stereo_dft_dec( { assert( "nhcan_transport must be 1 or 1!" ); } - -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - { - static FILE *f_L = 0, *f_R = 0; - - if ( f_L == 0 ) - { - f_L = fopen( "dft_L.txt", "w" ); - f_R = fopen( "dft_R.txt", "w" ); - } - - if ( b == 0 ) - { - i = 0; - fprintf( f_L, "%d %f %f\n", i, DFT_L[2 * i], DFT_L[2 * i + 1] ); - fprintf( f_R, "%d %f %f\n", i, DFT_L[2 * i], DFT_L[2 * i + 1] ); - } - for ( i = hStereoDft->band_limits[b]; i < hStereoDft->band_limits[b + 1]; i++ ) - { - fprintf( f_L, "%d %f %f\n", i, DFT_L[2 * i], DFT_L[2 * i + 1] ); - fprintf( f_R, "%d %f %f\n", i, DFT_L[2 * i], DFT_L[2 * i + 1] ); - } - } -#endif } -#endif else { -#ifdef DFT_STEREO_SPAR_MIXING_DEBUG - { - static FILE *f_dmx = 0, *f_res = 0, *f_dmx1 = 0; - - if ( f_dmx == 0 ) - { - f_dmx = fopen( "dft_dmx.txt", "w" ); - f_res = fopen( "dft_pred_res.txt", "w" ); - if ( nchan_transport == 2 ) - { - f_dmx1 = fopen( "dft_dmx1.txt", "w" ); - } - } - - if ( b == 0 ) - { - i = 0; - fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); - fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); - fprintf( f_res, "%d %f %f\n", i, 0.0f, 0.0f ); - } - for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) - { - fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); - fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); - fprintf( f_res, "%d %f %f\n", i, DFT_PRED_RES[2 * i], DFT_PRED_RES[2 * i + 1] ); - } - for ( ; i < hStereoDft->band_limits[b + 1]; i++ ) - { - fprintf( f_dmx, "%d %f %f\n", i, pDFT_DMX[2 * i], pDFT_DMX[2 * i + 1] ); - fprintf( f_dmx1, "%d %f %f\n", i, pDFT_DMX1[2 * i], pDFT_DMX1[2 * i + 1] ); - fprintf( f_res, "%d %f %f\n", i, 0.0f, 0.0f ); - } - } -#endif for ( i = hStereoDft->band_limits[b]; i < min( stop, hStereoDft->band_limits[b + 1] ); i++ ) { diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index c8b373ce5c1429c5f9be8611a6c221b774a6b732..2e98d358f8d7fd98629285c78947f27a2870353f 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -421,12 +421,8 @@ ivas_error stereo_memory_dec( deallocate_CoreCoder( hCPE->hCoreCoder[1] ); /* allocate DFT stereo data structure */ - if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0 -#ifdef DFT_STEREO_SPAR_MIXING - , - nchan_transport -#endif - ) ) != IVAS_ERR_OK ) + if ( ( error = stereo_dft_dec_create( &( hCPE->hStereoDft ), hCPE->element_brate, output_Fs, 0, + nchan_transport ) ) != IVAS_ERR_OK ) { return error; } @@ -1120,14 +1116,10 @@ void synchro_synthesis( delay_signal( output[0], output_frame, hCPE->hCoreCoder[0]->hTcxDec->FBTCXdelayBuf, delay_diff ); } -#ifdef DFT_STEREO_SPAR_MIXING if ( hCPE->element_mode != IVAS_CPE_MDCT ) { ivas_post_proc( NULL, hCPE, 0, output[0], output, output_frame, sba_dirac_stereo_flag ); } -#else - ivas_post_proc( NULL, hCPE, 0, output[0], output, output_frame, sba_dirac_stereo_flag ); -#endif /* zero padding in order to synchronize the upmixed DFT stereo synthesis with the TD/MDCT stereo synthesis */ for ( n = 0; n < hCPE->nchan_out; n++ ) @@ -1194,10 +1186,8 @@ void synchro_synthesis( /*----------------------------------------------------------------* * TD/MDCT stereo synchro *----------------------------------------------------------------*/ -#ifdef DFT_STEREO_SPAR_MIXING if ( sba_dirac_stereo_flag ) return; -#endif if ( hCPE->element_mode == IVAS_CPE_TD || hCPE->element_mode == IVAS_CPE_MDCT ) { /* handling of DFT->TD switching */ diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index b3b0e1787a13988d74f66c0d4d24bd224b7f3fb8..8339b03399153d04975eaa281f190f842c3ed16e 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -315,11 +315,7 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_brate != hCPE->last_element_brate && st_ivas->hMCT == NULL ) { #ifdef DEBUGGING -#ifndef FIX_334_DEBUG_BE_STEREO_SWITCHING - hCPE->hStereoMdct->mdct_stereo_mode_cmdl = hEncoderConfig->stereo_mode_cmdl; -#else hCPE->hStereoMdct->mdct_stereo_mode_cmdl = hEncoderConfig->mdct_stereo_mode_cmdl; -#endif #endif initMdctStereoEncData( hCPE->hStereoMdct, ivas_format, hCPE->element_mode, hCPE->element_brate, max_bwidth, 0, NULL, 0 ); hCPE->hStereoMdct->isSBAStereoMode = ( ( ivas_format == SBA_FORMAT ) && ( st_ivas->nchan_transport == 2 ) ); @@ -458,9 +454,7 @@ ivas_error ivas_cpe_enc( if ( sts[0]->core_brate == SID_2k40 || sts[0]->core_brate == FRAME_NO_DATA ) { sts[0]->core_brate = -1; -#ifdef SBA_BR_SWITCHING_RECONFIG sts[0]->total_brate = hCPE->element_brate; -#endif } } diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 7d783bbf77389f13d75fc97377d8c2b5d85fa09c..89887fed8dbb5dbebbf1ab342eb1de9486a82653 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -65,9 +65,6 @@ ivas_error ivas_enc( float data_f[MAX_INPUT_CHANNELS][L_FRAME48k]; /* IVAS_fmToDo: buffer can be allocated dynamically based on the number of analysed channels */ int32_t ivas_total_brate; ivas_error error; -#ifndef SBA_BR_SWITCHING - int16_t sba_reinit_flag; -#endif error = IVAS_ERR_OK; push_wmops( "ivas_enc" ); @@ -87,24 +84,6 @@ ivas_error ivas_enc( n_samples_chan = n_samples / nchan_inp; set_s( nb_bits_metadata, 0, MAX_SCE ); -#ifndef SBA_BR_SWITCHING - sba_reinit_flag = 0; -#endif -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING - if ( ivas_format == SBA_FORMAT ) - { - st_ivas->sba_reinit_flag = get_sba_reinit_flag( ivas_total_brate, st_ivas->hEncoderConfig->last_ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); - if ( st_ivas->sba_reinit_flag ) - { - if ( ( error = ivas_sba_enc_reinit( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - } -#endif -#endif /*----------------------------------------------------------------* * convert 'short' input data to 'float' *----------------------------------------------------------------*/ @@ -215,13 +194,6 @@ ivas_error ivas_enc( /* SBA/MASA configuration */ if ( ivas_format == SBA_FORMAT ) { -#ifndef SBA_BR_SWITCHING - if ( ( st_ivas->sba_mode == SBA_MODE_DIRAC ) && ( !sba_reinit_flag ) ) -#else -#ifndef SBA_BR_SWITCHING_RECONFIG - if ( !st_ivas->sba_reinit_flag ) -#endif -#endif { if ( ( error = ivas_sba_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 8995ebe92a4c5e93fb74909461bb122d2f9ca338..78935211d7c2a59ff85bf7cf1a93a6fc2cb36ee6 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -351,11 +351,6 @@ ivas_error ivas_init_encoder( st_ivas->sba_mode = SBA_MODE_NONE; st_ivas->nchan_transport = -1; -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING - st_ivas->sba_reinit_flag = 0; -#endif -#endif /*-----------------------------------------------------------------* * Allocate and initialize SCE/CPE and other handles *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index 4786210dd7f147bc8c8ce7dac03767aa3b2776ab..e048103088375d14b63900f4df3bc8eb1bfa3320 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -92,228 +92,6 @@ void ivas_sba_getTCs( return; } -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING -/*-------------------------------------------------------------------* - * ivas_sba_enc_reinit() - * - * Reinitialise IVAS SBA encoder - *-------------------------------------------------------------------*/ - -ivas_error ivas_sba_enc_reinit( - Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ -) -{ - int16_t nSCE_old; - int16_t nCPE_old; - int16_t sce_id; - int16_t cpe_id; - int16_t n; - Indice *ind_list_metadata; - int32_t ivas_total_brate; - int16_t i, nchan_inp; - ivas_error error; - ENCODER_CONFIG_HANDLE hEncoderConfig; - - Indice *ind_list; - BSTR_ENC_HANDLE hBstr; - BSTR_ENC_HANDLE hMetaData; - hEncoderConfig = st_ivas->hEncoderConfig; - ivas_total_brate = hEncoderConfig->ivas_total_brate; - error = IVAS_ERR_OK; - nchan_inp = st_ivas->hEncoderConfig->nchan_inp; - ivas_total_brate = st_ivas->hEncoderConfig->ivas_total_brate; - - nCPE_old = st_ivas->nCPE; - nSCE_old = st_ivas->nSCE; - ind_list_metadata = NULL; - - - ind_list = NULL; - hBstr = NULL; - hMetaData = NULL; - - /* get the index list pointers */ - if ( nSCE_old ) - { - hBstr = st_ivas->hSCE[0]->hCoreCoder[0]->hBstr; - hMetaData = st_ivas->hSCE[0]->hMetaData; - } - else if ( nCPE_old ) - { - hBstr = st_ivas->hCPE[0]->hCoreCoder[0]->hBstr; - hMetaData = st_ivas->hCPE[nCPE_old - 1]->hMetaData; - } - - /* save bitstream information */ - ind_list = hBstr->ind_list; - ind_list_metadata = hMetaData->ind_list; - - /*------------------------------------------------------------------------------------------* - * Closing Encoder handles before Reinitialisation - *------------------------------------------------------------------------------------------*/ - - /* Q Metadata handle */ - ivas_qmetadata_close( &( st_ivas->hQMetaData ) ); - /* DirAC handle */ - if ( st_ivas->hDirAC != NULL ) - { - ivas_dirac_enc_close( st_ivas->hDirAC, st_ivas->hEncoderConfig->input_Fs ); - - st_ivas->hDirAC = NULL; - } - - /* SPAR handle */ - if ( st_ivas->hSpar != NULL ) - { - ivas_spar_enc_close( st_ivas->hSpar, st_ivas->hEncoderConfig->input_Fs, nchan_inp ); - st_ivas->hSpar = NULL; - } - /* SCE handles */ - for ( i = 0; i < MAX_SCE; i++ ) - { - if ( st_ivas->hSCE[i] != NULL ) - { - destroy_sce_enc( st_ivas->hSCE[i] ); - st_ivas->hSCE[i] = NULL; - } - } - - /* CPE handles */ - for ( i = 0; i < MAX_CPE; i++ ) - { - if ( st_ivas->hCPE[i] != NULL ) - { - destroy_cpe_enc( st_ivas->hCPE[i] ); - st_ivas->hCPE[i] = NULL; - } - } - /* MCT handle */ - if ( st_ivas->hMCT != NULL ) - { - ivas_mct_enc_close( st_ivas->hMCT ); - st_ivas->hMCT = NULL; - } - if ( st_ivas->mem_hp20_in != NULL ) - { - n = getNumChanAnalysis( st_ivas ); - - for ( i = 0; i < n; i++ ) - { - free( st_ivas->mem_hp20_in[i] ); - st_ivas->mem_hp20_in[i] = NULL; - } - free( st_ivas->mem_hp20_in ); - st_ivas->mem_hp20_in = NULL; - } - - /*------------------------------------------------------------------------------------------* - * Reopening Encoder handles for Reinitialisation - *------------------------------------------------------------------------------------------*/ - - if ( ( error = ivas_qmetadata_open( &( st_ivas->hQMetaData ) ) ) != IVAS_ERR_OK ) - { - return error; - } - - st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); - st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); - - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - if ( ( error = ivas_spar_enc_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( ( error = ivas_dirac_enc_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - - - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - if ( ( error = create_sce_enc( st_ivas, sce_id, ivas_total_brate / st_ivas->nchan_transport ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* prepare bitstream buffers */ - st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr->ind_list = ind_list + sce_id * MAX_NUM_INDICES; - reset_indices_enc( st_ivas->hSCE[sce_id]->hCoreCoder[0]->hBstr, MAX_NUM_INDICES ); - - st_ivas->hSCE[sce_id]->hMetaData->ind_list = ind_list_metadata + sce_id * MAX_BITS_METADATA; - reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); - - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->hEncoderConfig->Opt_DTX_ON ) - { - st_ivas->hSCE[sce_id]->hCoreCoder[0]->dtx_sce_sba = 1; - } - } - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - if ( ( error = create_cpe_enc( st_ivas, cpe_id, ( ivas_total_brate / st_ivas->nchan_transport ) * CPE_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - - /* prepare bitstream buffers */ - for ( n = 0; n < CPE_CHANNELS; n++ ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr->ind_list = ind_list + ( cpe_id * CPE_CHANNELS + n ) * MAX_NUM_INDICES; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hCoreCoder[n]->hBstr, MAX_NUM_INDICES ); - - if ( hEncoderConfig->Opt_DTX_ON ) - { - st_ivas->hCPE[cpe_id]->hCoreCoder[n]->cng_sba_flag = 1; - } - } - - /* Metadata only initialized for the last CPE index */ - if ( cpe_id == st_ivas->nCPE - 1 ) - { - st_ivas->hCPE[cpe_id]->hMetaData->ind_list = ind_list_metadata + sce_id * MAX_BITS_METADATA; - reset_indices_enc( st_ivas->hCPE[cpe_id]->hMetaData, MAX_BITS_METADATA ); - } - } - - if ( st_ivas->nCPE > 1 ) - { - if ( ( error = create_mct_enc( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - } - n = getNumChanAnalysis( st_ivas ); - - if ( n > 0 ) - { - if ( ( st_ivas->mem_hp20_in = (float **) malloc( n * sizeof( float * ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - } - else - { - st_ivas->mem_hp20_in = NULL; - } - - for ( i = 0; i < n; i++ ) - { - if ( ( st_ivas->mem_hp20_in[i] = (float *) malloc( L_HP20_MEM * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); - } - - set_f( st_ivas->mem_hp20_in[i], 0.0f, L_HP20_MEM ); - } - return error; -} -#endif -#endif /*-------------------------------------------------------------------* * ivas_sba_enc_reconfigure() @@ -337,23 +115,18 @@ ivas_error ivas_sba_enc_reconfigure( if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) { -#ifdef SBA_BR_SWITCHING DIRAC_ENC_HANDLE hDirAC = st_ivas->hDirAC; SPAR_ENC_HANDLE hSpar; SBA_MODE sba_mode_old; -#endif #ifdef SBA_HPF_TUNING_ENC int16_t analysis_order_old; #endif nchan_transport_old = st_ivas->nchan_transport; nCPE_old = st_ivas->nCPE; nSCE_old = st_ivas->nSCE; -#ifdef SBA_BR_SWITCHING_RECONFIG sba_mode_old = st_ivas->sba_mode; -#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); -#ifdef SBA_BR_SWITCHING st_ivas->sba_mode = ivas_sba_mode_select( ivas_total_brate ); #ifdef SBA_HPF_TUNING_ENC analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); @@ -453,8 +226,6 @@ ivas_error ivas_sba_enc_reconfigure( hEncoderConfig->element_mode_init = IVAS_CPE_MDCT; } -#endif -#ifdef SBA_BR_SWITCHING_RECONFIG /*TODO : Verify if full SPAR close and open can be used instead of submodules close and open */ if ( ( sba_mode_old != st_ivas->sba_mode ) || ( nchan_transport_old != st_ivas->nchan_transport ) ) { @@ -570,16 +341,13 @@ ivas_error ivas_sba_enc_reconfigure( } } -#endif ivas_dirac_enc_reconfigure( st_ivas ); -#ifdef SBA_BR_SWITCHING if ( st_ivas->sba_mode == SBA_MODE_SPAR ) { mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; } -#endif /*-----------------------------------------------------------------* * Allocate, initalize, and configure SCE/CPE/MCT handles *-----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index ca307b02471edb96a86b5ca6b1555d594009984a..b13ad3077fba06be831f597cc667c316c10211c6 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -296,7 +296,6 @@ ivas_error ivas_spar_enc( error = IVAS_ERR_OK; hEncoderConfig = st_ivas->hEncoderConfig; -#ifdef SBA_BR_SWITCHING_RECONFIG // VE2DB: can hFbMixer->ppFilterbank_prior_input be replaced by st->input ? /* check last sba_mode */ @@ -327,7 +326,6 @@ ivas_error ivas_spar_enc( ( st_ivas->hSpar->hFbMixer->ppFilterbank_prior_input[i] + st_ivas->hSpar->hFbMixer->fb_cfg->prior_input_length - input_frame ), input_frame ); } } -#endif /* front VAD */ if ( ( error = front_vad_spar( st_ivas->hSpar, data_f[0], hEncoderConfig, input_frame ) ) != IVAS_ERR_OK ) @@ -572,22 +570,6 @@ static ivas_error ivas_spar_enc_process( hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; } } -#ifndef SBA_BR_SWITCHING - /*-----------------------------------------------------------------------------------------* - * Covariance process - *-----------------------------------------------------------------------------------------*/ - - for ( i = 0; i < nchan_inp; i++ ) - { - for ( j = 0; j < nchan_inp; j++ ) - { - cov_real[i][j] = hSpar->hMdEnc->cov_real[i][j]; - cov_dtx_real[i][j] = hSpar->hMdEnc->cov_dtx_real[i][j]; - } - } - - ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det ); -#endif /*-----------------------------------------------------------------------------------------* * Set SPAR bitrates *-----------------------------------------------------------------------------------------*/ @@ -597,12 +579,7 @@ static ivas_error ivas_spar_enc_process( if ( hSpar->hMdEnc->table_idx != table_idx ) { hSpar->hMdEnc->table_idx = table_idx; -#ifdef SBA_BR_SWITCHING -#ifndef SBA_BR_SWITCHING_RECONFIG - if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate && !st_ivas->sba_reinit_flag ) -#else if ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) -#endif { if ( ( error = ivas_spar_md_enc_init( hSpar->hMdEnc, hEncoderConfig, sba_order ) ) != IVAS_ERR_OK ) { @@ -611,13 +588,9 @@ static ivas_error ivas_spar_enc_process( } else { -#endif ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND ); -#ifdef SBA_BR_SWITCHING } -#endif } -#ifdef SBA_BR_SWITCHING /*-----------------------------------------------------------------------------------------* * Covariance process *-----------------------------------------------------------------------------------------*/ @@ -632,7 +605,6 @@ static ivas_error ivas_spar_enc_process( } ivas_enc_cov_handler_process( hSpar->hCovEnc, ppIn_FR_real, ppIn_FR_imag, cov_real, cov_dtx_real, hSpar->hFbMixer->pFb, 0, hSpar->hFbMixer->pFb->filterbank_num_bands, nchan_inp, dtx_vad, transient_det ); -#endif nchan_transport = st_ivas->nchan_transport; /*-----------------------------------------------------------------------------------------* diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 20a3e4322b29f44fb394fbbe4076c311dbe0f9af..bcc6718e9a60c513ead6780ac75f79bba2781c52 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -83,9 +83,6 @@ static void ivas_select_next_strat( ivas_strats_t prior_strat, ivas_strats_t cs[ static void ivas_store_prior_coeffs( ivas_spar_md_enc_state_t *hMdEnc, const int16_t num_bands, const int16_t bands_bw, const int16_t strat, const int16_t dtx_vad, const int16_t qsi ); static void ivas_write_spar_md_bitstream( ivas_spar_md_enc_state_t *hMdEnc, const int16_t nB, const int16_t bands_bw, BSTR_ENC_HANDLE hMetaData, const int32_t ivas_total_brate, const int16_t strat, const int16_t qsi, const int16_t planarCP ); -#ifndef SBA_BR_SWITCHING -static ivas_error ivas_spar_md_enc_init( ivas_spar_md_enc_state_t *hMdEnc, const ENCODER_CONFIG_HANDLE hEncoderConfig, const int16_t sba_order ); -#endif static void ivas_spar_quant_pred_coeffs_dtx( ivas_spar_md_t *pSpar_md, const float *pValues, const int16_t ndm, int16_t *pIndex, const int16_t dim1, float *pQuant ); static void ivas_quant_p_per_band_dtx( float *pP_mat, const int16_t num_dec, const int16_t num_dmx, int16_t *ppIdx_pd, float *pP_out, const int16_t num_ch ); @@ -306,16 +303,11 @@ void ivas_spar_md_enc_close( * * SPAR MD encoder initialization *-----------------------------------------------------------------------------------------*/ -#ifndef SBA_BR_SWITCHING -static ivas_error ivas_spar_md_enc_init -#else -ivas_error ivas_spar_md_enc_init -#endif - ( - ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ - const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ - const int16_t sba_order /* i : Ambisonic (SBA) order */ - ) +ivas_error ivas_spar_md_enc_init( + ivas_spar_md_enc_state_t *hMdEnc, /* o : MD encoder handle */ + const ENCODER_CONFIG_HANDLE hEncoderConfig, /* i : configuration structure */ + const int16_t sba_order /* i : Ambisonic (SBA) order */ +) { float pFC[IVAS_MAX_NUM_BANDS]; int16_t table_idx; diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index 8a96430129d3362a2317f416f6d27c3a193592e8..5792800c179084d8420bccfaeda232afc5a79660 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -1059,11 +1059,6 @@ typedef struct int16_t sba_analysis_order; /* Ambisonic (SBA) order used for analysis and coding */ int16_t codec_mode; /* Mode1 or Mode2 of core codec */ int16_t last_codec_mode; /* previous frame Mode 1 or 2 */ -#ifndef SBA_BR_SWITCHING_RECONFIG -#ifdef SBA_BR_SWITCHING - int16_t sba_reinit_flag; /*flag indicating whether reinitialisation or reconfiguration function should be used*/ -#endif -#endif float **mem_hp20_in; /* input signals HP filter memories */ /* core-encoder modules */ diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index cb37248576de0a8e3a5135bc402842eb5e545089..00a8d4a135a9529288207b55f20c1a9d240b8d77 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -866,15 +866,6 @@ ivas_error ivas_crend_init_from_setofhrtf( #endif -#ifndef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE -/*---------------------------------------------------------------------* - * destroy_HRTF() - * - * Destroy the HRTF CRend handle - *---------------------------------------------------------------------*/ - - -#endif #ifndef FIX_197_CREND_INTERFACE /*------------------------------------------------------------------------- * ivas_crend_open() diff --git a/lib_rend/ivas_hrtf.c b/lib_rend/ivas_hrtf.c index 063893e13206b3c9749bd6d7764dbc9af7464852..b53c636932f3dd77bb56142ba4387adce85caba2 100644 --- a/lib_rend/ivas_hrtf.c +++ b/lib_rend/ivas_hrtf.c @@ -116,9 +116,6 @@ void ivas_HRTF_CRend_binary_close( return; } -#ifndef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE - destroy_SetOfHRTF( *hSetOfHRTF ); -#endif free( *hSetOfHRTF ); *hSetOfHRTF = NULL; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 294c23c77f9d4d0a51fa85fb47f8f8d9f97d26e3..b60967e7f7bd9085c7b7097cb68a4d53a72571e7 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -48,7 +48,6 @@ static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd ); -#ifdef FIX_198_TDREND_INTERFACE /*---------------------------------------------------------------------* * ivas_td_binaural_open_unwrap() * @@ -65,23 +64,8 @@ ivas_error ivas_td_binaural_open_unwrap( BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ int32_t *binaural_latency_ns /* i : Binauralization delay */ ) -#else -/*---------------------------------------------------------------------* - * ivas_td_binaural_open() - * - * Open and initialize TD Object binaural renderer - *---------------------------------------------------------------------*/ - -static ivas_error ivas_td_binaural_open( - Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -) -#endif { -#ifdef FIX_198_TDREND_INTERFACE BINAURAL_TD_OBJECT_RENDERER_HANDLE pBinRendTd; -#else - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; -#endif TDREND_PosType_t PosType; int16_t nS; int16_t SrcInd[MAX_NUM_TDREND_CHANNELS]; @@ -94,105 +78,55 @@ static ivas_error ivas_td_binaural_open( error = IVAS_ERR_OK; -#ifdef FIX_198_TDREND_INTERFACE if ( ( pBinRendTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) -#else - if ( ( hBinRendererTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } -#ifdef FIX_198_TDREND_INTERFACE if ( ( pBinRendTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) -#else - if ( ( hBinRendererTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } -#ifdef FIX_198_TDREND_INTERFACE if ( ( pBinRendTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) -#else - if ( ( hBinRendererTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } -#ifdef FIX_198_TDREND_INTERFACE if ( ( pBinRendTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) -#else - if ( ( hBinRendererTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); } -#ifdef FIX_198_TDREND_INTERFACE pBinRendTd->NumOfSrcs = 0; pBinRendTd->MaxSrcInd = -1; /* Mixer spatial setup */ pBinRendTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; pBinRendTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ -#else - hBinRendererTd->NumOfSrcs = 0; - hBinRendererTd->MaxSrcInd = -1; - - /* Mixer spatial setup */ - hBinRendererTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; - hBinRendererTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ -#endif -#ifdef FIX_198_TDREND_INTERFACE TDREND_MIX_Init( pBinRendTd, hHrtfTD, pBinRendTd->TdRend_MixSpatSpec_p, output_Fs ); -#else - TDREND_MIX_Init( hBinRendererTd, &st_ivas->hHrtfTD, hBinRendererTd->TdRend_MixSpatSpec_p, st_ivas->hDecoderConfig->output_Fs ); -#endif /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ -#ifdef FIX_198_TDREND_INTERFACE TDREND_MIX_SetDistAttenModel( pBinRendTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); -#else - TDREND_MIX_SetDistAttenModel( hBinRendererTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); -#endif /* Add sources to module and mixer, headphones */ PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ -#ifdef FIX_198_TDREND_INTERFACE nchan_rend = nchan_transport; if ( ( ivas_format == MC_FORMAT ) && ( transport_config != AUDIO_CONFIG_LS_CUSTOM ) ) -#else - nchan_rend = st_ivas->nchan_transport; - if ( st_ivas->ivas_format == MC_FORMAT ) -#endif { nchan_rend--; /* Skip LFE channel -- added to the others */ } for ( nS = 0; nS < nchan_rend; nS++ ) { -#ifdef FIX_198_TDREND_INTERFACE if ( ( error = TDREND_MIX_AddSrc( pBinRendTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) -#else - if ( ( error = TDREND_MIX_AddSrc( hBinRendererTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) -#endif { return error; } } -#ifdef FIX_198_TDREND_INTERFACE if ( ivas_format == MC_FORMAT ) -#else - if ( st_ivas->ivas_format == MC_FORMAT ) -#endif { -#ifdef FIX_198_TDREND_INTERFACE switch ( transport_config ) -#else - switch ( st_ivas->transport_config ) -#endif { case AUDIO_CONFIG_5_1: ls_azimuth = ls_azimuth_CICP6; @@ -215,24 +149,15 @@ static ivas_error ivas_td_binaural_open( ls_elevation = ls_elevation_CICP19; break; case AUDIO_CONFIG_LS_CUSTOM: -#ifdef FIX_198_TDREND_INTERFACE ls_azimuth = hTransSetup.ls_azimuth; ls_elevation = hTransSetup.ls_elevation; -#else - ls_azimuth = st_ivas->hTransSetup.ls_azimuth; - ls_elevation = st_ivas->hTransSetup.ls_elevation; -#endif break; default: ls_azimuth = NULL; ls_elevation = NULL; } -#ifdef FIX_198_TDREND_INTERFACE DirAtten_p = pBinRendTd->DirAtten_p; -#else - DirAtten_p = hBinRendererTd->DirAtten_p; -#endif for ( nS = 0; nS < nchan_rend; nS++ ) { @@ -249,27 +174,15 @@ static ivas_error ivas_td_binaural_open( DirAtten_p->ConeOuterAngle = 360.0f; DirAtten_p->ConeOuterGain = 1.0f; -#ifdef FIX_198_TDREND_INTERFACE TDREND_MIX_SRC_SetPos( pBinRendTd, nS, Pos ); TDREND_MIX_SRC_SetDir( pBinRendTd, nS, Dir ); TDREND_MIX_SRC_SetPlayState( pBinRendTd, nS, TDREND_PLAYSTATUS_PLAYING ); TDREND_MIX_SRC_SetDirAtten( pBinRendTd, nS, DirAtten_p ); -#else - TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); - TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); -#endif } } -#ifdef FIX_198_TDREND_INTERFACE *hBinRendererTd = pBinRendTd; *binaural_latency_ns = (int32_t) ( ( *hBinRendererTd )->HrFiltSet_p->latency_s * 1000000000.f ); -#else - st_ivas->hBinRendererTd = hBinRendererTd; - st_ivas->binaural_latency_ns = (int32_t) ( hBinRendererTd->HrFiltSet_p->latency_s * 1000000000.f ); -#endif return error; } @@ -301,7 +214,6 @@ void ivas_td_binaural_close( return; } -#ifdef FIX_198_TDREND_INTERFACE /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_unwrap() * @@ -328,41 +240,18 @@ void ivas_td_binaural_renderer_unwrap( float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ) -#else -/*---------------------------------------------------------------------* - * ivas_td_binaural_renderer() - * - * Receives the current frames for the object streams, updates metadata - * and renders the current frame. - *---------------------------------------------------------------------*/ - -static void ivas_td_binaural_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ - const int16_t output_frame /* i : output frame length */ -) -#endif { int16_t subframe_length; int16_t subframe_idx; float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef FIX_198_TDREND_INTERFACE if ( hRenderConfig != NULL ) -#else - if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ -#endif { -#ifdef FIX_198_TDREND_INTERFACE if ( hRenderConfig->roomAcoustics.late_reverb_on && ( ini_frame == 0 ) ) -#else - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) -#endif { ivas_reverb_open( -#ifdef FIX_198_TDREND_INTERFACE #ifdef FIX_197_CREND_INTERFACE &hCrendWrapper->hCrend->hReverb, #else @@ -371,83 +260,39 @@ static void ivas_td_binaural_renderer( transport_config, NULL, hRenderConfig, - output_Fs -#else -#ifdef FIX_197_CREND_INTERFACE - &st_ivas->hCrendWrapper->hCrend->hReverb, -#else - &st_ivas->hCrend->hReverb, -#endif - st_ivas->transport_config, - NULL, - st_ivas->hRenderConfig, - st_ivas->hDecoderConfig->output_Fs -#endif - ); + output_Fs ); } } /* Update object position(s) */ -#ifdef FIX_198_TDREND_INTERFACE TDREND_Update_object_positions( hBinRendererTd, nchan_transport, lfe_idx, ivas_format, hIsmMetaData, output ); -#else - TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, output ); -#endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { /* Update the listener's location/orientation */ -#ifdef FIX_198_TDREND_INTERFACE TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL ); -#else - TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, - st_ivas->hDecoderConfig->Opt_Headrotation, - ( st_ivas->hHeadTrackData != NULL ) ? &st_ivas->hHeadTrackData->Quaternions[subframe_idx] : NULL ); -#endif -#ifdef FIX_198_TDREND_INTERFACE if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) -#else - if ( ( st_ivas->hRenderConfig != NULL ) && ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) ) -#endif { ivas_reverb_process( -#ifdef FIX_198_TDREND_INTERFACE #ifdef FIX_197_CREND_INTERFACE hCrendWrapper->hCrend->hReverb, #else hCrend->hReverb, #endif transport_config, -#else -#ifdef FIX_197_CREND_INTERFACE - st_ivas->hCrendWrapper->hCrend->hReverb, -#else - st_ivas->hCrend->hReverb, -#endif - st_ivas->transport_config, -#endif 0, output, reverb_signal, subframe_idx ); ivas_reverb_process( -#ifdef FIX_198_TDREND_INTERFACE #ifdef FIX_197_CREND_INTERFACE hCrendWrapper->hCrend->hReverb, #else hCrend->hReverb, #endif transport_config, -#else -#ifdef FIX_197_CREND_INTERFACE - st_ivas->hCrendWrapper->hCrend->hReverb, -#else - st_ivas->hCrend->hReverb, -#endif - st_ivas->transport_config, -#endif 0, output, reverb_signal, @@ -455,24 +300,12 @@ static void ivas_td_binaural_renderer( } /* Render subframe */ -#ifdef FIX_198_TDREND_INTERFACE TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ); -#else - TDREND_GetMix( st_ivas->hBinRendererTd, output, subframe_length, subframe_idx ); -#endif } -#ifdef FIX_198_TDREND_INTERFACE if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ -#else - if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ -#endif { -#ifdef FIX_198_TDREND_INTERFACE if ( hRenderConfig->roomAcoustics.late_reverb_on ) -#else - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) -#endif { /* add reverb to rendered signals */ v_add( reverb_signal[0], output[0], output[0], output_frame ); @@ -704,31 +537,11 @@ ivas_error ivas_td_binaural_open_ext( LSSETUP_CUSTOM_STRUCT *customLsInput, const int32_t outFs ) { -#ifndef FIX_198_TDREND_INTERFACE - /* TODO tmu : Based on ivas_td_binaural_open() - could be harmonized / refactored - - review error handling - - review hHrtfTD init - */ - BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd; - TDREND_PosType_t PosType; - int16_t nS; - int16_t SrcInd[MAX_NUM_TDREND_CHANNELS]; - const float *ls_azimuth, *ls_elevation; - float Pos[3]; - float Dir[3]; - TDREND_DirAtten_t *DirAtten_p; -#endif -#ifdef FIX_198_TDREND_INTERFACE int16_t nchan_transport; AUDIO_CONFIG transport_config; IVAS_FORMAT ivas_format; IVAS_OUTPUT_SETUP hTransSetup; -#else - int16_t nchan_rend; - ivas_error error; -#endif -#ifdef FIX_198_TDREND_INTERFACE if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) { getAudioConfigNumChannels( inConfig, &nchan_transport ); @@ -747,126 +560,6 @@ ivas_error ivas_td_binaural_open_ext( hTransSetup.ls_elevation = customLsInput->ls_elevation; return ivas_td_binaural_open_unwrap( &pTDRend->hHrtfTD, outFs, nchan_transport, ivas_format, transport_config, hTransSetup, &pTDRend->hBinRendererTd, &pTDRend->binaural_latency_ns ); -#else - - error = IVAS_ERR_OK; - - if ( ( hBinRendererTd = malloc( sizeof( BINAURAL_TD_OBJECT_RENDERER ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->TdRend_MixSpatSpec_p = malloc( sizeof( TDREND_MixSpatSpec_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->DirAtten_p = malloc( sizeof( TDREND_DirAtten_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - if ( ( hBinRendererTd->Listener_p = malloc( sizeof( TDREND_MIX_Listener_t ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for TD renderer\n" ) ); - } - - if ( inConfig != IVAS_REND_AUDIO_CONFIG_LS_CUSTOM ) - { - getAudioConfigNumChannels( inConfig, &nchan_rend ); - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - nchan_rend--; /* Skip LFE channel -- added to the others */ - } - } - else - { - nchan_rend = customLsInput->num_spk; - } - - hBinRendererTd->NumOfSrcs = 0; - hBinRendererTd->MaxSrcInd = -1; - - /* Mixer spatial setup */ - hBinRendererTd->TdRend_MixSpatSpec_p->UseCommonDistAttenModel = TRUE; - hBinRendererTd->TdRend_MixSpatSpec_p->DistAttenModel = 0; /* 0=Turned off, else use TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED */ - - TDREND_MIX_Init( hBinRendererTd, &pTDRend->hHrtfTD, hBinRendererTd->TdRend_MixSpatSpec_p, outFs ); - - /* Set the attenuation (or can set MixSpatSpec.DistAttenModel above) */ - TDREND_MIX_SetDistAttenModel( hBinRendererTd, TDREND_DIST_ATTEN_MODEL_INV_DIST_CLAMPED ); - - /* Add sources to module and mixer, headphones */ - PosType = TDREND_POSTYPE_ABSOLUTE; /* or TDREND_POSTYPE_RELATIVE_TO_LISTENER */ - - for ( nS = 0; nS < nchan_rend; nS++ ) - { - if ( ( error = TDREND_MIX_AddSrc( hBinRendererTd, &SrcInd[nS], PosType ) ) != IVAS_ERR_OK ) - { - return error; - } - } - - if ( getAudioConfigType( inConfig ) == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) - { - switch ( inConfig ) - { - case IVAS_REND_AUDIO_CONFIG_5_1: - ls_azimuth = ls_azimuth_CICP6; - ls_elevation = ls_elevation_CICP6; - break; - case IVAS_REND_AUDIO_CONFIG_7_1: - ls_azimuth = ls_azimuth_CICP12; - ls_elevation = ls_elevation_CICP12; - break; - case IVAS_REND_AUDIO_CONFIG_5_1_2: - ls_azimuth = ls_azimuth_CICP14; - ls_elevation = ls_elevation_CICP14; - break; - case IVAS_REND_AUDIO_CONFIG_5_1_4: - ls_azimuth = ls_azimuth_CICP16; - ls_elevation = ls_elevation_CICP16; - break; - case IVAS_REND_AUDIO_CONFIG_7_1_4: - ls_azimuth = ls_azimuth_CICP19; - ls_elevation = ls_elevation_CICP19; - break; - case IVAS_REND_AUDIO_CONFIG_LS_CUSTOM: - ls_azimuth = customLsInput->ls_azimuth; - ls_elevation = customLsInput->ls_elevation; - break; - default: - ls_azimuth = NULL; - ls_elevation = NULL; - } - - DirAtten_p = hBinRendererTd->DirAtten_p; - - for ( nS = 0; nS < nchan_rend; nS++ ) - { - /* Set source positions according to loudspeaker layout */ - Pos[0] = cosf( ls_elevation[nS] * PI_OVER_180 ) * cosf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[1] = cosf( ls_elevation[nS] * PI_OVER_180 ) * sinf( ls_azimuth[nS] * PI_OVER_180 ); - Pos[2] = sinf( ls_elevation[nS] * PI_OVER_180 ); - Dir[0] = 1.0f; - Dir[1] = 0.0f; - Dir[2] = 0.0f; - - /* Source directivity info */ - DirAtten_p->ConeInnerAngle = 360.0f; - DirAtten_p->ConeOuterAngle = 360.0f; - DirAtten_p->ConeOuterGain = 1.0f; - - TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); - TDREND_MIX_SRC_SetDir( hBinRendererTd, nS, Dir ); - TDREND_MIX_SRC_SetPlayState( hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); - } - } - - pTDRend->hBinRendererTd = hBinRendererTd; - - pTDRend->binaural_latency_ns = (int32_t) ( hBinRendererTd->HrFiltSet_p->latency_s * 1000000000.f ); - - return IVAS_ERR_OK; -#endif } @@ -888,32 +581,22 @@ ivas_error ivas_td_binaural_renderer_ext( float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ) { -#ifndef FIX_198_TDREND_INTERFACE - int16_t subframe_length; - int16_t subframe_idx; - ISM_METADATA_HANDLE hIsmMetaData[1]; -#else ISM_METADATA_FRAME hIsmMetaDataFrame; ISM_METADATA_HANDLE hIsmMetaData[1]; -#endif int16_t lfe_idx; int16_t num_src; /* TODO tmu : pass down renderer config struct */ // float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; IVAS_FORMAT ivas_format; IVAS_REND_AudioConfigType inConfigType; -#ifdef FIX_198_TDREND_INTERFACE AUDIO_CONFIG transport_config; int32_t output_Fs; -#endif push_wmops( "ivas_td_binaural_renderer_ext" ); inConfigType = getAudioConfigType( inConfig ); lfe_idx = LFE_CHANNEL; -#ifdef FIX_198_TDREND_INTERFACE hIsmMetaData[0] = NULL; -#endif if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { @@ -932,20 +615,12 @@ ivas_error ivas_td_binaural_renderer_ext( { ivas_format = ISM_FORMAT; num_src = 1; -#ifdef FIX_198_TDREND_INTERFACE hIsmMetaData[0] = &hIsmMetaDataFrame; -#else - hIsmMetaData[0] = malloc( sizeof( ISM_METADATA_FRAME ) ); -#endif hIsmMetaData[0]->azimuth = currentPos->azimuth; hIsmMetaData[0]->elevation = currentPos->elevation; } -#ifndef FIX_198_TDREND_INTERFACE - subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#endif -#ifdef FIX_198_TDREND_INTERFACE #ifdef FIX_197_CREND_INTERFACE transport_config = getIvasAudioConfigFromRendAudioConfig( inConfig ); #else @@ -957,54 +632,6 @@ ivas_error ivas_td_binaural_renderer_ext( ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, output, output_frame ); -#else - - /* TODO tmu : pass down renderer config struct and decide what to do about ini_frame ? */ - // if ( hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - // { - // if ( hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) - // { - // ivas_reverb_open( &pTDRend->hCrend->hReverb, pTDRend->transport_config, NULL, pTDRend->hRenderConfig, pTDRend->hDecoderConfig->output_Fs ); - // } - // } - - /* Update object position(s) */ - TDREND_Update_object_positions( pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, output ); - - /* TODO tmu : needs a refactor / better approach */ - if ( ivas_format == ISM_FORMAT ) - { - free( hIsmMetaData[0] ); - } - - for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) - { - /* Update the listener's location/orientation */ - TDREND_Update_listener_orientation( pTDRend->hBinRendererTd, headRotData->headRotEnabled, ( headRotData != NULL ) ? &headRotData->headPositions[subframe_idx] : NULL ); - - /* TODO tmu : pass down renderer config struct */ - // if ( ( hRenderConfig != NULL ) && ( hRenderConfig->roomAcoustics.late_reverb_on ) ) - // { - // ivas_reverb_process( hCrend->hReverb, transport_config, 0, output, reverb_signal, subframe_idx ); - // } - - /* Render subframe */ - TDREND_GetMix( pTDRend->hBinRendererTd, output, subframe_length, subframe_idx ); - } - - /* TODO tmu : pass down renderer config struct */ - // if ( pTDRend->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ - // { - // if ( pTDRend->hRenderConfig->roomAcoustics.late_reverb_on ) - // { - // /* add reverb to rendered signals */ - // v_add( reverb_signal[0], output[0], output[0], output_frame ); - // v_add( reverb_signal[1], output[1], output[1], output_frame ); - // } - // } - - -#endif pop_wmops(); return IVAS_ERR_OK; diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index 6c27317d83c724ac14999c54dc412f8a0431aeb4..8a6cb1a2f90fab3f671d337ce973c60ed745e916 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -215,7 +215,6 @@ void ivas_HRTF_CRend_binary_close( * TD object renderer *----------------------------------------------------------------------------------*/ -#ifdef FIX_198_TDREND_INTERFACE void ivas_td_binaural_renderer_unwrap( RENDER_CONFIG_DATA *hRenderConfig, /* i : Renderer configuration */ const int16_t ini_frame, /* i : Initialization frame counter */ @@ -236,7 +235,6 @@ void ivas_td_binaural_renderer_unwrap( float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ); -#endif ivas_error ivas_td_binaural_renderer_ext( const TDREND_WRAPPER *pTDRend, /* i : TD Renderer wrapper structure */ @@ -248,7 +246,6 @@ ivas_error ivas_td_binaural_renderer_ext( float output[][L_FRAME48k] /* i/o: SCE channels / Binaural synthesis */ ); -#ifdef FIX_198_TDREND_INTERFACE ivas_error ivas_td_binaural_open_unwrap( TDREND_HRFILT_FiltSet_t **hHrtfTD, /* i/o: HR filter model (from file or NULL) */ const int32_t output_Fs, /* i : Output sampling rate */ @@ -259,7 +256,6 @@ ivas_error ivas_td_binaural_open_unwrap( BINAURAL_TD_OBJECT_RENDERER_HANDLE *hBinRendererTd, /* o : TD renderer handle */ int32_t *binaural_latency_ns /* i : Binauralization delay */ ); -#endif ivas_error ivas_td_binaural_open_ext( TDREND_WRAPPER *pTDRend, @@ -538,11 +534,6 @@ ivas_error ivas_crend_init_from_hrtf_handle( #endif -#ifndef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE -ivas_error destroy_SetOfHRTF( - HRTFS_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */ -); -#endif ivas_error ivas_crend_init_from_rom( diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c index c58bb27000c222bed22a6790c4c1d6a74e461271..928f006456066fa604df134eb1d5dab3f3c0c311 100644 --- a/lib_util/hrtf_file_reader.c +++ b/lib_util/hrtf_file_reader.c @@ -1530,7 +1530,6 @@ ivas_error create_SetOfHRTF_from_binary( } -#ifdef FIX_MEMORY_COUNTING_HRTF_BINARY_FILE /*---------------------------------------------------------------------* * destroy_HRTF() * @@ -1605,5 +1604,3 @@ ivas_error destroy_SetOfHRTF( return IVAS_ERR_OK; } - -#endif