diff --git a/apps/renderer.c b/apps/renderer.c index 0a29d20fc559d4ef1aa55ac0db0dad96edc61ada..8ef8a988bddb356d6d3e31ce4c83210a13bf2e26 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -68,9 +68,7 @@ #define IVAS_MAX16B_FLT 32767.0f #define IVAS_MIN16B_FLT ( -32768.0f ) -#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS #define OMASA_TDREND_MATCHING_GAIN_DB ( -2.0f ) -#endif #if !defined( DEBUGGING ) && !defined( WMOPS ) static @@ -1164,29 +1162,21 @@ int main( } } -#ifndef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS - /* Set the total number of objects */ -#endif if ( args.inConfig.numAudioObjects > 0 ) { -#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Set the total number of objects */ -#endif if ( ( error = IVAS_REND_SetTotalNumberOfObjects( hIvasRend, args.inConfig.numAudioObjects ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_SetTotalNumberOfObjects(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } -#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Set the metadata delay for objects */ -#endif if ( ( error = IVAS_REND_SetIsmMetadataDelay( hIvasRend, args.syncMdDelay ) ) != IVAS_ERR_OK ) { fprintf( stderr, "\nError in IVAS_REND_SetIsmMetadataDelay(): %s\n", ivas_error_to_string( error ) ); goto cleanup; } -#ifdef NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* For OMASA input and BINAURAL output, apply a gain to objects to match the loudness with MASA part */ if ( args.inConfig.numMasaBuses > 0 && args.outConfig.audioConfig == IVAS_AUDIO_CONFIG_BINAURAL ) @@ -1196,7 +1186,6 @@ int main( args.inConfig.audioObjects[i].gain_dB += OMASA_TDREND_MATCHING_GAIN_DB; } } -#endif } IVAS_REND_LfePanMtx lfePanMatrix; diff --git a/lib_com/options.h b/lib_com/options.h index 8267482f977df056b0f429329db77cc277c4aa6b..0000a66f49268907a8e5fdba56873a3e85642984 100644 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -163,7 +163,6 @@ /*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */ #define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */ -#define CODE_IMPROVEMENTS /* FhG: Small code improvements that do not change the functionality */ #define FIX_1348_OVERFLOW /* FhG: fix BASOP overflow in hq_lr_dec(), brings floating-point code inline with FX */ /* #################### End BE switches ################################## */ @@ -175,9 +174,6 @@ #define NONBE_1244_FIX_SWB_BWE_MEMORY /* VA: issue 1244: fix to SWB BWE memory in case of switching from FB coding - pending a review by Huawei */ #define NONBE_1122_KEEP_EVS_MODE_UNCHANGED /* FhG: Disables fix for issue 1122 in EVS mode to keep BE tests green. This switch should be removed once the 1122 fix is added to EVS via a CR. */ -#define NONBE_1359_FIX_IVASREND_OMASA_BINAURAL_LOUDNESS /* Nokia: issue 1339: Apply scaling to the object-part of OMASA for binaural rendering in IVAS_rend. */ -#define NONBE_1362_FIX_OMASA_TO_MASA1_RENDERING /* Nokia: Fix OMASA to MASA1 rendering in IVAS_rend */ -#define NONBE_1360_LFE_DELAY /* Dlb: LFE delay alignment when rendering in CLDFB domain*/ #define NONBE_SVD_OPTIMIZATION /* ##################### End NON-BE switches ########################### */ diff --git a/lib_com/tools.c b/lib_com/tools.c index 224c28fa4ed6d208edd4a44e68cae6c36f376395..6dca2331ff73320a615f120e5a1cea687704ab9f 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -1742,27 +1742,11 @@ double anint( int16_t is_numeric_float( float x ) { -#ifdef CODE_IMPROVEMENTS int16_t retval; #define WMC_TOOL_SKIP retval = (int16_t) ( !isnan( x ) && !isinf( x ) ); #undef WMC_TOOL_SKIP return retval; -#else -#ifndef BASOP_NOGLOB - union float_int -#else /* BASOP_NOGLOB */ - union float_int -#endif /* BASOP_NOGLOB */ - { - float float_val; - int32_t int_val; - } float_int; - - float_int.float_val = x; - - return ( ( float_int.int_val & 0x7f800000 ) != 0x7f800000 ); -#endif } /*-------------------------------------------------------------------* diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 0b04eedb3b05b8eec7e9dca9dbc8ca1d0a566e82..6a066e954be9eff4664560156a7257580d02dba2 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -2305,7 +2305,6 @@ ivas_error ivas_init_decoder( if ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) { -#ifdef NONBE_1360_LFE_DELAY if ( st_ivas->hIntSetup.index_lfe[0] != -1 ) { delay_ns = st_ivas->binaural_latency_ns; @@ -2314,9 +2313,7 @@ ivas_error ivas_init_decoder( { delay_ns = 0; } -#else - int32_t delay_ns = st_ivas->binaural_latency_ns; -#endif + if ( st_ivas->hBinRenderer != NULL ) { if ( st_ivas->hBinRenderer->render_lfe ) diff --git a/lib_dec/ivas_lfe_dec.c b/lib_dec/ivas_lfe_dec.c index e734f1e0fdc24174fa5ee11d4d2c80f0a43d3671..6dfe76f9652331c0354d052ebe052e20fe4b6b75 100644 --- a/lib_dec/ivas_lfe_dec.c +++ b/lib_dec/ivas_lfe_dec.c @@ -380,11 +380,7 @@ ivas_error ivas_create_lfe_dec( LFE_DEC_HANDLE hLFE; float lfe_addl_delay_s; int16_t i, j; -#ifndef NONBE_1360_LFE_DELAY - int16_t add_delay_sa; -#else float lfe_block_delay_s; -#endif low_pass_delay_dec_out = 0; block_offset_s = 0; @@ -422,11 +418,7 @@ ivas_error ivas_create_lfe_dec( hLFE->cum_freq_models[1][3] = &ivas_str_lfe_freq_models.entropy_coder_model_coarse_sg4; /* delay calculation */ -#ifndef NONBE_1360_LFE_DELAY - hLFE->lfe_block_delay_s = ( IVAS_LFE_FADE_NS / 1000000000.f ) + ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3]; -#else lfe_block_delay_s = ( IVAS_LFE_FADE_NS / 1000000000.f ) + ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3]; -#endif block_offset_s = BLOCK_OFFSET_MS * 0.001f; filt_order = 0; @@ -434,40 +426,21 @@ ivas_error ivas_create_lfe_dec( if ( ( delay_ns / 1000000000.f ) > ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3] ) { filt_order = 4; -#ifdef NONBE_1360_LFE_DELAY low_pass_delay_dec_out = ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3]; -#else - low_pass_delay_dec_out = ivas_lfe_lpf_delay[IVAS_FILTER_ORDER_4 - 3] * 1000000000.f; -#endif ivas_create_lfe_lpf_dec( &( hLFE->filter_state ), output_Fs ); } hLFE->filter_state.order = filt_order; -#ifndef NONBE_1360_LFE_DELAY - hLFE->lfe_block_delay_s = hLFE->lfe_block_delay_s + low_pass_delay_dec_out; -#else lfe_block_delay_s = lfe_block_delay_s + low_pass_delay_dec_out; -#endif hLFE->lfe_prior_buf_len = NS2SA( output_Fs, IVAS_LFE_FADE_NS ); hLFE->bfi_count = 0; -#ifdef NONBE_1360_LFE_DELAY block_offset_s += delay_ns / 1000000000.f; lfe_addl_delay_s = block_offset_s - lfe_block_delay_s; -#else - lfe_addl_delay_s = block_offset_s - hLFE->lfe_block_delay_s; -#endif lfe_addl_delay_s = max( 0.0f, lfe_addl_delay_s ); -#ifndef NONBE_1360_LFE_DELAY - add_delay_sa = (int16_t) roundf( (float) delay_ns * output_Fs / 1000000000.f ); - hLFE->lfe_addl_delay = (int16_t) ( lfe_addl_delay_s * output_Fs ) + add_delay_sa; - hLFE->lfe_block_delay_s += lfe_addl_delay_s + add_delay_sa / output_Fs; - hLFE->lfe_block_delay_s += lfe_addl_delay_s; -#else hLFE->lfe_addl_delay = (int16_t) ( lfe_addl_delay_s * output_Fs ); hLFE->delay_ns = delay_ns; -#endif if ( hLFE->lfe_addl_delay > 0 ) { diff --git a/lib_dec/ivas_mc_paramupmix_dec.c b/lib_dec/ivas_mc_paramupmix_dec.c index 049cc120b3113a592fbdbf88e8d7e79143ddb326..5753d262a078261ae49ea0abb9c6247a1ce377d0 100644 --- a/lib_dec/ivas_mc_paramupmix_dec.c +++ b/lib_dec/ivas_mc_paramupmix_dec.c @@ -679,6 +679,7 @@ static void ivas_mc_paramupmix_dec_sf( cldfbAnalysis_ts( &( pPcm_temp[ch][hMCParamUpmix->num_freq_bands * slot_idx] ), Cldfb_RealBuffer[ch][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], hMCParamUpmix->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); } } + for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { ps_pred_process_sf( hMCParamUpmix, @@ -837,6 +838,7 @@ static void ivas_mc_paramupmix_dec_sf( hMCParamUpmix->num_freq_bands, st_ivas->cldfbSynDec[ch] ); } } + /* adjust delay of other channels */ noparamupmix_delay = NS2SA( st_ivas->hDecoderConfig->output_Fs, IVAS_FB_DEC_DELAY_NS ); n_samples_rendered = st_ivas->hTcBuffer->subframe_nbslots[st_ivas->hTcBuffer->subframes_rendered] * hMCParamUpmix->num_freq_bands; @@ -844,37 +846,29 @@ static void ivas_mc_paramupmix_dec_sf( { for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { -#ifdef NONBE_1360_LFE_DELAY /*delay is handled within LFE decoder*/ if ( st_ivas->hIntSetup.index_lfe[0] != ch ) { -#endif float tmp_buf[L_SUBFRAME5MS_48k]; mvr2r( &output_f[ch][n_samples_rendered - noparamupmix_delay], tmp_buf, noparamupmix_delay ); mvr2r( output_f[ch], &output_f[ch][noparamupmix_delay], n_samples_rendered - noparamupmix_delay ); mvr2r( hMCParamUpmix->pcm_delay[ch], output_f[ch], noparamupmix_delay ); mvr2r( tmp_buf, hMCParamUpmix->pcm_delay[ch], noparamupmix_delay ); -#ifdef NONBE_1360_LFE_DELAY } -#endif } } else { for ( ch = 0; ch < MC_PARAMUPMIX_COMBINATIONS; ch++ ) { -#ifdef NONBE_1360_LFE_DELAY if ( st_ivas->hIntSetup.index_lfe[0] != ch ) { -#endif float tmp_buf[L_SUBFRAME5MS_48k]; mvr2r( &output_f[ch][0], tmp_buf, n_samples_rendered ); mvr2r( hMCParamUpmix->pcm_delay[ch], output_f[ch], n_samples_rendered ); mvr2r( &hMCParamUpmix->pcm_delay[ch][n_samples_rendered], &hMCParamUpmix->pcm_delay[ch][0], noparamupmix_delay - n_samples_rendered ); mvr2r( tmp_buf, &hMCParamUpmix->pcm_delay[ch][noparamupmix_delay - n_samples_rendered], n_samples_rendered ); -#ifdef NONBE_1360_LFE_DELAY } -#endif } } } diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 28f5321a3a7a2358e9c5f4151c1441a8c16cb459..ddc86592d1423d56c7e5da5826c2af1a18e336c7 100644 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -1077,44 +1077,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } -#ifndef NONBE_1360_LFE_DELAY - /*-----------------------------------------------------------------* - * Allocate the LFE handle that is coded separately after the allocation of the core coders - *-----------------------------------------------------------------*/ - - if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL ) - { - int32_t delay_ns = st_ivas->binaural_latency_ns; - if ( st_ivas->hBinRenderer != NULL ) - { - if ( st_ivas->hBinRenderer->render_lfe ) - { - /* Account for filterbank delay */ - delay_ns += IVAS_FB_DEC_DELAY_NS; - } - else - { - delay_ns = 0; - } - } - else - { - if ( ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && ( st_ivas->cldfbSynDec[0] != NULL ) ) - { - delay_ns += IVAS_FB_DEC_DELAY_NS; - } - } - - if ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, delay_ns ) ) != IVAS_ERR_OK ) - { - return error; - } - - set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); - set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); - } -#endif - /*-----------------------------------------------------------------* * Reconfigure renderers *-----------------------------------------------------------------*/ @@ -1267,17 +1229,12 @@ static ivas_error ivas_mc_dec_reconfig( } -#ifdef NONBE_1360_LFE_DELAY /*-----------------------------------------------------------------* * Allocate the LFE handle that is coded separately after the allocation of the core coders *-----------------------------------------------------------------*/ -#ifdef NONBE_1360_LFE_DELAY + if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) ) -#else - if ( ( st_ivas->mc_mode == MC_MODE_MCT || st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) && st_ivas->hLFE == NULL ) -#endif { -#ifdef NONBE_1360_LFE_DELAY int32_t delay_ns; if ( st_ivas->hIntSetup.index_lfe[0] != -1 ) { @@ -1287,9 +1244,7 @@ static ivas_error ivas_mc_dec_reconfig( { delay_ns = 0; } -#else - int32_t delay_ns = st_ivas->binaural_latency_ns; -#endif + if ( st_ivas->hBinRenderer != NULL ) { if ( st_ivas->hBinRenderer->render_lfe ) @@ -1310,7 +1265,6 @@ static ivas_error ivas_mc_dec_reconfig( } } -#ifdef NONBE_1360_LFE_DELAY if ( st_ivas->hLFE != NULL ) { if ( st_ivas->hLFE->delay_ns != delay_ns ) @@ -1318,12 +1272,9 @@ static ivas_error ivas_mc_dec_reconfig( ivas_lfe_dec_close( &( st_ivas->hLFE ) ); } } -#endif -#ifdef NONBE_1360_LFE_DELAY if ( st_ivas->hLFE == NULL ) { -#endif if ( ( error = ivas_create_lfe_dec( &st_ivas->hLFE, st_ivas->hDecoderConfig->output_Fs, delay_ns ) ) != IVAS_ERR_OK ) { return error; @@ -1331,11 +1282,8 @@ static ivas_error ivas_mc_dec_reconfig( set_zero( st_ivas->hLFE->prevsynth_buf, LFE_PLC_BUFLEN ); set_zero( st_ivas->hLFE->prior_out_buffer, L_FRAME48k ); -#ifdef NONBE_1360_LFE_DELAY } -#endif } -#endif /*-----------------------------------------------------------------* * JBM TC buffers diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 1d04bea71fb0d1eb0b6d07d01af97ac43f19d8d8..f7cac7160b1f21274101478f6da94f1c4c51e5c2 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -790,11 +790,7 @@ typedef struct ivas_lfe_dec_data_structure LFE_WINDOW_HANDLE pWindow_state; const uint16_t *cum_freq_models[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; int16_t lfe_dec_indices_coeffs_tbl[IVAS_MAX_NUM_QUANT_STRATS][IVAS_MAX_NUM_DCT_COEF_GROUPS]; -#ifdef NONBE_1360_LFE_DELAY int32_t delay_ns; -#else - float lfe_block_delay_s; -#endif int16_t lfe_prior_buf_len; float prior_out_buffer[L_FRAME48k]; @@ -850,6 +846,7 @@ typedef struct } ISAR_DEC_SPLIT_REND_WRAPPER, *ISAR_DEC_SPLIT_REND_WRAPPER_HANDLE; + /*----------------------------------------------------------------------------------* * MASA decoder structures *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/ivas_omasa_ana.c b/lib_rend/ivas_omasa_ana.c index be092fe1016b1b73e0f10625c39ba3fa74bb3453..e7f58262edb660d75478f5e9c25733bb752f9487 100644 --- a/lib_rend/ivas_omasa_ana.c +++ b/lib_rend/ivas_omasa_ana.c @@ -482,7 +482,6 @@ static void ivas_omasa_dmx( float g1, g2; float data_out_f[MASA_MAX_TRANSPORT_CHANNELS][L_FRAME48k]; - for ( i = 0; i < nchan_transport; i++ ) { set_zero( data_out_f[i], input_frame ); @@ -490,7 +489,6 @@ static void ivas_omasa_dmx( for ( i = 0; i < nchan_ism; i++ ) { -#ifdef NONBE_1362_FIX_OMASA_TO_MASA1_RENDERING if ( nchan_transport == 1 ) { v_add( data_out_f[0], data_in_f[i], data_out_f[0], input_frame ); @@ -517,27 +515,6 @@ static void ivas_omasa_dmx( prev_gains[i][j] = gains[j]; } } -#else - azimuth = ism_azimuth[i]; - elevation = ism_elevation[i]; - - ivas_ism_get_stereo_gains( azimuth, elevation, &gains[0], &gains[1] ); - - /* Downmix using the panning gains */ - for ( j = 0; j < nchan_transport; j++ ) - { - if ( fabsf( gains[j] ) > 0.0 || fabsf( prev_gains[i][j] ) > 0.0f ) - { - for ( k = 0; k < input_frame; k++ ) - { - g1 = interpolator[k]; - g2 = 1.0f - g1; - data_out_f[j][k] += ( g1 * gains[j] + g2 * prev_gains[i][j] ) * data_in_f[i][k]; - } - } - prev_gains[i][j] = gains[j]; - } -#endif } for ( i = 0; i < nchan_transport; i++ ) diff --git a/lib_rend/ivas_rom_rend.c b/lib_rend/ivas_rom_rend.c index b14a5303a0f40b052ce7224d39247b7346f6abec..3f4b906bd6fdaa8159f22abe9ed3fb2686c3fd6e 100644 --- a/lib_rend/ivas_rom_rend.c +++ b/lib_rend/ivas_rom_rend.c @@ -163,15 +163,9 @@ const float ap_lattice_coeffs_3[DIRAC_DECORR_FILTER_LEN_3*DIRAC_MAX_NUM_DECORR_F const float * const ap_lattice_coeffs[DIRAC_DECORR_NUM_SPLIT_BANDS] = { -#ifdef CODE_IMPROVEMENTS ap_lattice_coeffs_1, ap_lattice_coeffs_2, ap_lattice_coeffs_3, -#else - &ap_lattice_coeffs_1[0], - &ap_lattice_coeffs_2[0], - &ap_lattice_coeffs_3[0], -#endif }; const float ap_split_frequencies[DIRAC_DECORR_NUM_SPLIT_BANDS + 1] = @@ -183,11 +177,13 @@ const int16_t sba_map_tc[11] = { 0, 1, 2, 3, 4, 8, 9, 15, 5, 6, 7 }; + const int16_t sba_map_tc_512[11] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15 }; + /*----------------------------------------------------------------------------------* * FASTCONV and PARAMETRIC binaural renderer ROM tables *----------------------------------------------------------------------------------*/ @@ -386,6 +382,7 @@ const float ivas_reverb_default_DSR[IVAS_REVERB_DEFAULT_N_BANDS] = 6.2001e-08f, 2.8483e-08f, 2.6267e-08f }; + /*----------------------------------------------------------------------------------* * Renderer SBA & MC enc/dec matrices *----------------------------------------------------------------------------------*/ @@ -394,6 +391,7 @@ const float ivas_reverb_default_DSR[IVAS_REVERB_DEFAULT_N_BANDS] = const float ls_azimuth_CICP1[1] = { 0.0f }; const float ls_elevation_CICP1[1] = { 0.0f }; + /*----------------------------------------------------------------------------------* * EFAP ROM tables *----------------------------------------------------------------------------------*/ diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index cdf0ce31b1333c34dcf3ef64ad24c5c615da2820..180fd5dabd579609cb3fa733d907fbf9b15ca0fe 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -3581,7 +3581,7 @@ static ivas_error getConstInputById( return IVAS_ERR_OK; } -#ifdef CODE_IMPROVEMENTS + static void *getInputByIndex( void *inputsArray, const size_t index, @@ -3607,56 +3607,30 @@ static void *getInputByIndex( /* include a final return to make the linter happy and avoid problems with wmc_tool (see #1355) */ return NULL; } -#endif + static ivas_error findFreeInputSlot( -#ifdef CODE_IMPROVEMENTS void *inputs, const IVAS_REND_AudioConfigType inputType, -#else - const void *inputs, - const int32_t inputStructSize, -#endif const int32_t maxInputs, int32_t *inputIndex ) { -#ifdef CODE_IMPROVEMENTS /* Using a void pointer and a separately provided type is a hack for this function to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). Assumptions: - input_base is always the first member in the input struct - memory alignments of original input type and input_base are the same */ -#else - /* Using a void pointer and a separately provided size is a hack for this function - to be reusable for arrays of any input type (input_ism, input_mc, input_sba, input_masa). - Assumptions: - - input_base is always the first member in the input struct - - provided size is correct - */ -#endif - int32_t i; bool canAddInput; -#ifndef CODE_IMPROVEMENTS - const uint8_t *pByte; -#endif const input_base *pInputBase; canAddInput = false; /* Find first unused input in array */ -#ifdef CODE_IMPROVEMENTS for ( i = 0; i < maxInputs; ++i ) -#else - for ( i = 0, pByte = inputs; i < maxInputs; ++i, pByte += inputStructSize ) -#endif { -#ifdef CODE_IMPROVEMENTS pInputBase = (const input_base *) getInputByIndex( inputs, i, inputType ); -#else - pInputBase = (const input_base *) pByte; -#endif if ( pInputBase->inConfig == IVAS_AUDIO_CONFIG_INVALID ) { @@ -3806,15 +3780,12 @@ ivas_error IVAS_REND_AddInput( ivas_error error; int32_t maxNumInputsOfType; void *inputsArray; -#ifdef CODE_IMPROVEMENTS IVAS_REND_AudioConfigType inputType; -#else - int32_t inputStructSize; -#endif ivas_error ( *activateInput )( void *, AUDIO_CONFIG, IVAS_REND_InputId, RENDER_CONFIG_DATA *, hrtf_handles * ); void ( *setInputDelay )( void *, bool ); int32_t inputIndex; bool splitPreRendCldfb; + splitPreRendCldfb = false; /* Validate function arguments */ @@ -3844,47 +3815,30 @@ ivas_error IVAS_REND_AddInput( splitPreRendCldfb = ( hIvasRend->hRendererConfig->split_rend_config.codec == ISAR_SPLIT_REND_CODEC_LCLD ); } - -#ifdef CODE_IMPROVEMENTS inputType = getAudioConfigType( inConfig ); switch ( inputType ) -#else - switch ( getAudioConfigType( inConfig ) ) -#endif { case IVAS_REND_AUDIO_CONFIG_TYPE_OBJECT_BASED: maxNumInputsOfType = RENDERER_MAX_ISM_INPUTS; inputsArray = hIvasRend->inputsIsm; -#ifndef CODE_IMPROVEMENTS - inputStructSize = sizeof( *hIvasRend->inputsIsm ); -#endif activateInput = setRendInputActiveIsm; setInputDelay = setRendInputDelayIsm; break; case IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED: maxNumInputsOfType = RENDERER_MAX_MC_INPUTS; inputsArray = hIvasRend->inputsMc; -#ifndef CODE_IMPROVEMENTS - inputStructSize = sizeof( *hIvasRend->inputsMc ); -#endif activateInput = setRendInputActiveMc; setInputDelay = setRendInputDelayMc; break; case IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS: maxNumInputsOfType = RENDERER_MAX_SBA_INPUTS; inputsArray = hIvasRend->inputsSba; -#ifndef CODE_IMPROVEMENTS - inputStructSize = sizeof( *hIvasRend->inputsSba ); -#endif activateInput = setRendInputActiveSba; setInputDelay = setRendInputDelaySba; break; case IVAS_REND_AUDIO_CONFIG_TYPE_MASA: maxNumInputsOfType = RENDERER_MAX_MASA_INPUTS; inputsArray = hIvasRend->inputsMasa; -#ifndef CODE_IMPROVEMENTS - inputStructSize = sizeof( *hIvasRend->inputsMasa ); -#endif activateInput = setRendInputActiveMasa; setInputDelay = setRendInputDelayMasa; break; @@ -3892,30 +3846,19 @@ ivas_error IVAS_REND_AddInput( return IVAS_ERR_INVALID_INPUT_FORMAT; } - /* Find first free input in array corresponding to input type */ -#ifdef CODE_IMPROVEMENTS + /* Find first free input in array corresponding to input type */ if ( ( error = findFreeInputSlot( inputsArray, inputType, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) -#else - if ( ( error = findFreeInputSlot( inputsArray, inputStructSize, maxNumInputsOfType, &inputIndex ) ) != IVAS_ERR_OK ) -#endif { return error; } *inputId = makeInputId( inConfig, inputIndex ); -#ifdef CODE_IMPROVEMENTS if ( ( error = activateInput( getInputByIndex( inputsArray, inputIndex, inputType ), inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = activateInput( (uint8_t *) inputsArray + inputStructSize * inputIndex, inConfig, *inputId, hIvasRend->hRendererConfig, &hIvasRend->hHrtfs ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef CODE_IMPROVEMENTS + setInputDelay( getInputByIndex( inputsArray, inputIndex, inputType ), splitPreRendCldfb ); -#else - setInputDelay( (uint8_t *) inputsArray + inputStructSize * inputIndex, splitPreRendCldfb ); -#endif /* set global maximum delay after adding an input */ setMaxGlobalDelayNs( hIvasRend ); diff --git a/lib_util/mime_io.c b/lib_util/mime_io.c index ee2a9c12a5695cb469962508449e0101fcc4794f..1ecd603b32a752b4f819a3636bdedfd1179c4209 100644 --- a/lib_util/mime_io.c +++ b/lib_util/mime_io.c @@ -305,7 +305,9 @@ MIME_ERROR MIME_Writer_Close( } -static bool readByte( FILE *file, uint8_t *value ) +static bool readByte( + FILE *file, + uint8_t *value ) { if ( fread( value, 1, 1, file ) != 1U ) { @@ -314,14 +316,13 @@ static bool readByte( FILE *file, uint8_t *value ) return true; } -static bool readLong( FILE *file, uint16_t *value ) +static bool readLong( + FILE *file, + uint16_t *value ) { char buffer[4] = { 0 }; -#ifdef CODE_IMPROVEMENTS + if ( fread( buffer, 1, 4, file ) != 1U ) -#else - if ( fread( buffer, 4, 1, file ) != 1U ) -#endif { return false; } @@ -346,7 +347,10 @@ static bool readLong( FILE *file, uint16_t *value ) * to the serial bitstream. *-------------------------------------------------------------------*/ -static void byteToSerialReordered( uint8_t byte, uint16_t *serial, const int16_t *sort_indices ) +static void byteToSerialReordered( + uint8_t byte, + uint16_t *serial, + const int16_t *sort_indices ) { for ( uint32_t i = 0; i < 8; ++i ) { @@ -360,8 +364,11 @@ static void byteToSerialReordered( uint8_t byte, uint16_t *serial, const int16_t byte <<= 1; } + + return; } + /*-------------------------------------------------------------------* * byteToSerial() * @@ -369,18 +376,25 @@ static void byteToSerialReordered( uint8_t byte, uint16_t *serial, const int16_t * to the given serial bitstream array. *-------------------------------------------------------------------*/ -static void byteToSerial( uint8_t byte, uint16_t *serial ) +static void byteToSerial( + uint8_t byte, + uint16_t *serial ) { const int16_t indices[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; + byteToSerialReordered( byte, serial, indices ); + + return; } -static MIME_ERROR readHeader( MIME_HANDLE hMIME ) + +static MIME_ERROR readHeader( + MIME_HANDLE hMIME ) { const char id[] = "#!EVS_MC1.0\n"; const uint16_t num_char_id = sizeof( id ) - 1; - char buffer[sizeof( id )] = { 0 }; + if ( fread( buffer, sizeof( char ), num_char_id, hMIME->file ) != num_char_id ) { return MIME_READ_ERROR; @@ -398,13 +412,17 @@ static MIME_ERROR readHeader( MIME_HANDLE hMIME ) return MIME_NO_ERROR; } + + /*-------------------------------------------------------------------* * MIME_Reader_Open_filename() * * Open MIME reader *-------------------------------------------------------------------*/ -MIME_ERROR MIME_Reader_Open_filename( MIME_HANDLE *phMIME, const char *filename ) +MIME_ERROR MIME_Reader_Open_filename( + MIME_HANDLE *phMIME, + const char *filename ) { MIME_ERROR error = MIME_NO_ERROR; @@ -440,7 +458,8 @@ MIME_ERROR MIME_Reader_Open_filename( MIME_HANDLE *phMIME, const char *filename * Rewind currently opened file to beginning *-------------------------------------------------------------------*/ -MIME_ERROR MIME_Reader_Rewind( MIME_HANDLE hMIME ) +MIME_ERROR MIME_Reader_Rewind( + MIME_HANDLE hMIME ) { if ( !hMIME || !hMIME->file ) { @@ -455,7 +474,13 @@ MIME_ERROR MIME_Reader_Rewind( MIME_HANDLE hMIME ) return MIME_NO_ERROR; } -static MIME_ERROR readEvsFrame( FILE *file, uint8_t ToC, uint16_t *serial, int16_t *num_bits, int16_t *bfi ) + +static MIME_ERROR readEvsFrame( + FILE *file, + uint8_t ToC, + uint16_t *serial, + int16_t *num_bits, + int16_t *bfi ) { switch ( ToC & 0x0f ) { @@ -524,7 +549,13 @@ static MIME_ERROR readEvsFrame( FILE *file, uint8_t ToC, uint16_t *serial, int16 return MIME_NO_ERROR; } -static MIME_ERROR readAmrWbFrame( FILE *file, uint8_t ToC, uint16_t *serial, int16_t *num_bits, int16_t *bfi ) + +static MIME_ERROR readAmrWbFrame( + FILE *file, + uint8_t ToC, + uint16_t *serial, + int16_t *num_bits, + int16_t *bfi ) { const uint8_t mode = ToC & 0x0f; @@ -595,12 +626,18 @@ static MIME_ERROR readAmrWbFrame( FILE *file, uint8_t ToC, uint16_t *serial, int return MIME_NO_ERROR; } + /*-------------------------------------------------------------------* * MIME_ReadFrame_short() * * Read MIME frame to serial bitstream *-------------------------------------------------------------------*/ -MIME_ERROR MIME_ReadFrame_short( MIME_HANDLE hMIME, uint16_t *serial, int16_t *num_bits, int16_t *bfi ) + +MIME_ERROR MIME_ReadFrame_short( + MIME_HANDLE hMIME, + uint16_t *serial, + int16_t *num_bits, + int16_t *bfi ) { if ( !hMIME ) { @@ -637,12 +674,16 @@ MIME_ERROR MIME_ReadFrame_short( MIME_HANDLE hMIME, uint16_t *serial, int16_t *n return MIME_NO_ERROR; } + + /*-------------------------------------------------------------------* * MIME_Reader_Close() * * Close MIME reader *-------------------------------------------------------------------*/ -MIME_ERROR MIME_Reader_Close( MIME_HANDLE *phMIME ) + +MIME_ERROR MIME_Reader_Close( + MIME_HANDLE *phMIME ) { if ( phMIME == NULL || *phMIME == NULL ) { diff --git a/lib_util/rtpdump.c b/lib_util/rtpdump.c index ac143bb8f622da3759734c8e9e693d3d747595b2..9b25633a9385f57d14922a659a9bfe932a5dd1d4 100644 --- a/lib_util/rtpdump.c +++ b/lib_util/rtpdump.c @@ -80,11 +80,7 @@ static unsigned char *parseByte( unsigned char *buffer, unsigned char *value ) static int readLong( FILE *file, unsigned int *value ) { char buffer[4] = { 0 }; -#ifdef CODE_IMPROVEMENTS if ( fread( buffer, 1, 4, file ) != 1U ) -#else - if ( fread( buffer, 4, 1, file ) != 1U ) -#endif { return -1; } diff --git a/lib_util/tinywavein_c.h b/lib_util/tinywavein_c.h index 179c676a81b274098fabbe5050c2c977572c82ec..1ff6f26bb78438b2fbb835e483f99c1d46128dce 100644 --- a/lib_util/tinywavein_c.h +++ b/lib_util/tinywavein_c.h @@ -54,22 +54,14 @@ #define __TWI_SUCCESS ( 0 ) #define __TWI_ERROR ( -1 ) -#ifdef CODE_IMPROVEMENTS typedef struct tinyWaveInHandle -#else -typedef struct __tinyWaveInHandle -#endif { FILE *theFile; fpos_t dataChunkPos; uint32_t position; uint32_t length; uint32_t bps; -#ifdef CODE_IMPROVEMENTS } tinyWaveInHandle, WAVEFILEIN; -#else -} __tinyWaveInHandle, WAVEFILEIN; -#endif typedef struct { diff --git a/lib_util/tinywaveout_c.h b/lib_util/tinywaveout_c.h index e7d568dc83c48adf46dc0fcbb3dff7f20fdcaa5c..190bc5eb50ccf2cd1904dec576fe1af9d423e585 100644 --- a/lib_util/tinywaveout_c.h +++ b/lib_util/tinywaveout_c.h @@ -70,27 +70,15 @@ #endif #endif -#ifdef CODE_IMPROVEMENTS typedef struct tinyWaveOutHeader -#else -typedef struct __tinyWaveOutHeader -#endif { uint32_t riffType; /* 'RIFF' */ uint32_t riffSize; /* file size */ uint32_t waveType; /* 'WAVE' */ -#ifdef CODE_IMPROVEMENTS } tinyWaveOutHeader; -#else -} __tinyWaveOutHeader; -#endif -#ifdef CODE_IMPROVEMENTS typedef struct tinyWaveOutFmtChunk -#else -typedef struct __tinyWaveOutFmtChunk -#endif { uint32_t formatType; uint32_t formatSize; @@ -103,31 +91,15 @@ typedef struct __tinyWaveOutFmtChunk uint16_t bitsPerSample; /* wav fmt ext hdr here */ -#ifdef CODE_IMPROVEMENTS } tinyWaveOutFmtChunk; -#else -} __tinyWaveOutFmtChunk; -#endif -#ifdef CODE_IMPROVEMENTS -typedef struct tinyWaveOutDataChunk -#else typedef struct tinyWaveOutDataChunk -#endif { uint32_t dataType; uint32_t dataSize; -#ifdef CODE_IMPROVEMENTS } tinyWaveOutDataChunk; -#else -} __tinyWaveOutDataChunk; -#endif -#ifdef CODE_IMPROVEMENTS typedef struct tinyWaveOutHandle -#else -typedef struct __tinyWaveOutHandle -#endif { FILE *theFile; uint32_t dataSize; @@ -136,11 +108,7 @@ typedef struct __tinyWaveOutHandle uint32_t dataChunkOffset; uint32_t bps; uint32_t clipCount; -#ifdef CODE_IMPROVEMENTS } tinyWaveOutHandle, WAVEFILEOUT; -#else -} __tinyWaveOutHandle, WAVEFILEOUT; -#endif /*--- local protos --------------------------------------------------*/ static __inline uint32_t BigEndian32( char, char, char, char ); @@ -163,15 +131,9 @@ static WAVEFILEOUT *CreateBWF( /* ,const uint32_t writeWaveExt */ ) { WAVEFILEOUT *self; -#ifdef CODE_IMPROVEMENTS tinyWaveOutHeader whdr; tinyWaveOutFmtChunk wfch; tinyWaveOutDataChunk wdch; -#else - __tinyWaveOutHeader whdr; - __tinyWaveOutFmtChunk wfch; - __tinyWaveOutDataChunk wdch; -#endif uint32_t blockAlignment = 0; uint32_t ByteCnt = 0; /* Byte counter for fwrite */