From 10f83c6d12e95a566e17905b502d161afb5f006a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Oct 2022 09:53:40 +0200 Subject: [PATCH 1/7] [cleanup] accept FIX_I106_TDREND_5MS --- lib_com/ivas_cnst.h | 2 - lib_com/ivas_prot.h | 13 --- lib_com/options.h | 1 - lib_dec/ivas_objectRenderer.c | 155 --------------------------- lib_dec/ivas_objectRenderer_hrFilt.c | 38 ------- lib_dec/ivas_objectRenderer_sfx.c | 16 --- 6 files changed, 225 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index b75fdeca54..a83611c025 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -842,9 +842,7 @@ typedef enum { *----------------------------------------------------------------------------------*/ // VE: this should be renamed to e.g. N_SPATIAL_SUBFRAMES #define MAX_PARAM_SPATIAL_SUBFRAMES 4 /* Maximum number of subframes for parameteric spatial coding */ -#ifdef FIX_I106_TDREND_5MS #define L_SPATIAL_SUBFR_48k (L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES) -#endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 60f44e22a3..ace66b1a23 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -4956,21 +4956,12 @@ void TDREND_HRFILT_SetFiltSet( #endif ivas_error TDREND_REND_RenderSourceHRFilt( -#ifdef FIX_I106_TDREND_5MS TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ -#else - const TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ -#endif #ifdef TDREND_HRTF_TABLE_METHODS BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ #endif -#ifdef FIX_I106_TDREND_5MS float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ const int16_t subframe_length, /* i : Subframe length in use */ -#else - float output_buf[][L_FRAME48k], /* o : Output buffer */ - const int16_t output_frame, /* i : Output frame length in use */ -#endif const int32_t output_Fs /* i : Output sample rate */ ); @@ -5110,11 +5101,7 @@ void TDREND_SFX_SpatBin_SetParams( void TDREND_SFX_SpatBin_Execute_Main( SFX_SpatBin_t *SfxSpatBin_p, /* i/o: Spatial parameters handle */ const float *InBuffer_p, /* i : Input buffer */ -#ifdef FIX_I106_TDREND_5MS const int16_t subframe_length, /* i : subframe length */ -#else - const int16_t output_frame, /* i : frame length */ -#endif float *LeftOutBuffer_p, /* o : Rendered left channel */ float *RightOutBuffer_p, /* o : Rendered right channel */ int16_t *NoOfUsedInputSamples_p, /* o : Number of input samples actually used */ diff --git a/lib_com/options.h b/lib_com/options.h index fbfcb6f08d..4aab5d6b28 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ #define SPAR_SCALING_HARMONIZATION /* Issue 80: Changes to harmonize scaling in spar */ #define FIX_I98_HANDLES_TO_NULL /* Issue 98: do the setting of all handles to NULL in one place */ #define FIX_I102_SWB_TBE_SWITCH /* Issue 102: avoid IO->SWB switching code for IVAS, generate SHB ACB mem with lerp in case of switch */ -#define FIX_I106_TDREND_5MS /* Issue 106: 5 ms update rate in TD object renderer */ #define ALIGN_SID_SIZE /* Issue 111: make all DTX modes use one SID frame bitrate (5.2 kbps) */ #define FIX_135_MDCT_STEREO_MODE_UNINITIALIZED /* Issue 135: fix uninitialized value usage in SBA MDCT-Stereo core with PLC */ #define FIX_CONTROLLABLE_SID_UPDATE_RATE /* Issue 117: fix controllable SID update rate mechanism */ diff --git a/lib_dec/ivas_objectRenderer.c b/lib_dec/ivas_objectRenderer.c index f4df437487..f74a25d1da 100644 --- a/lib_dec/ivas_objectRenderer.c +++ b/lib_dec/ivas_objectRenderer.c @@ -46,16 +46,10 @@ * Local function prototypes *---------------------------------------------------------------------*/ -#ifdef FIX_I106_TDREND_5MS static ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, float output[][L_FRAME48k], const int16_t subframe_length, const int32_t output_Fs, const int16_t subframe_idx ); -#else -static ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, float output[][L_FRAME48k], const int16_t output_frame, const int32_t output_Fs ); -#endif static void TDREND_Clear_Update_flags( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd ); -#ifdef FIX_I106_TDREND_5MS static void TDREND_Update_listener_orientation( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, const int16_t headRotEnabled, const Quaternion *headPosition ); static void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, const int16_t numSources, const IVAS_FORMAT in_format, const ISM_METADATA_HANDLE *hIsmMetaData, float output[][L_FRAME48k] ); -#endif /*---------------------------------------------------------------------* * ivas_td_binaural_open() @@ -227,120 +221,20 @@ void ObjRenderIVASFrame( const int16_t output_frame /* i : output frame length */ ) { -#ifndef FIX_I106_TDREND_5MS - TDREND_DirAtten_t *DirAtten_p; - int16_t nS; - float Pos[3]; - float Dir[3]; - float FrontVec[3]; - float UpVec[3]; - float Rmat[3][3]; - int16_t c_indx; -#else int16_t subframe_length; -#endif int16_t subframe_idx; float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; -#ifdef FIX_I106_TDREND_5MS subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#else - DirAtten_p = st_ivas->hBinRendererTd->DirAtten_p; - - /* Update the listener's location/orientation */ - /* Listener at the origin */ - Pos[0] = 0.0f; - Pos[1] = 0.0f; - Pos[2] = 0.0f; - - if ( st_ivas->hHeadTrackData != NULL ) - { - /* Obtain head rotation matrix */ - QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[0], Rmat ); - /* Apply rotation matrix to looking vector [1;0;0] */ - FrontVec[0] = Rmat[0][0]; - FrontVec[1] = Rmat[0][1]; - FrontVec[2] = Rmat[0][2]; - /* Apply rotation matrix to up vector [0;0;1] */ - UpVec[0] = Rmat[2][0]; - UpVec[1] = Rmat[2][1]; - UpVec[2] = Rmat[2][2]; - } - else - { - /* Oriented with looking vector along the x axis */ - FrontVec[0] = 1.0f; - FrontVec[1] = 0.0f; - FrontVec[2] = 0.0f; - /* Oriented with up vector along the z axis */ - UpVec[0] = 0.0f; - UpVec[1] = 0.0f; - UpVec[2] = 1.0f; - } - - /* Set the listener position and orientation:*/ - TDREND_MIX_LIST_SetPos( st_ivas->hBinRendererTd, Pos ); - TDREND_MIX_LIST_SetOrient( st_ivas->hBinRendererTd, FrontVec, UpVec ); - - /* For each source, write the frame data to the source object*/ - c_indx = 0; - for ( nS = 0; nS < st_ivas->nchan_transport; nS++ ) - { - if ( !( st_ivas->ivas_format == MC_FORMAT && nS == LFE_CHANNEL ) ) /* Skip LFE for MC */ - { - st_ivas->hBinRendererTd->Sources[c_indx]->InputFrame_p = output[nS]; - st_ivas->hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; - c_indx++; - } - - if ( st_ivas->ivas_format == ISM_FORMAT ) - { - - /* Update the source positions */ - /* Source position and direction */ - Pos[0] = cosf( st_ivas->hIsmMetaData[nS]->elevation * PI_OVER_180 ) * cosf( st_ivas->hIsmMetaData[nS]->azimuth * PI_OVER_180 ); - Pos[1] = cosf( st_ivas->hIsmMetaData[nS]->elevation * PI_OVER_180 ) * sinf( st_ivas->hIsmMetaData[nS]->azimuth * PI_OVER_180 ); - Pos[2] = sinf( st_ivas->hIsmMetaData[nS]->elevation * 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( st_ivas->hBinRendererTd, nS, Pos ); - TDREND_MIX_SRC_SetDir( st_ivas->hBinRendererTd, nS, Dir ); - TDREND_MIX_SRC_SetDirAtten( st_ivas->hBinRendererTd, nS, DirAtten_p ); - TDREND_MIX_SRC_SetPlayState( st_ivas->hBinRendererTd, nS, TDREND_PLAYSTATUS_PLAYING ); - } - } -#endif if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ { -#ifdef FIX_I106_TDREND_5MS if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on && ( st_ivas->ini_frame == 0 ) ) { ivas_reverb_open( &st_ivas->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); } -#else - if ( st_ivas->hRenderConfig->roomAcoustics.late_reverb_on ) - { - if ( st_ivas->ini_frame == 0 ) - { - ivas_reverb_open( &st_ivas->hCrend->hReverb, st_ivas->transport_config, NULL, st_ivas->hRenderConfig, st_ivas->hDecoderConfig->output_Fs ); - } - for ( subframe_idx = 0; subframe_idx < 4; subframe_idx++ ) - { - ivas_reverb_process( st_ivas->hCrend->hReverb, st_ivas->transport_config, 0, output, reverb_signal, subframe_idx ); - } - } -#endif } -#ifdef FIX_I106_TDREND_5MS /* Update object position(s) */ TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, st_ivas->ivas_format, st_ivas->hIsmMetaData, output ); @@ -359,10 +253,6 @@ void ObjRenderIVASFrame( /* Render subframe */ TDREND_GetMix( st_ivas->hBinRendererTd, output, subframe_length, st_ivas->hDecoderConfig->output_Fs, subframe_idx ); } -#else - /* Call the renderer */ - TDREND_GetMix( st_ivas->hBinRendererTd, output, output_frame, st_ivas->hDecoderConfig->output_Fs ); -#endif if ( st_ivas->hRenderConfig != NULL ) /* Renderer Configuration not enabled in TD standalone renderer */ { @@ -378,30 +268,17 @@ void ObjRenderIVASFrame( } -#ifdef FIX_I106_TDREND_5MS /*---------------------------------------------------------------------* * TDREND_GetMix() * * Render one 5 ms subframe from the mixer *---------------------------------------------------------------------*/ -#else -/*---------------------------------------------------------------------* - * TDREND_GetMix() - * - * Render one output frame from the mixer - *---------------------------------------------------------------------*/ -#endif static ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ float output[][L_FRAME48k], /* i/o: ISm object synth / rendered output in 0,1 */ -#ifdef FIX_I106_TDREND_5MS const int16_t subframe_length, /* i/o: subframe length */ const int32_t output_Fs, /* i : Output sampling rate */ const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#else - const int16_t output_frame, /* i/o: Output frame length */ - const int32_t output_Fs /* i : Output sampling rate */ -#endif ) { int16_t i; @@ -409,22 +286,12 @@ static ivas_error TDREND_GetMix( TDREND_SRC_SPATIAL_t *SrcSpatial_p; TDREND_SRC_REND_t *SrcRend_p; ivas_error error; -#ifdef FIX_I106_TDREND_5MS float output_buf[2][L_SPATIAL_SUBFR_48k]; /* Temp buffer for left/right rendered signal */ -#else - float output_buf[2][L_FRAME48k]; /* Temp buffer for left/right rendered signal */ -#endif error = IVAS_ERR_OK; -#ifdef FIX_I106_TDREND_5MS /* Clear the output buffer to accumulate rendered sources */ set_f( output_buf[0], 0.0f, subframe_length ); set_f( output_buf[1], 0.0f, subframe_length ); -#else - /* Zero out the output buffer since objects are accumulated. */ - set_f( output_buf[0], 0.0f, output_frame ); - set_f( output_buf[1], 0.0f, output_frame ); -#endif /* Create the mix */ /* Loop through the source list and render each source */ @@ -443,39 +310,19 @@ static ivas_error TDREND_GetMix( /* Render source if needed */ if ( ( SrcRend_p->InputAvailable == TRUE ) && ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) ) { -#ifdef FIX_I106_TDREND_5MS #ifdef TDREND_HRTF_TABLE_METHODS error = TDREND_REND_RenderSourceHRFilt( Src_p, hBinRendererTd, output_buf, subframe_length, output_Fs ); #else error = TDREND_REND_RenderSourceHRFilt( Src_p, output_buf, subframe_length, output_Fs ); -#endif -#else -#ifdef TDREND_HRTF_TABLE_METHODS - error = TDREND_REND_RenderSourceHRFilt( Src_p, hBinRendererTd, output_buf, output_frame, output_Fs ); -#else - error = TDREND_REND_RenderSourceHRFilt( Src_p, output_buf, output_frame, output_Fs ); -#endif #endif } -#ifndef FIX_I106_TDREND_5MS - SrcRend_p->InputAvailable = FALSE; -#endif } /* Populate output variable */ -#ifdef FIX_I106_TDREND_5MS mvr2r( output_buf[0], output[0] + subframe_idx * subframe_length, subframe_length ); /* Left */ mvr2r( output_buf[1], output[1] + subframe_idx * subframe_length, subframe_length ); /* Right */ -#else - mvr2r( output_buf[0], output[0], output_frame ); /* Left */ - mvr2r( output_buf[1], output[1], output_frame ); /* Right */ -#endif -#ifdef FIX_I106_TDREND_5MS /* Clear the PoseUpdated and Source position update flags */ -#else - /* Clear the mixer update flags */ -#endif TDREND_Clear_Update_flags( hBinRendererTd ); return error; @@ -504,7 +351,6 @@ static void TDREND_Clear_Update_flags( return; } -#ifdef FIX_I106_TDREND_5MS /*---------------------------------------------------------------------* * TDREND_Update_object_positions() * @@ -620,4 +466,3 @@ static void TDREND_Update_listener_orientation( return; } -#endif diff --git a/lib_dec/ivas_objectRenderer_hrFilt.c b/lib_dec/ivas_objectRenderer_hrFilt.c index 404be200e2..e04c5f3716 100644 --- a/lib_dec/ivas_objectRenderer_hrFilt.c +++ b/lib_dec/ivas_objectRenderer_hrFilt.c @@ -343,42 +343,21 @@ void TDREND_HRFILT_SetFiltSet( --------------------------------------------------------------------*/ ivas_error TDREND_REND_RenderSourceHRFilt( -#ifdef FIX_I106_TDREND_5MS TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ -#else - const TDREND_SRC_t *Src_p, /* i/o: The source to be rendered */ -#endif #ifdef TDREND_HRTF_TABLE_METHODS BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ #endif -#ifdef FIX_I106_TDREND_5MS float output_buf[][L_SPATIAL_SUBFR_48k], /* o : Output buffer */ const int16_t subframe_length, /* i : Subframe length in use */ -#else - float output_buf[][L_FRAME48k], /* o : Output buffer */ - const int16_t output_frame, /* i : Output frame length in use */ -#endif const int32_t output_Fs /* i : Output sample rate */ ) { TDREND_SRC_REND_t *SrcRend_p; -#ifdef FIX_I106_TDREND_5MS const float *InFrame_nIC_p; -#else - int16_t nS; - float *InFrame_nIC_p; -#endif int16_t NoOfUsedInputSamples, NoOfDeliveredOutputSamples; -#ifdef FIX_I106_TDREND_5MS float LeftOutputFrame[L_SPATIAL_SUBFR_48k]; float RightOutputFrame[L_SPATIAL_SUBFR_48k]; -#else - float LeftOutputFrame[L_FRAME48k]; - float RightOutputFrame[L_FRAME48k]; - float *LeftOutputFrame_p, *RightOutputFrame_p; - float *LeftAccOutputFrame_p, *RightAccOutputFrame_p; -#endif /* Input channel rendering loop */ InFrame_nIC_p = Src_p->InputFrame_p; @@ -388,11 +367,7 @@ ivas_error TDREND_REND_RenderSourceHRFilt( /* SrcGain = Mix_p->Gain * ( *SrcRend_p->SrcGain_p ); */ /* SrcGain *= ( *SrcRend_p->DirGain_p ) * ( *SrcRend_p->DistGain_p ); */ -#ifdef FIX_I106_TDREND_5MS TDREND_SFX_SpatBin_Execute_Main( SrcRend_p->SfxSpatBin_p, InFrame_nIC_p, subframe_length, LeftOutputFrame, RightOutputFrame, &NoOfUsedInputSamples, &NoOfDeliveredOutputSamples, output_Fs ); -#else - TDREND_SFX_SpatBin_Execute_Main( SrcRend_p->SfxSpatBin_p, InFrame_nIC_p, output_frame, LeftOutputFrame, RightOutputFrame, &NoOfUsedInputSamples, &NoOfDeliveredOutputSamples, output_Fs ); -#endif #ifdef TDREND_HRTF_TABLE_METHODS if ( hBinRendererTd->HrFiltSet_p->FilterMethod != TDREND_HRFILT_Method_BSplineModel ) @@ -402,24 +377,11 @@ ivas_error TDREND_REND_RenderSourceHRFilt( #endif /* Copy to accumulative output frame */ -#ifdef FIX_I106_TDREND_5MS v_add( LeftOutputFrame, output_buf[0], output_buf[0], subframe_length ); v_add( RightOutputFrame, output_buf[1], output_buf[1], subframe_length ); Src_p->InputFrame_p += subframe_length; /* Increment input pointer -- todo: should we remove this and input the current subframe instead? */ -#else - LeftOutputFrame_p = LeftOutputFrame; - RightOutputFrame_p = RightOutputFrame; - LeftAccOutputFrame_p = output_buf[0]; - RightAccOutputFrame_p = output_buf[1]; - - for ( nS = 0; nS < output_frame; nS++ ) - { - *LeftAccOutputFrame_p++ += *LeftOutputFrame_p++; - *RightAccOutputFrame_p++ += *RightOutputFrame_p++; - } -#endif return IVAS_ERR_OK; diff --git a/lib_dec/ivas_objectRenderer_sfx.c b/lib_dec/ivas_objectRenderer_sfx.c index 442091db0f..bd54a767ae 100644 --- a/lib_dec/ivas_objectRenderer_sfx.c +++ b/lib_dec/ivas_objectRenderer_sfx.c @@ -930,11 +930,7 @@ static void TDREND_SFX_SpatBin_UpdateParams( void TDREND_SFX_SpatBin_Execute_Main( SFX_SpatBin_t *SfxSpatBin_p, /* i/o: Spatial parameters struct */ const float *InBuffer_p, /* i : Input buffer */ -#ifdef FIX_I106_TDREND_5MS const int16_t subframe_length, /* i : subframe length */ -#else - const int16_t output_frame, /* i : frame length */ -#endif float *LeftOutBuffer_p, /* o : Rendered left channel */ float *RightOutBuffer_p, /* o : Rendered right channel */ int16_t *NoOfUsedInputSamples_p, /* o : Number of input samples actually used */ @@ -952,11 +948,7 @@ void TDREND_SFX_SpatBin_Execute_Main( /* Make sure the blocks are not longer than 6 msec. */ NoOfBlocks = 1; -#ifdef FIX_I106_TDREND_5MS TempNoOfRequestedOutputSamples = subframe_length; -#else - TempNoOfRequestedOutputSamples = output_frame; -#endif while ( TempNoOfRequestedOutputSamples > SfxSpatBin_p->MaxBlockLength ) { NoOfBlocks = NoOfBlocks << 1; @@ -970,11 +962,7 @@ void TDREND_SFX_SpatBin_Execute_Main( RightOutBufferPointer_p = RightOutBuffer_p; *NoOfUsedInputSamples_p = 0; *NoOfDeliveredOutputSamples_p = 0; -#ifdef FIX_I106_TDREND_5MS TempNoOfInputSamples = subframe_length; -#else - TempNoOfInputSamples = output_frame; -#endif for ( i = 0; i < NoOfBlocks; i++ ) { @@ -1003,11 +991,7 @@ void TDREND_SFX_SpatBin_Execute_Main( if ( i == NoOfBlocks - 2 ) { /* The last block should produce the remaining number of samples */ -#ifdef FIX_I106_TDREND_5MS TempNoOfRequestedOutputSamples = subframe_length - *NoOfDeliveredOutputSamples_p; -#else - TempNoOfRequestedOutputSamples = output_frame - *NoOfDeliveredOutputSamples_p; -#endif } *NoOfUsedInputSamples_p = *NoOfUsedInputSamples_p + TempNoOfUsedInputSamples; TempNoOfInputSamples = TempNoOfInputSamples - TempNoOfUsedInputSamples; -- GitLab From c51973f837346df46a32bab90cdf2f12a86f617a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Oct 2022 09:55:56 +0200 Subject: [PATCH 2/7] [cleanup] accept ALIGN_SID_SIZE --- lib_com/bitstream.c | 28 ---------------- lib_com/ivas_cnst.h | 10 ------ lib_com/ivas_dirac_com.c | 12 ------- lib_com/ivas_prot.h | 7 ---- lib_com/ivas_rom_com.c | 4 --- lib_com/ivas_spar_com.c | 12 ------- lib_com/ivas_stereo_dft_com.c | 4 --- lib_com/ivas_tools.c | 5 --- lib_com/options.h | 1 - lib_dec/acelp_core_dec.c | 4 --- lib_dec/core_switching_dec.c | 4 --- lib_dec/fd_cng_dec.c | 6 ---- lib_dec/ivas_cpe_dec.c | 40 ---------------------- lib_dec/ivas_dec.c | 8 ----- lib_dec/ivas_dirac_dec.c | 48 --------------------------- lib_dec/ivas_init_dec.c | 47 -------------------------- lib_dec/ivas_ism_metadata_dec.c | 8 ----- lib_dec/ivas_ism_param_dec.c | 8 ----- lib_dec/ivas_masa_dec.c | 32 ------------------ lib_dec/ivas_output_init.c | 4 --- lib_dec/ivas_qmetadata_dec.c | 14 -------- lib_dec/ivas_sba_dec.c | 8 ----- lib_dec/ivas_sce_dec.c | 12 ------- lib_dec/ivas_spar_decoder.c | 16 --------- lib_dec/ivas_spar_md_dec.c | 4 --- lib_dec/ivas_stereo_cng_dec.c | 18 ---------- lib_dec/ivas_stereo_dft_dec.c | 40 ---------------------- lib_dec/ivas_stereo_mdct_stereo_dec.c | 20 ----------- lib_dec/ivas_stereo_switching_dec.c | 24 -------------- lib_dec/lib_dec.c | 4 --- lib_enc/fd_cng_enc.c | 2 -- lib_enc/ivas_cpe_enc.c | 20 ----------- lib_enc/ivas_dirac_enc.c | 2 -- lib_enc/ivas_ism_enc.c | 4 --- lib_enc/ivas_qmetadata_enc.c | 36 -------------------- lib_enc/ivas_sce_enc.c | 8 ----- lib_enc/ivas_stereo_cng_enc.c | 6 ---- lib_enc/ivas_stereo_dft_enc.c | 8 ----- 38 files changed, 538 deletions(-) diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 9ee771fb6b..9662a4cf4b 100644 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -1820,11 +1820,7 @@ ivas_error preview_indices( break; } } -#ifdef ALIGN_SID_SIZE else if ( total_brate == IVAS_SID_5k2 ) -#else - else if ( total_brate == IVAS_SID_4k4 ) -#endif { /* read SID format */ st_ivas->sid_format = 0; @@ -1888,16 +1884,6 @@ ivas_error preview_indices( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } } -#ifndef ALIGN_SID_SIZE - else if ( total_brate == IVAS_SID_5k ) - { - /* SBA SID frame */ - st_ivas->sid_format = SID_SBA_1TC; - st_ivas->ivas_format = SBA_FORMAT; - st_ivas->sba_mode = SBA_MODE_SPAR; - st_ivas->element_mode_init = IVAS_SCE; - } -#endif /* only read element mode from active frames */ if ( is_DTXrate( total_brate ) == 0 ) @@ -2072,19 +2058,7 @@ ivas_error read_indices( } else if ( k == SIZE_IVAS_BRATE_TBL ) { -#ifdef ALIGN_SID_SIZE return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) in the G.192 frame ! Exiting ! \n", total_brate ); -#else - /*temp change for SPAR DTX*/ - if ( total_brate == IVAS_SID_5k ) - { - st_ivas->element_mode_init = -1; - } - else - { - return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error, illegal bitrate (%d) in the G.192 frame ! Exiting ! \n", total_brate ); - } -#endif } else { @@ -2978,7 +2952,6 @@ void evs_dec_previewFrame( } -#ifdef ALIGN_SID_SIZE void dtx_read_padding_bits( DEC_CORE_HANDLE st, int16_t num_bits ) @@ -2990,6 +2963,5 @@ void dtx_read_padding_bits( get_next_indice( st, num_bits ); st->total_brate = tmp; } -#endif #undef WMC_TOOL_MAN diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index a83611c025..df8bdf9827 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -197,12 +197,7 @@ typedef enum /*----------------------------------------------------------------------------------* * IVAS Bitrates *----------------------------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE #define IVAS_SID_5k2 5200 /* SID frame bitrate */ -#else -#define IVAS_SID_4k4 4400 /* SID frame bitrate */ -#define IVAS_SID_5k 5000 /* SBA SID frame bitrate */ -#endif #define IVAS_13k2 13200 #define IVAS_16k4 16400 #define IVAS_24k4 24400 @@ -220,13 +215,8 @@ typedef enum #define IVAS_BRATE_MAX IVAS_512k -#ifdef ALIGN_SID_SIZE #define SIZE_IVAS_BRATE_TBL 16 #define IVAS_NUM_ACTIVE_BRATES (SIZE_IVAS_BRATE_TBL - 2) -#else -#define SIZE_IVAS_BRATE_TBL 17 -#define IVAS_NUM_ACTIVE_BRATES (SIZE_IVAS_BRATE_TBL - 3) -#endif /*----------------------------------------------------------------------------------* * IVAS modes : IVAS SCE, IVAS CPE modes (DFT, TD, MDCT stereo) diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index fe344e6423..5acc473b6a 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -337,11 +337,7 @@ ivas_error ivas_dirac_sba_config( if ( sba_mode == SBA_MODE_SPAR ) { /*map the bitrate for SID frame*/ -#ifdef ALIGN_SID_SIZE if ( sba_total_brate == IVAS_SID_5k2 ) -#else - if ( sba_total_brate == IVAS_SID_5k ) -#endif { if ( *element_mode == IVAS_SCE ) { @@ -438,11 +434,7 @@ ivas_error ivas_dirac_sba_config( return error; } -#ifdef ALIGN_SID_SIZE if ( sba_total_brate > IVAS_SID_5k2 ) -#else - if ( sba_total_brate > IVAS_SID_4k4 ) -#endif { #ifdef HARMONIZE_SBA_NCHAN_TRANSPORT *nchan_transport = ivas_get_sba_num_TCs( sba_total_brate, sba_order ); @@ -450,11 +442,7 @@ ivas_error ivas_dirac_sba_config( *nchan_transport = ivas_dirac_getNumTransportChannels( sba_total_brate, sba_order, sba_planar ); #endif } -#ifdef ALIGN_SID_SIZE else if ( sba_total_brate == IVAS_SID_5k2 ) -#else - else if ( sba_total_brate == IVAS_SID_4k4 ) -#endif { switch ( *element_mode ) { diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index ace66b1a23..a7f5987e38 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -2782,12 +2782,7 @@ void reset_metadata_spatial( int32_t *total_brate, /* o : total bitrate */ const int32_t core_brate, /* i : core bitrate */ const int16_t nb_bits_metadata, /* i : number of meatdata bits */ -#ifndef ALIGN_SID_SIZE - const SBA_MODE sba_mode, /* i : SBA mode */ - const int16_t element_mode /* i : element mode */ -#else const SBA_MODE sba_mode /* i : SBA mode */ -#endif ); /*! r: number of bits written */ @@ -5481,10 +5476,8 @@ float rand_triangular_signed( /* clang-format on */ -#ifdef ALIGN_SID_SIZE void dtx_read_padding_bits( DEC_CORE_HANDLE st, int16_t num_bits ); -#endif #endif /* IVAS_PROT_H */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 4a82259296..4169e4ee92 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -49,11 +49,7 @@ const int32_t ivas_brate_tbl[SIZE_IVAS_BRATE_TBL] = { -#ifdef ALIGN_SID_SIZE FRAME_NO_DATA, IVAS_SID_5k2, -#else - FRAME_NO_DATA, IVAS_SID_4k4, IVAS_SID_5k, -#endif IVAS_13k2, IVAS_16k4, IVAS_24k4, IVAS_32k, IVAS_48k, IVAS_64k, IVAS_80k, IVAS_96k, IVAS_128k, IVAS_160k, IVAS_192k, IVAS_256k, IVAS_384k, IVAS_512k diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index ce4e742401..f7fc0e3e26 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -311,11 +311,7 @@ void ivas_spar_config( const int16_t sid_format /* i : IVAS format indicator from SID frame */ ) { -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 ) -#else - if ( ivas_total_brate == IVAS_SID_5k ) -#endif { if ( sid_format == SID_SBA_1TC ) { @@ -341,11 +337,7 @@ void ivas_spar_config( if ( *nchan_transport == 1 ) { /* map SPAR SID bitrate to SPAR active bitrate */ -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 ) -#else - if ( ivas_total_brate == IVAS_SID_5k ) -#endif { ivas_total_brate = IVAS_32k; } @@ -445,11 +437,7 @@ int16_t ivas_get_spar_num_TCs( { int16_t table_idx, nchan_transport; -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 ) -#else - if ( ivas_total_brate == IVAS_SID_5k ) -#endif { nchan_transport = 1; } diff --git a/lib_com/ivas_stereo_dft_com.c b/lib_com/ivas_stereo_dft_com.c index 7de3144f63..2b889dde0a 100644 --- a/lib_com/ivas_stereo_dft_com.c +++ b/lib_com/ivas_stereo_dft_com.c @@ -82,11 +82,7 @@ void stereo_dft_config( hConfig->res_cod_mode = STEREO_DFT_RES_COD_OFF; } } -#ifdef ALIGN_SID_SIZE else if ( brate == IVAS_SID_5k2 ) -#else - else if ( brate == IVAS_SID_4k4 ) -#endif { *bits_frame_nominal = SID_2k40 / FRAMES_PER_SEC; if ( hConfig != NULL ) diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index 6b0c0eb297..9594bf5900 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -1172,12 +1172,7 @@ int16_t is_SIDrate( if ( ( ivas_total_brate == SID_1k75 ) || ( ivas_total_brate == SID_2k40 ) || -#ifdef ALIGN_SID_SIZE ( ivas_total_brate == IVAS_SID_5k2 ) ) -#else - ( ivas_total_brate == IVAS_SID_4k4 ) || - ( ivas_total_brate == IVAS_SID_5k ) ) -#endif { sid_rate_flag = 1; } diff --git a/lib_com/options.h b/lib_com/options.h index 4aab5d6b28..65132ff19c 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ #define SPAR_SCALING_HARMONIZATION /* Issue 80: Changes to harmonize scaling in spar */ #define FIX_I98_HANDLES_TO_NULL /* Issue 98: do the setting of all handles to NULL in one place */ #define FIX_I102_SWB_TBE_SWITCH /* Issue 102: avoid IO->SWB switching code for IVAS, generate SHB ACB mem with lerp in case of switch */ -#define ALIGN_SID_SIZE /* Issue 111: make all DTX modes use one SID frame bitrate (5.2 kbps) */ #define FIX_135_MDCT_STEREO_MODE_UNINITIALIZED /* Issue 135: fix uninitialized value usage in SBA MDCT-Stereo core with PLC */ #define FIX_CONTROLLABLE_SID_UPDATE_RATE /* Issue 117: fix controllable SID update rate mechanism */ #define FIX_DIRAC_CHANNELS /* Issue 71: lower number of DirAC analysis channels */ diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index a890623fbf..e15951d7f3 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -125,11 +125,7 @@ ivas_error acelp_core_dec( error = IVAS_ERR_OK; -#ifdef ALIGN_SID_SIZE if ( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_5k2 ) -#else - if ( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_4k4 ) -#endif { /* In MDCT-Stereo DTX with mono output, we can skip CNG for the second channel, except for the first inactive frame following an active period */ return error; diff --git a/lib_dec/core_switching_dec.c b/lib_dec/core_switching_dec.c index e8c74bc2ef..8762f20ac3 100644 --- a/lib_dec/core_switching_dec.c +++ b/lib_dec/core_switching_dec.c @@ -1048,11 +1048,7 @@ void bw_switching_pre_proc( if ( st->element_mode > EVS_MONO ) { -#ifdef ALIGN_SID_SIZE if ( st->core == ACELP_CORE && !( st->bfi == 1 && st->con_tcx == 1 ) && st->hBWE_FD != NULL && !( st->core_brate <= SID_2k40 && st->element_mode == IVAS_CPE_DFT && nchan_out == 2 ) && !( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_5k2 ) ) -#else - if ( st->core == ACELP_CORE && !( st->bfi == 1 && st->con_tcx == 1 ) && st->hBWE_FD != NULL && !( st->core_brate <= SID_2k40 && st->element_mode == IVAS_CPE_DFT && nchan_out == 2 ) && !( st->element_mode == IVAS_CPE_MDCT && nchan_out == 1 && st->idchan == 1 && last_element_brate <= IVAS_SID_4k4 ) ) -#endif { /* Calculate tilt of the ACELP core synthesis - needed in SWB BWE decoding */ calc_tilt_bwe( old_syn_12k8_16k, &st->tilt_wb, st->L_frame ); diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index 85d82d953c..faaa37b52c 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -2081,9 +2081,7 @@ void FdCngDecodeMDCTStereoSID( msvq_dec( cdk_37bits_ivas, NULL, NULL, stages, N, FD_CNG_maxN_37bits, indices, ms_ptr[ch], NULL ); } -#ifdef ALIGN_SID_SIZE dtx_read_padding_bits( sts[1], ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC ); -#endif if ( sts[0]->hFdCngDec->hFdCngCom->no_side_flag ) { @@ -2108,11 +2106,7 @@ void FdCngDecodeMDCTStereoSID( lpc_from_spectrum( hFdCngCom, hFdCngCom->startBand, hFdCngCom->stopFFTbin, sts[ch]->preemph_fac ); } -#ifdef ALIGN_SID_SIZE if ( hCPE->nchan_out == 1 && hCPE->last_element_brate <= IVAS_SID_5k2 ) -#else - if ( hCPE->nchan_out == 1 && hCPE->last_element_brate <= IVAS_SID_4k4 ) -#endif { /* create proper M noise shape in channel zero after gains have been applied */ for ( p = 0; p < N; p++ ) diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index da0911ee5b..692d0bcc1a 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -160,22 +160,14 @@ ivas_error ivas_cpe_dec( if ( hCPE->element_mode != IVAS_CPE_MDCT && ( hCPE->element_brate != hCPE->last_element_brate || hCPE->last_element_mode != hCPE->element_mode || sts[0]->ini_frame == 0 || ( ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) ) { -#ifdef ALIGN_SID_SIZE if ( st_ivas->hQMetaData != NULL && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( st_ivas->hQMetaData != NULL && ivas_total_brate > IVAS_SID_4k4 ) -#endif { stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, st_ivas->hQMetaData->bits_frame_nominal * FRAMES_PER_SEC, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } else { /* Note: This only works for stereo operation. If DTX would be applied for multiple CPEs a different bitrate signaling is needed */ -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate <= IVAS_SID_5k2 ) -#else - if ( ivas_total_brate <= IVAS_SID_4k4 ) -#endif { stereo_dft_config( hCPE->hStereoDft == NULL ? NULL : hCPE->hStereoDft->hConfig, ivas_total_brate, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); } @@ -211,11 +203,7 @@ ivas_error ivas_cpe_dec( /* Update DFT Stereo memories */ stereo_dft_dec_update( hCPE->hStereoDft, output_frame, 0 ); -#ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_5k2 ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_4k4 ) -#endif { if ( ivas_total_brate == FRAME_NO_DATA ) { @@ -232,21 +220,13 @@ ivas_error ivas_cpe_dec( nb_bits = (int16_t) ( ( hCPE->element_brate ) / FRAMES_PER_SEC - 0.8f * sts[0]->bits_frame_nominal ); sts[1]->bit_stream = sts[0]->bit_stream + ivas_total_brate / FRAMES_PER_SEC - 1 - nb_bits_metadata; -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 ) -#else - if ( ivas_total_brate == IVAS_SID_4k4 ) -#endif { nb_bits -= SID_FORMAT_NBITS; sts[1]->bit_stream -= SID_FORMAT_NBITS; } -#ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ivas_total_brate > IVAS_SID_4k4 ) -#endif { sts[0]->total_brate = hCPE->element_brate; /* Only mono downmix was transmitted in this case */ } @@ -286,11 +266,7 @@ ivas_error ivas_cpe_dec( /* this is just for initialization, the true values of "total_brate" and "bits_frame_channel" are set later */ for ( n = 0; n < n_channels; n++ ) { -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 ) -#else - if ( ivas_total_brate == IVAS_SID_4k4 || ivas_total_brate == IVAS_SID_5k ) -#endif { sts[n]->total_brate = SID_2k40; @@ -307,11 +283,7 @@ ivas_error ivas_cpe_dec( if ( !st_ivas->hMCT ) { -#ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == SBA_FORMAT && ivas_total_brate == IVAS_SID_5k2 ) -#else - if ( st_ivas->ivas_format == SBA_FORMAT && ivas_total_brate == IVAS_SID_5k ) -#endif { for ( n = 0; n < n_channels; n++ ) { @@ -615,11 +587,7 @@ ivas_error create_cpe_dec( hCPE->nchan_out = min( CPE_CHANNELS, st_ivas->hDecoderConfig->nchan_out ); } -#ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_4k4 ) -#endif { hCPE->nchan_out = 1; } @@ -961,11 +929,7 @@ static void read_stereo_mode_and_bwidth( * BFI or NO_DATA frame: Use stereo parameters from last (active) frame *-----------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE if ( st_ivas->bfi || st_ivas->hDecoderConfig->ivas_total_brate < IVAS_SID_5k2 ) -#else - if ( st_ivas->bfi || st_ivas->hDecoderConfig->ivas_total_brate < IVAS_SID_4k4 ) -#endif { hCPE->element_mode = hCPE->last_element_mode; @@ -975,11 +939,7 @@ static void read_stereo_mode_and_bwidth( * SID frame: get element mode from SID side info *-----------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE else if ( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) -#else - else if ( st_ivas->hDecoderConfig->ivas_total_brate == IVAS_SID_4k4 || st_ivas->hDecoderConfig->ivas_total_brate == IVAS_SID_5k ) -#endif { switch ( st_ivas->sid_format ) { diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 7d54047014..5d3a5a10f9 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -290,11 +290,7 @@ ivas_error ivas_dec( nchan_remapped = CPE_CHANNELS; ivas_sba_dirac_stereo_dec( st_ivas, output, output_frame ); } -#ifdef ALIGN_SID_SIZE 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 ) ) ) -#else - else if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ( ivas_total_brate > IVAS_SID_4k4 || ( ivas_total_brate <= IVAS_SID_4k4 && st_ivas->nCPE > 0 && st_ivas->hCPE[0]->nchan_out == 1 ) ) ) -#endif { nchan_remapped = 1; /* Only one channel transported */ } @@ -574,11 +570,7 @@ ivas_error ivas_dec( st_ivas->ini_frame++; } -#ifdef ALIGN_SID_SIZE if ( st_ivas->ini_active_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) && ivas_total_brate > IVAS_SID_5k2 ) /* needed in MASA decoder in case the first active frame is BFI, and there were SID-frames decoded before */ -#else - if ( st_ivas->ini_active_frame < MAX_FRAME_COUNTER && !( st_ivas->bfi && st_ivas->ini_frame == 0 ) && ivas_total_brate > IVAS_SID_4k4 ) /* needed in MASA decoder in case the first active frame is BFI, and there were SID-frames decoded before */ -#endif { st_ivas->ini_active_frame++; } diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index ef4527ea8f..ae7ab88b94 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -190,11 +190,7 @@ ivas_error ivas_dirac_dec_config( } nchan_transport = st_ivas->nchan_transport; -#ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT && ivas_total_brate < MASA_STEREO_MIN_BITRATE && ivas_total_brate > IVAS_SID_4k4 ) -#endif { nchan_transport = 1; } @@ -1287,11 +1283,7 @@ void ivas_dirac_dec_read_BS( int16_t next_bit_pos_orig; *nb_bits = 0; -#ifdef ALIGN_SID_SIZE if ( !st->bfi && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( !st->bfi && ivas_total_brate > IVAS_SID_4k4 ) -#endif { next_bit_pos_orig = st->next_bit_pos; st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); @@ -1300,19 +1292,7 @@ void ivas_dirac_dec_read_BS( b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; -#ifndef ALIGN_SID_SIZE - if ( sba_mode == SBA_MODE_SPAR ) - { - - if ( ivas_total_brate == IVAS_SID_5k ) - { - b = 1; - } - } - else -#else if ( sba_mode != SBA_MODE_SPAR ) -#endif { assert( ( b == 0 ) || ( hQMetaData->q_direction[0].cfg.start_band > 0 ) ); } @@ -1400,23 +1380,17 @@ void ivas_dirac_dec_read_BS( st->next_bit_pos = next_bit_pos_orig; } -#ifdef ALIGN_SID_SIZE else if ( !st->bfi && ivas_total_brate == IVAS_SID_5k2 ) -#else - else if ( !st->bfi && ivas_total_brate == IVAS_SID_4k4 ) -#endif { next_bit_pos_orig = st->next_bit_pos; /* subtract mode signaling bits, since bitstream was moved after mode reading */ st->next_bit_pos = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 - SID_FORMAT_NBITS ); -#ifdef ALIGN_SID_SIZE /* 1 bit flag for SPAR/DirAC, already read in read format function */ b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; hQMetaData->sba_inactive_mode = 1; orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; -#endif /* if we start with a SID frame, we need to init the azi/ele arrays.*/ if ( st->ini_frame == 0 ) @@ -1431,7 +1405,6 @@ void ivas_dirac_dec_read_BS( } } -#ifdef ALIGN_SID_SIZE *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, sba_mode ); if ( sba_mode == SBA_MODE_SPAR ) @@ -1458,11 +1431,6 @@ void ivas_dirac_dec_read_BS( { *nb_bits += SID_FORMAT_NBITS; } -#else - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, SBA_MODE_DIRAC ); - - *nb_bits += SID_FORMAT_NBITS; -#endif st->next_bit_pos = next_bit_pos_orig; @@ -1509,11 +1477,7 @@ void ivas_qmetadata_to_dirac( q_direction = &( hQMetaData->q_direction[0] ); hDirAC->numSimultaneousDirections = hQMetaData->no_directions; -#ifdef ALIGN_SID_SIZE if ( hMasa != NULL && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( hMasa != NULL && ivas_total_brate > IVAS_SID_4k4 ) -#endif { band_mapping = hMasa->data.band_mapping; @@ -1589,11 +1553,7 @@ void ivas_qmetadata_to_dirac( nbands = hDirAC->band_grouping[hDirAC->hConfig->nbands]; band_grouping = hDirAC->band_grouping; -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate <= IVAS_SID_5k2 && sba_mode != SBA_MODE_SPAR ) -#else - if ( ivas_total_brate <= IVAS_SID_4k4 && sba_mode != SBA_MODE_SPAR ) -#endif { /* SID/zero-frame: 1 direction, 5 bands, nblocks re-generated out of SID decoder*/ start_band = 0; @@ -1689,11 +1649,7 @@ void ivas_qmetadata_to_dirac( ele = min( 90, ele ); ele = max( -90, ele ); -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) -#else - if ( ivas_total_brate > IVAS_SID_4k4 && q_direction->coherence_band_data != NULL ) -#endif { hDirAC->spreadCoherence[tmp_write_idx_band][b] = q_direction->coherence_band_data[qBand_idx].spread_coherence[block] / 255.0f; } @@ -1702,11 +1658,7 @@ void ivas_qmetadata_to_dirac( hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; } -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate > IVAS_SID_5k2 && q_direction->coherence_band_data != NULL ) -#else - if ( ivas_total_brate > IVAS_SID_4k4 && q_direction->coherence_band_data != NULL ) -#endif { hDirAC->surroundingCoherence[tmp_write_idx_band][b] = hQMetaData->surcoh_band_data[qBand_idx].surround_coherence[0] / 255.0f; } diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index f084b25b9b..d8e556550a 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -126,11 +126,7 @@ 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 ALIGN_SID_SIZE if ( st_ivas->ini_frame > 0 && ivas_total_brate != st_ivas->hDecoderConfig->last_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_4k4 ) -#endif { if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { @@ -162,11 +158,7 @@ ivas_error ivas_dec_setup( if ( st_ivas->ini_frame > 0 ) { /* reconfigure in case a change of operation mode is detected */ -#ifdef ALIGN_SID_SIZE if ( ( ivas_total_brate > IVAS_SID_5k2 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) -#else - if ( ( ivas_total_brate > IVAS_SID_4k4 && ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) || ( st_ivas->ini_active_frame == 0 ) ) -#endif { if ( st_ivas->ini_active_frame == 0 && ivas_total_brate != FRAME_NO_DATA && ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->nCPE == 1 ) { @@ -225,11 +217,7 @@ ivas_error ivas_dec_setup( } } } -#ifdef ALIGN_SID_SIZE else if ( ivas_total_brate == IVAS_SID_5k2 ) -#else - else if ( ivas_total_brate == IVAS_SID_4k4 || ivas_total_brate == IVAS_SID_5k ) -#endif { switch ( st_ivas->sid_format ) { @@ -365,11 +353,7 @@ static ivas_error ivas_read_format( break; } } -#ifdef ALIGN_SID_SIZE else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) -#else - else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_4k4 ) -#endif { /* read IVAS format in SID frame */ idx = 0; @@ -422,7 +406,6 @@ static ivas_error ivas_read_format( return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Invalid value %c found in SID format field.", st_ivas->sid_format ); } -#ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == SBA_FORMAT ) { int16_t tc_mode_offset; @@ -442,41 +425,11 @@ static ivas_error ivas_read_format( st_ivas->sba_mode = SBA_MODE_DIRAC; } } -#endif /* reset bitstream handle to avoid BER detection after reading the 2400 kbps for ch0 */ st_ivas->bit_stream += ( *num_bits_read ); ( *num_bits_read ) = 0; } -#ifndef ALIGN_SID_SIZE - else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k ) - { - int16_t tc_mode_offset; - tc_mode_offset = (int16_t) ( ivas_total_brate / FRAMES_PER_SEC - 1 ); - idx = st_ivas->bit_stream[tc_mode_offset]; - - // TBD: needs more work for HOA - if ( st_ivas->sba_analysis_order == 0 ) - { - st_ivas->sba_analysis_order = 1; - } - - if ( idx == 0 ) - { - st_ivas->sid_format = SID_SBA_1TC; - st_ivas->ivas_format = SBA_FORMAT; - st_ivas->sba_mode = SBA_MODE_SPAR; - st_ivas->element_mode_init = IVAS_SCE; - } - else - { - st_ivas->sid_format = SID_SBA_2TC; - st_ivas->ivas_format = SBA_FORMAT; - st_ivas->sba_mode = SBA_MODE_SPAR; - st_ivas->element_mode_init = IVAS_CPE_MDCT; - } - } -#endif else { /* In SID/NO_DATA frames, use the previous frame IVAS format */ diff --git a/lib_dec/ivas_ism_metadata_dec.c b/lib_dec/ivas_ism_metadata_dec.c index dee9b6489f..6b9f8ec8ba 100644 --- a/lib_dec/ivas_ism_metadata_dec.c +++ b/lib_dec/ivas_ism_metadata_dec.c @@ -78,11 +78,7 @@ ivas_error ivas_ism_metadata_dec( wmops_sub_start( "ism_meta_dec" ); -#ifdef ALIGN_SID_SIZE if ( ism_total_brate == IVAS_SID_5k2 || ism_total_brate == FRAME_NO_DATA ) -#else - if ( ism_total_brate == IVAS_SID_4k4 || ism_total_brate == FRAME_NO_DATA ) -#endif { /* no metadata decoding in CNG */ for ( ch = 0; ch < *nchan_transport; ch++ ) @@ -91,11 +87,7 @@ ivas_error ivas_ism_metadata_dec( } /* set padding bits as metadata bits to keep later bitrate checks valid */ -#ifdef ALIGN_SID_SIZE nb_bits_metadata[0] = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; -#else - nb_bits_metadata[0] = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC; -#endif #ifdef DEBUGGING /* sanity check */ diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index d394c3c729..be2b9eb350 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -1027,11 +1027,7 @@ ivas_error ivas_ism_dec_config( /* store last frame ISM mode */ last_ism_mode = st_ivas->ism_mode; -#ifdef ALIGN_SID_SIZE if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_5k2 && ivas_total_brate != FRAME_NO_DATA ) -#else - if ( !st_ivas->bfi && ivas_total_brate != IVAS_SID_4k4 && ivas_total_brate != FRAME_NO_DATA ) -#endif { /* select ISM format mode */ st_ivas->ism_mode = ivas_ism_mode_select( num_obj, ivas_total_brate ); @@ -1056,11 +1052,7 @@ ivas_error ivas_ism_dec_config( } } } -#ifdef ALIGN_SID_SIZE else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_5k2 ) -#else - else if ( !st_ivas->bfi && ivas_total_brate == IVAS_SID_4k4 ) -#endif { st_ivas->nchan_transport = num_obj; } diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index b4aa18f2a1..3df3784405 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -115,11 +115,7 @@ ivas_error ivas_masa_decode( *nb_bits_read = 0; next_bit_pos_orig = st->next_bit_pos; -#ifdef ALIGN_SID_SIZE if ( masa_brate == IVAS_SID_5k2 ) -#else - if ( masa_brate == IVAS_SID_4k4 ) -#endif { st->next_bit_pos = (int16_t) ( ( masa_brate / FRAMES_PER_SEC ) - 1 - SID_FORMAT_NBITS ); } @@ -128,11 +124,7 @@ ivas_error ivas_masa_decode( st->next_bit_pos = (int16_t) ( ( masa_brate / FRAMES_PER_SEC ) - 1 ); } -#ifdef ALIGN_SID_SIZE if ( !st->bfi && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( !st->bfi && ivas_total_brate > IVAS_SID_4k4 ) -#endif { if ( !( ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { @@ -224,11 +216,7 @@ ivas_error ivas_masa_decode( replicate_subframes( hQMetaData ); } } -#ifdef ALIGN_SID_SIZE else if ( !st->bfi && ivas_format == MASA_FORMAT && ivas_total_brate == IVAS_SID_5k2 ) -#else - else if ( !st->bfi && ivas_format == MASA_FORMAT && ivas_total_brate == IVAS_SID_4k4 ) -#endif { if ( hQMetaData->q_direction == NULL ) { @@ -241,11 +229,7 @@ ivas_error ivas_masa_decode( ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, hQMetaData, &st_ivas->element_mode_init, &st_ivas->nSCE, &st_ivas->nCPE ); -#ifdef ALIGN_SID_SIZE hQMetaData->metadata_max_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC; -#else - hQMetaData->metadata_max_bits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC; -#endif if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, 5, 1, 0 ) ) != IVAS_ERR_OK ) { @@ -301,11 +285,7 @@ ivas_error ivas_masa_decode( { st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = ivas_total_brate < MASA_STEREO_MIN_BITRATE ? 1 : 0; -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate <= IVAS_SID_5k2 ) -#else - if ( ivas_total_brate <= IVAS_SID_4k4 ) -#endif { st_ivas->hCPE[0]->hStereoDft->hConfig->force_mono_transmission = 0; } @@ -315,19 +295,11 @@ ivas_error ivas_masa_decode( { st_ivas->hCPE[0]->hCoreCoder[0]->masa_sid_format = 0; -#ifdef ALIGN_SID_SIZE if ( st_ivas->hDecoderConfig->last_ivas_total_brate <= IVAS_SID_5k2 ) -#else - if ( st_ivas->hDecoderConfig->last_ivas_total_brate <= IVAS_SID_4k4 ) -#endif { st_ivas->hCPE[0]->hCoreCoder[0]->masa_sid_format = 1; -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate >= IVAS_SID_5k2 ) -#else - if ( ivas_total_brate >= IVAS_SID_4k4 ) -#endif { st_ivas->hCPE[0]->element_brate = ivas_total_brate; } @@ -507,11 +479,7 @@ void ivas_masa_prerender( const int16_t output_frame /* i : output frame length per channel */ ) { -#ifdef ALIGN_SID_SIZE if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_4k4 ) -#endif { if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { diff --git a/lib_dec/ivas_output_init.c b/lib_dec/ivas_output_init.c index b7af932861..307b29e74a 100644 --- a/lib_dec/ivas_output_init.c +++ b/lib_dec/ivas_output_init.c @@ -526,11 +526,7 @@ void ivas_renderer_select( { *renderer_type = RENDERER_DISABLE; } -#ifdef ALIGN_SID_SIZE else if ( ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_5k2 ) ) -#else - else if ( ( st_ivas->ivas_format == MASA_FORMAT && output_config == AUDIO_CONFIG_MONO && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE && st_ivas->hDecoderConfig->ivas_total_brate > IVAS_SID_4k4 ) ) -#endif { *renderer_type = RENDERER_DISABLE; } diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index 15f33799d6..059ba752e7 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -721,32 +721,20 @@ int16_t ivas_qmetadata_dec_sid_decode( { if ( sba_mode == SBA_MODE_SPAR ) { -#ifdef ALIGN_SID_SIZE /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ -#else - metadata_sid_bits = (int16_t) ( IVAS_SID_5k - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * 18 ) - 1; /* -1 for inactive mode header bit*/ -#endif } else { /* keep 13.2 and 16.4 sid bitrate as 4.4 kbps for now*/ -#ifdef ALIGN_SID_SIZE /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#else - metadata_sid_bits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#endif } } else { -#ifdef ALIGN_SID_SIZE /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#else - metadata_sid_bits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#endif } start_index = *index; @@ -865,7 +853,6 @@ int16_t ivas_qmetadata_dec_sid_decode( } } } -#ifdef ALIGN_SID_SIZE /* TODO: temporary hack to keep BE */ if ( ivas_format == SBA_FORMAT ) { @@ -878,7 +865,6 @@ int16_t ivas_qmetadata_dec_sid_decode( { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } -#endif /*Read filling bits*/ while ( start_index - *index < metadata_sid_bits ) diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 9090588b55..a17ae8a977 100644 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -564,11 +564,7 @@ ivas_error ivas_sba_dec_reconfigure( } } -#ifdef ALIGN_SID_SIZE if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && ( last_ivas_total_brate > IVAS_SID_5k2 || nchan_transport != nchan_transport_old ) && ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) -#else - if ( st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && ( last_ivas_total_brate > IVAS_SID_4k4 || nchan_transport != nchan_transport_old ) && ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) -#endif { if ( st_ivas->hDirAC != NULL ) { @@ -940,11 +936,7 @@ ivas_error ivas_sba_dec_reconfigure( } /* special case, if the decoder goes from 1TC DTX to 2TC active frame (in case the bitstream started with an SBA SID frame), allocate DTX memories */ -#ifdef ALIGN_SID_SIZE if ( last_ivas_total_brate <= IVAS_SID_5k2 && st_ivas->nCPE >= 1 ) -#else - if ( last_ivas_total_brate <= IVAS_SID_4k4 && st_ivas->nCPE >= 1 ) -#endif { if ( ( error = initMdctStereoDtxData( st_ivas->hCPE[0] ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index b24d60505b..5756e1bef7 100644 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -82,11 +82,7 @@ ivas_error ivas_sce_dec( *-----------------------------------------------------------------*/ /* set total_brate - needed in DTX */ -#ifdef ALIGN_SID_SIZE if ( !st_ivas->bfi && ( ivas_total_brate == IVAS_SID_5k2 ) ) -#else - if ( !st_ivas->bfi && ( ivas_total_brate == IVAS_SID_4k4 || ivas_total_brate == IVAS_SID_5k ) ) -#endif { st->total_brate = ivas_total_brate - nb_bits_metadata * FRAMES_PER_SEC; assert( st->total_brate == SID_2k40 && "SCE SID must be 2.4kbps!" ); @@ -95,11 +91,7 @@ ivas_error ivas_sce_dec( { st->total_brate = ivas_total_brate; } -#ifdef ALIGN_SID_SIZE else if ( !st_ivas->bfi && ( last_ivas_total_brate <= SID_2k40 || last_ivas_total_brate == IVAS_SID_5k2 ) ) -#else - else if ( !st_ivas->bfi && ( last_ivas_total_brate <= SID_2k40 || last_ivas_total_brate == IVAS_SID_4k4 ) ) -#endif { st->total_brate = hSCE->element_brate - nb_bits_metadata * FRAMES_PER_SEC; } @@ -169,11 +161,7 @@ ivas_error ivas_sce_dec( } /* set "total_brate" */ -#ifdef ALIGN_SID_SIZE if ( !st_ivas->bfi && ( ivas_total_brate == IVAS_SID_5k2 ) ) -#else - if ( !st_ivas->bfi && ( ivas_total_brate == IVAS_SID_4k4 || ivas_total_brate == IVAS_SID_5k ) ) -#endif { st->total_brate = ivas_total_brate - nb_bits_metadata * FRAMES_PER_SEC; } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c index 2e48c11745..c7a3fcff20 100644 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -241,12 +241,10 @@ ivas_error ivas_spar_dec( next_bit_pos_orig = st0->next_bit_pos; last_bit_pos = (int16_t) ( ( hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC ) - 1 ); -#ifdef ALIGN_SID_SIZE if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) { last_bit_pos -= SID_FORMAT_NBITS; } -#endif nb_bits_read_orig = *nb_bits_read; last_bit_pos -= nb_bits_read_orig; @@ -266,7 +264,6 @@ ivas_error ivas_spar_dec( st0->bit_stream = bit_stream_orig; st0->next_bit_pos = next_bit_pos_orig; -#ifdef ALIGN_SID_SIZE if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) { int16_t zero_pad_bits; @@ -275,7 +272,6 @@ ivas_error ivas_spar_dec( assert( zero_pad_bits <= 1 ); *nb_bits_read += zero_pad_bits; } -#endif wmops_sub_end(); @@ -645,11 +641,7 @@ static void ivas_spar_dec_MD( if ( ivas_total_brate > FRAME_NO_DATA && !bfi ) { -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( ivas_total_brate > IVAS_SID_5k ) -#endif { ivas_parse_spar_header( hDecoderConfig->ivas_total_brate, sba_order, st0, &table_idx ); @@ -683,11 +675,7 @@ static void ivas_spar_dec_MD( * Read AGC bits *---------------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate > IVAS_SID_5k2 && !bfi && hSpar->hMdDec->dtx_vad ) -#else - if ( ivas_total_brate > IVAS_SID_5k && !bfi && hSpar->hMdDec->dtx_vad ) -#endif { hSpar->AGC_flag = get_next_indice( st0, 1 ); @@ -698,11 +686,7 @@ static void ivas_spar_dec_MD( * MD smoothing *---------------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE if ( st0->m_old_frame_type == ZERO_FRAME && ivas_total_brate == IVAS_SID_5k2 && st0->prev_bfi == 0 && hSpar->hMdDec->spar_md_cfg.nchan_transport == 1 ) -#else - if ( st0->m_old_frame_type == ZERO_FRAME && ivas_total_brate == IVAS_SID_5k && st0->prev_bfi == 0 && hSpar->hMdDec->spar_md_cfg.nchan_transport == 1 ) -#endif { ivas_spar_setup_md_smoothing( hSpar->hMdDec, num_bands_out ); } diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c index c0682c58a2..2c8d31ecc0 100644 --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -1444,11 +1444,7 @@ static void ivas_spar_dec_parse_md_bs( if ( hMdDec->spar_md_cfg.gen_bs == 1 ) { -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( ivas_total_brate > IVAS_SID_5k ) -#endif { if ( hMdDec->spar_md_cfg.quant_strat_bits > 0 ) { diff --git a/lib_dec/ivas_stereo_cng_dec.c b/lib_dec/ivas_stereo_cng_dec.c index 491a88da3f..58b0eae86d 100644 --- a/lib_dec/ivas_stereo_cng_dec.c +++ b/lib_dec/ivas_stereo_cng_dec.c @@ -90,12 +90,8 @@ void stereo_dft_dec_sid_coh( int16_t bits_tmp; int16_t b; -#ifdef ALIGN_SID_SIZE /* TODO: still use old number of bits to keep bitexactness in output */ nr_of_sid_stereo_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#else - nr_of_sid_stereo_bits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#endif /* If the coherence is not encoded due to lack of bits set alpha to zero which leads to that the coherence */ /* from the previous frame is used. */ @@ -178,9 +174,7 @@ void stereo_dft_dec_sid_coh( ( *nb_bits )++; } -#ifdef ALIGN_SID_SIZE dtx_read_padding_bits( st, ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC ); -#endif return; } @@ -661,17 +655,9 @@ void stereo_dtf_cng( hCPE->hStereoCng->nr_dft_frames++; } -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate <= IVAS_SID_5k2 ) -#else - if ( ivas_total_brate <= IVAS_SID_4k4 ) -#endif { -#ifdef ALIGN_SID_SIZE if ( hCPE->hStereoCng->nr_sid_frames < SID_INIT && ivas_total_brate == IVAS_SID_5k2 ) -#else - if ( hCPE->hStereoCng->nr_sid_frames < SID_INIT && ivas_total_brate == IVAS_SID_4k4 ) -#endif { hCPE->hStereoCng->nr_sid_frames++; } @@ -723,11 +709,7 @@ void stereo_cng_dec_update( if ( hCPE->element_mode == IVAS_CPE_DFT ) { -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 || ivas_total_brate == FRAME_NO_DATA ) -#else - if ( ivas_total_brate == IVAS_SID_4k4 || ivas_total_brate == FRAME_NO_DATA ) -#endif { hCPE->hStereoCng->prev_sid_nodata = 1; } diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index b0db814511..503c7e88f2 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1746,11 +1746,7 @@ void stereo_dft_dec_read_BS( * Initialization *-----------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 ) -#else - if ( ivas_total_brate == IVAS_SID_4k4 ) -#endif { if ( ivas_format == MASA_FORMAT ) { @@ -1764,11 +1760,7 @@ void stereo_dft_dec_read_BS( hStereoDft->frame_nodata = 0; hStereoDft->frame_sid_nodata = 1; hStereoDft->frame_sid = 1; -#ifdef ALIGN_SID_SIZE *nb_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#else - *nb_bits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#endif } } else if ( ivas_total_brate == FRAME_NO_DATA ) @@ -1811,11 +1803,7 @@ void stereo_dft_dec_read_BS( k_offset = STEREO_DFT_OFFSET; N_div = STEREO_DFT_NBDIV; -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( ivas_total_brate > IVAS_SID_4k4 ) -#endif { mvr2r( hStereoDft->side_gain + 2 * STEREO_DFT_BAND_MAX, sg_tmp, STEREO_DFT_BAND_MAX ); mvr2r( hStereoDft->res_pred_gain + 2 * STEREO_DFT_BAND_MAX, res_pred_gain_tmp, STEREO_DFT_BAND_MAX ); @@ -1905,11 +1893,7 @@ void stereo_dft_dec_read_BS( fprintf( pF, "ITD: %d ", hStereoDft->hConfig->itd_mode ); #endif -#ifdef ALIGN_SID_SIZE if ( !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_5k2 ) ) -#else - if ( !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_4k4 ) ) -#endif { /*------------------------------------------------------------------* * read Side gains @@ -1990,11 +1974,7 @@ void stereo_dft_dec_read_BS( #endif } } -#ifdef ALIGN_SID_SIZE else if ( *nb_bits <= ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - STEREO_DFT_ITD_MODE_NBITS - STEREO_DFT_SID_ITD_NBITS - 1 - SID_FORMAT_NBITS ) ) -#else - else if ( *nb_bits <= ( ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - STEREO_DFT_ITD_MODE_NBITS - STEREO_DFT_SID_ITD_NBITS - 1 - SID_FORMAT_NBITS ) ) -#endif { itd_mode = get_next_indice( st, STEREO_DFT_ITD_MODE_NBITS ); ( *nb_bits ) += STEREO_DFT_ITD_MODE_NBITS; /*ITD mode flag: 1bit*/ @@ -2036,11 +2016,7 @@ void stereo_dft_dec_read_BS( stereo_dft_dequantize_ipd( &ind1_ipd[0], hStereoDft->gipd + ( k + k_offset ), 1, STEREO_DFT_GIPD_NBITS ); } } -#ifdef ALIGN_SID_SIZE else if ( *nb_bits <= ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - STEREO_DFT_FLAG_BITS - STEREO_DFT_SID_GIPD_NBITS - SID_FORMAT_NBITS ) ) -#else - else if ( *nb_bits <= ( ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - STEREO_DFT_FLAG_BITS - STEREO_DFT_SID_GIPD_NBITS - SID_FORMAT_NBITS ) ) -#endif { /* SID frame, only read IPD only if enough bits left in bitstream */ hStereoDft->no_ipd_flag = st->bit_stream[nb]; @@ -2201,11 +2177,7 @@ void stereo_dft_dec_read_BS( #endif } -#ifdef ALIGN_SID_SIZE if ( !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_5k2 ) ) -#else - if ( !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_4k4 ) ) -#endif { if ( hStereoDft->side_gain_flag_1 != 2 ) { @@ -2213,11 +2185,7 @@ void stereo_dft_dec_read_BS( } } -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( ivas_total_brate > IVAS_SID_4k4 ) -#endif { hStereoDft->recovery_flg = stereo_dft_sg_recovery( hStereoDft ); @@ -2284,20 +2252,12 @@ void stereo_dft_dec_read_BS( #endif } -#ifdef ALIGN_SID_SIZE if ( hStereoDft->frame_sid && !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_5k2 ) ) -#else - if ( hStereoDft->frame_sid && !( ivas_format == MASA_FORMAT && ivas_total_brate <= IVAS_SID_4k4 ) ) -#endif { stereo_dft_dec_sid_coh( st, hStereoDft->nbands, coh, nb_bits ); } -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate == IVAS_SID_5k2 && ivas_format != MASA_FORMAT ) -#else - if ( ivas_total_brate == IVAS_SID_4k4 && ivas_format != MASA_FORMAT ) -#endif { *nb_bits = (int16_t) ( ( element_brate - SID_2k40 ) / FRAMES_PER_SEC ); /* => hCPE->hCoreCoder[0]->total_brate = SID_2k40; */ } diff --git a/lib_dec/ivas_stereo_mdct_stereo_dec.c b/lib_dec/ivas_stereo_mdct_stereo_dec.c index 10b9688be2..46f2f0d73f 100644 --- a/lib_dec/ivas_stereo_mdct_stereo_dec.c +++ b/lib_dec/ivas_stereo_mdct_stereo_dec.c @@ -559,21 +559,13 @@ void updateBuffersForDmxMdctStereo( sts[1] = hCPE->hCoreCoder[1]; /* synch buffers for inactive frames, but not for transition frames */ -#ifdef ALIGN_SID_SIZE if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) -#else - if ( hCPE->last_element_brate <= IVAS_SID_4k4 ) -#endif { mvr2r( output[0], output[1], output_frame ); mvr2r( synth[0], synth[1], output_frame ); } -#ifdef ALIGN_SID_SIZE if ( hCPE->element_brate == IVAS_SID_5k2 && hCPE->last_element_brate > IVAS_SID_5k2 ) -#else - if ( hCPE->element_brate == IVAS_SID_4k4 && hCPE->last_element_brate > IVAS_SID_4k4 ) -#endif { /* in the first SID frame after an active frame, create mid noise shape here, in SID frames that follow inactive frames, it is done directly in the SID decoding since the mid shape is being used in CNG then */ for ( int16_t p = 0; p < sts[0]->hFdCngDec->hFdCngCom->npart; p++ ) @@ -583,11 +575,7 @@ void updateBuffersForDmxMdctStereo( } /* for transition of active->inactive frame, apply passive downmix on buffers */ -#ifdef ALIGN_SID_SIZE if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) -#else - if ( hCPE->last_element_brate <= IVAS_SID_4k4 ) -#endif { delta = 1; if ( output_frame == L_FRAME16k ) @@ -653,21 +641,13 @@ void applyDmxMdctStereo( fade = 1.f; dmx_len = output_frame; -#ifdef ALIGN_SID_SIZE if ( hCPE->last_element_brate <= IVAS_SID_5k2 ) -#else - if ( hCPE->last_element_brate <= IVAS_SID_4k4 ) -#endif { crossfade_len = NS2SA( hCPE->hCoreCoder[0]->output_Fs, IVAS_DEC_DELAY_NS - DELAY_CLDFB_NS ); step /= crossfade_len; } /* for first inactive CNG frame after active decoding we have to do a fade-OUT FROM the passive DMX */ -#ifdef ALIGN_SID_SIZE else if ( hCPE->element_brate <= IVAS_SID_5k2 && hCPE->last_element_brate > IVAS_SID_5k2 ) -#else - else if ( hCPE->element_brate <= IVAS_SID_4k4 && hCPE->last_element_brate > IVAS_SID_4k4 ) -#endif { crossfade_len = output_frame / 4; step /= -crossfade_len; diff --git a/lib_dec/ivas_stereo_switching_dec.c b/lib_dec/ivas_stereo_switching_dec.c index 2e32b8e85a..4031a8cf4e 100644 --- a/lib_dec/ivas_stereo_switching_dec.c +++ b/lib_dec/ivas_stereo_switching_dec.c @@ -832,11 +832,7 @@ ivas_error stereo_memory_dec( if ( ivas_format == STEREO_FORMAT && hCPE->element_mode == IVAS_CPE_MDCT ) { -#ifdef ALIGN_SID_SIZE if ( hCPE->element_brate <= MAX_MDCT_ITD_BRATE && ivas_total_brate > IVAS_SID_5k2 ) -#else - if ( hCPE->element_brate <= MAX_MDCT_ITD_BRATE && ivas_total_brate > IVAS_SID_4k4 ) -#endif { if ( hCPE->hStereoMdct->use_itd == 0 ) { @@ -856,21 +852,13 @@ ivas_error stereo_memory_dec( else { /* de-allocate TCA data structure */ -#ifdef ALIGN_SID_SIZE if ( hCPE->hStereoMdct->use_itd == 1 && ivas_total_brate > IVAS_SID_5k2 && hCPE->hStereoTCA != NULL ) -#else - if ( hCPE->hStereoMdct->use_itd == 1 && ivas_total_brate > IVAS_SID_4k4 && hCPE->hStereoTCA != NULL ) -#endif { count_free( hCPE->hStereoTCA ); hCPE->hStereoTCA = NULL; hCPE->hStereoMdct->use_itd = 0; } -#ifdef ALIGN_SID_SIZE else if ( hCPE->hStereoMdct->use_itd == 1 && ivas_total_brate <= IVAS_SID_5k2 ) -#else - else if ( hCPE->hStereoMdct->use_itd == 1 && ivas_total_brate <= IVAS_SID_4k4 ) -#endif { hCPE->hStereoMdct->itd = 0.0f; } @@ -1023,11 +1011,7 @@ void synchro_synthesis( if ( use_cldfb_for_last_dft ) { -#ifdef ALIGN_SID_SIZE if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->last_element_mode == IVAS_CPE_TD && ( ivas_total_brate > IVAS_SID_5k2 || hCPE->nchan_out == 2 ) ) -#else - if ( hCPE->element_mode == IVAS_CPE_DFT && hCPE->last_element_mode == IVAS_CPE_TD && ( ivas_total_brate > IVAS_SID_4k4 || hCPE->nchan_out == 2 ) ) -#endif { stereo_tca_scale_R_channel( hCPE, output[0], output_frame ); } @@ -1365,11 +1349,7 @@ void stereo_switching_dec( mvr2r( hCPE->input_mem[n], hCPE->output_mem[n], dft32ms_ovl ); } -#ifdef ALIGN_SID_SIZE if ( ivas_total_brate > IVAS_SID_5k2 || n == 0 || hCPE->last_element_mode != IVAS_CPE_TD || hCPE->nchan_out == 1 ) -#else - if ( ivas_total_brate > IVAS_SID_4k4 || n == 0 || hCPE->last_element_mode != IVAS_CPE_TD || hCPE->nchan_out == 1 ) -#endif { for ( i = 0; i < dft32ms_ovl; i++ ) { @@ -1443,11 +1423,7 @@ void stereo_switching_dec( /* no secondary channel in the previous frame -> memory resets */ if ( hCPE->element_mode > IVAS_CPE_DFT && hCPE->last_element_mode == IVAS_CPE_DFT ) { -#ifdef ALIGN_SID_SIZE if ( hCPE->last_element_brate <= IVAS_SID_5k2 && hCPE->nchan_out == 2 ) -#else - if ( hCPE->last_element_brate <= IVAS_SID_4k4 && hCPE->nchan_out == 2 ) -#endif { /* reset CLDFB memories */ cldfb_reset_memory( sts[0]->cldfbAna ); diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index fa2bb2b763..b7f82edd2e 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -1131,11 +1131,7 @@ static bool isSidFrame( { return true; /* EVS SID */ } -#ifdef ALIGN_SID_SIZE else if ( size == IVAS_SID_5k2 / FRAMES_PER_SEC ) -#else - else if ( size == IVAS_SID_4k4 / FRAMES_PER_SEC ) -#endif { return true; /* IVAS SID */ } diff --git a/lib_enc/fd_cng_enc.c b/lib_enc/fd_cng_enc.c index 2f98addc8d..e9bb6c18e3 100644 --- a/lib_enc/fd_cng_enc.c +++ b/lib_enc/fd_cng_enc.c @@ -1130,10 +1130,8 @@ void FdCngEncodeMDCTStereoSID( push_indice( sts[ch]->hBstr, IND_ENERGY, gain_idx[ch], 7 ); } -#ifdef ALIGN_SID_SIZE /* pad with zeros to reach common SID frame size */ push_indice( sts[1]->hBstr, IND_ENERGY, 0, ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC ); -#endif return; } diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 08c45af220..d4f7eef648 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -453,11 +453,7 @@ ivas_error ivas_cpe_enc( { if ( hCPE->element_mode == IVAS_CPE_DFT || hCPE->element_mode == IVAS_CPE_TD ) { -#ifdef ALIGN_SID_SIZE reset_metadata_spatial( ivas_format, hCPE->hMetaData, hCPE->element_brate, &tmp, sts[0]->core_brate, nb_bits_metadata, st_ivas->sba_mode ); -#else - reset_metadata_spatial( ivas_format, hCPE->hMetaData, hCPE->element_brate, &tmp, sts[0]->core_brate, nb_bits_metadata, st_ivas->sba_mode, hCPE->element_mode ); -#endif } } @@ -469,11 +465,7 @@ ivas_error ivas_cpe_enc( /* Reset metadata */ if ( sts[0]->cng_sba_flag || ( ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) ) { -#ifdef ALIGN_SID_SIZE reset_metadata_spatial( ivas_format, hCPE->hMetaData, hCPE->element_brate, &tmp, sts[0]->core_brate, nb_bits_metadata, st_ivas->sba_mode ); -#else - reset_metadata_spatial( ivas_format, hCPE->hMetaData, hCPE->element_brate, &tmp, sts[0]->core_brate, nb_bits_metadata, st_ivas->sba_mode, hCPE->element_mode ); -#endif } } @@ -542,11 +534,7 @@ ivas_error ivas_cpe_enc( * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE if ( sts[0]->core_brate == SID_2k40 ) -#else - if ( sts[0]->core_brate == SID_2k40 && ( ivas_format != SBA_FORMAT || st_ivas->sba_mode != SBA_MODE_SPAR ) ) -#endif { ivas_write_format_sid( ivas_format, hCPE->element_mode, sts[0]->hBstr ); } @@ -565,11 +553,7 @@ ivas_error ivas_cpe_enc( /* Reconfigure DFT Stereo for inactive frames */ if ( sts[0]->core_brate == SID_2k40 ) { -#ifdef ALIGN_SID_SIZE stereo_dft_config( hCPE->hStereoDft->hConfig, IVAS_SID_5k2, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); -#else - stereo_dft_config( hCPE->hStereoDft->hConfig, IVAS_SID_4k4, &sts[0]->bits_frame_nominal, &sts[1]->bits_frame_nominal ); -#endif } else { @@ -613,11 +597,7 @@ ivas_error ivas_cpe_enc( if ( sts[0]->core_brate == FRAME_NO_DATA || sts[0]->core_brate == SID_2k40 ) { -#ifdef ALIGN_SID_SIZE assert( ( nb_bits <= ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS ) ) && "Stereo DFT CNG: bit budget is violated" ); -#else - assert( ( nb_bits <= ( ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS ) ) && "Stereo DFT CNG: bit budget is violated" ); -#endif } else { diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 9d5893622d..6ac3cff6fe 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -441,10 +441,8 @@ void ivas_dirac_enc( } else { -#ifdef ALIGN_SID_SIZE /*indicate whether SPAR or DiRAC mode*/ push_next_indice( hMetaData, 0, 1 ); -#endif /* encode SID parameters */ ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, SBA_MODE_DIRAC ); } diff --git a/lib_enc/ivas_ism_enc.c b/lib_enc/ivas_ism_enc.c index 2433c01802..33d552bb27 100644 --- a/lib_enc/ivas_ism_enc.c +++ b/lib_enc/ivas_ism_enc.c @@ -214,11 +214,7 @@ ivas_error ivas_ism_enc( ivas_write_format_sid( st_ivas->hEncoderConfig->ivas_format, IVAS_SCE, st->hBstr ); /* write unused bits */ -#ifdef ALIGN_SID_SIZE nBits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#else - nBits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#endif while ( nBits > 0 ) { i = min( nBits, 16 ); diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 6042c9e10a..ae4af46855 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -684,32 +684,20 @@ void ivas_qmetadata_enc_sid_encode( { if ( sba_mode == SBA_MODE_SPAR ) { -#ifdef ALIGN_SID_SIZE /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = (int16_t) ( 5000 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ -#else - metadata_sid_bits = (int16_t) ( IVAS_SID_5k - SID_2k40 ) / FRAMES_PER_SEC - ( SPAR_DTX_BANDS * SPAR_SID_BITS_TAR_PER_BAND ) - 1; /* -1 for inactive mode header bit*/ -#endif } else { /* keep 13.2 and 16.4 SID bitrate as 4.4 kbps for now*/ -#ifdef ALIGN_SID_SIZE /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#else - metadata_sid_bits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#endif } } else { -#ifdef ALIGN_SID_SIZE /* TODO: still use old sid frame size to keep bitexactness */ metadata_sid_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#else - metadata_sid_bits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#endif } #ifdef DEBUG_MODE_QMETADATA @@ -888,7 +876,6 @@ void ivas_qmetadata_enc_sid_encode( } #endif -#ifdef ALIGN_SID_SIZE /* TODO: temporary to keep BE */ if ( ivas_format == SBA_FORMAT ) { @@ -902,7 +889,6 @@ void ivas_qmetadata_enc_sid_encode( { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } -#endif /* fill bits*/ assert( ( hMetaData->nb_bits_tot - bit_pos_start ) <= metadata_sid_bits && "Too many written bits!" ); @@ -927,18 +913,11 @@ void reset_metadata_spatial( int32_t *total_brate, /* o : total bitrate */ const int32_t core_brate, /* i : core bitrate */ const int16_t nb_bits_metadata, /* i : number of meatdata bits */ -#ifndef ALIGN_SID_SIZE - const SBA_MODE sba_mode, /* i : SBA mode */ - const int16_t element_mode /* i : element mode */ -#else const SBA_MODE sba_mode /* i : SBA mode */ -#endif ) { int16_t i, next_ind_sid, last_ind_sid; -#ifdef ALIGN_SID_SIZE int16_t metadata_sid_bits; -#endif if ( core_brate == SID_2k40 || core_brate == FRAME_NO_DATA ) { @@ -947,23 +926,12 @@ void reset_metadata_spatial( if ( sba_mode == SBA_MODE_SPAR ) { assert( hMetaData->ind_list[0].nb_bits == 1 ); -#ifdef ALIGN_SID_SIZE hMetaData->ind_list[0].value = 1; metadata_sid_bits = (int16_t) ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; while ( hMetaData->nb_bits_tot < metadata_sid_bits ) { push_next_indice( hMetaData, 0, 1 ); /*fill bit*/ } -#else - if ( element_mode > IVAS_SCE ) - { - hMetaData->ind_list[0].value = 1; - } - else - { - hMetaData->ind_list[0].value = 0; - } -#endif } else { @@ -993,11 +961,7 @@ void reset_metadata_spatial( hMetaData->ind_list[i].nb_bits = -1; } hMetaData->last_ind = hMetaData->next_ind; -#ifdef ALIGN_SID_SIZE assert( ( hMetaData->nb_bits_tot == ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS ) && "Problem of SID metadata in SCE" ); -#else - assert( ( hMetaData->nb_bits_tot == ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS ) && "Problem of SID metadata in SCE" ); -#endif } } else diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 4a4c24fa4e..8b65c188d9 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -199,20 +199,12 @@ ivas_error ivas_sce_enc( * Reset metadata *----------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE reset_metadata_spatial( ivas_format, hSCE->hMetaData, hSCE->element_brate, &st->total_brate, st->core_brate, nb_bits_metadata, st_ivas->sba_mode ); -#else - reset_metadata_spatial( ivas_format, hSCE->hMetaData, hSCE->element_brate, &st->total_brate, st->core_brate, nb_bits_metadata, st_ivas->sba_mode, IVAS_SCE ); -#endif /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ -#ifdef ALIGN_SID_SIZE if ( st->core_brate == SID_2k40 ) -#else - if ( st->core_brate == SID_2k40 && ( ivas_format != SBA_FORMAT || st_ivas->sba_mode != SBA_MODE_SPAR ) ) -#endif { ivas_write_format_sid( ivas_format, IVAS_SCE, st->hBstr ); } diff --git a/lib_enc/ivas_stereo_cng_enc.c b/lib_enc/ivas_stereo_cng_enc.c index 9176f9ad2f..31f5e7c794 100644 --- a/lib_enc/ivas_stereo_cng_enc.c +++ b/lib_enc/ivas_stereo_cng_enc.c @@ -148,12 +148,8 @@ void stereo_dft_enc_sid_coh( int16_t alpha_level; int16_t n; -#ifdef ALIGN_SID_SIZE /* TODO: still use old number of bits to keep bitexactness in output */ nr_of_sid_stereo_bits = ( 4400 /*IVAS_SID_5k2*/ - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#else - nr_of_sid_stereo_bits = ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; -#endif zeropad = 0; /* Encode coherence vector. Find best fixed predictor by minimizing prediction error on input vector. @@ -308,9 +304,7 @@ void stereo_dft_enc_sid_coh( ( *nb_bits )++; } -#ifdef ALIGN_SID_SIZE push_next_indice( hBstr, zeropad, ( IVAS_SID_5k2 - 4400 ) / FRAMES_PER_SEC ); -#endif return; } diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 402003be6c..29e5d32c71 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -2317,11 +2317,7 @@ void stereo_dft_enc_write_BS( { stereo_dft_enc_sid_calc_coh( hStereoDft, hCPE->hStereoCng->coh_crossfade, &hCPE->hStereoCng->td_active, &hCPE->hStereoCng->first_SID, cohBand ); -#ifdef ALIGN_SID_SIZE if ( *nb_bits <= ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - STEREO_DFT_ITD_MODE_NBITS - STEREO_DFT_SID_ITD_NBITS - 1 ) ) -#else - if ( *nb_bits <= ( ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - STEREO_DFT_ITD_MODE_NBITS - STEREO_DFT_SID_ITD_NBITS - 1 ) ) -#endif { if ( hStereoDft->hItd->itd[k_offset] != 0 ) { @@ -2397,11 +2393,7 @@ void stereo_dft_enc_write_BS( nb += STEREO_DFT_GIPD_NBITS; } } -#ifdef ALIGN_SID_SIZE else if ( *nb_bits <= ( ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - STEREO_DFT_FLAG_BITS - STEREO_DFT_SID_GIPD_NBITS ) ) -#else - else if ( *nb_bits <= ( ( IVAS_SID_4k4 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - STEREO_DFT_FLAG_BITS - STEREO_DFT_SID_GIPD_NBITS ) ) -#endif { push_indice( hBstr, IND_STEREO_DFT_NO_IPD_FLAG, hStereoDft->no_ipd_flag, STEREO_DFT_FLAG_BITS ); nb += STEREO_DFT_FLAG_BITS; /*IPD mode flag: 1bit*/ -- GitLab From d63dc2ab5cdd49ac3049a31f2b09cfa5e3f0f305 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Oct 2022 09:57:03 +0200 Subject: [PATCH 3/7] [cleanup] accept FIX_135_MDCT_STEREO_MODE_UNINITIALIZED --- lib_com/options.h | 1 - lib_dec/ivas_cpe_dec.c | 2 -- lib_dec/ivas_stereo_mdct_core_dec.c | 7 ------- 3 files changed, 10 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 65132ff19c..fa0d1d5136 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ #define SPAR_SCALING_HARMONIZATION /* Issue 80: Changes to harmonize scaling in spar */ #define FIX_I98_HANDLES_TO_NULL /* Issue 98: do the setting of all handles to NULL in one place */ #define FIX_I102_SWB_TBE_SWITCH /* Issue 102: avoid IO->SWB switching code for IVAS, generate SHB ACB mem with lerp in case of switch */ -#define FIX_135_MDCT_STEREO_MODE_UNINITIALIZED /* Issue 135: fix uninitialized value usage in SBA MDCT-Stereo core with PLC */ #define FIX_CONTROLLABLE_SID_UPDATE_RATE /* Issue 117: fix controllable SID update rate mechanism */ #define FIX_DIRAC_CHANNELS /* Issue 71: lower number of DirAC analysis channels */ #define FIX_CREND_CHANNELS /* Issue 71: fix number of Crend channels */ diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c index 692d0bcc1a..8e5ec212aa 100644 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -791,12 +791,10 @@ ivas_error create_cpe_dec( set_s( hCPE->hStereoMdct->prev_ms_mask[0], 0, MAX_SFB ); set_s( hCPE->hStereoMdct->prev_ms_mask[1], 0, MAX_SFB ); hCPE->hStereoMdct->lastCoh = 1.f; -#ifdef FIX_135_MDCT_STEREO_MODE_UNINITIALIZED hCPE->hStereoMdct->mdct_stereo_mode[0] = SMDCT_DUAL_MONO; hCPE->hStereoMdct->mdct_stereo_mode[1] = SMDCT_DUAL_MONO; hCPE->hStereoMdct->IGFStereoMode[0] = -1; hCPE->hStereoMdct->IGFStereoMode[1] = -1; -#endif } /*-----------------------------------------------------------------* diff --git a/lib_dec/ivas_stereo_mdct_core_dec.c b/lib_dec/ivas_stereo_mdct_core_dec.c index beb121a1fc..41d514b205 100644 --- a/lib_dec/ivas_stereo_mdct_core_dec.c +++ b/lib_dec/ivas_stereo_mdct_core_dec.c @@ -218,13 +218,6 @@ void stereo_mdct_core_dec( initMdctStereoDecData( hCPE->hStereoMdct, sts[0]->igf, sts[0]->hIGFDec->igfData.igfInfo.grid, hCPE->element_brate, sts[0]->bwidth ); hCPE->hStereoMdct->isSBAStereoMode = ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( st_ivas->nchan_transport == 2 ) ); -#ifndef FIX_135_MDCT_STEREO_MODE_UNINITIALIZED - /*to prevent unitialized values during condition checks for stereo IGF*/ - if ( hCPE->hStereoMdct->isSBAStereoMode ) - { - set_s( hCPE->hStereoMdct->IGFStereoMode, -1, 2 ); - } -#endif if ( !bfi ) { -- GitLab From 1869f2e18a9bf261ad0f2e31d0e38739dc885ead Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Oct 2022 09:58:37 +0200 Subject: [PATCH 4/7] [cleanup] accept FIX_CONTROLLABLE_SID_UPDATE_RATE --- lib_com/options.h | 1 - lib_enc/fd_cng_enc.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index fa0d1d5136..ca3cee71bb 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -149,7 +149,6 @@ #define SPAR_SCALING_HARMONIZATION /* Issue 80: Changes to harmonize scaling in spar */ #define FIX_I98_HANDLES_TO_NULL /* Issue 98: do the setting of all handles to NULL in one place */ #define FIX_I102_SWB_TBE_SWITCH /* Issue 102: avoid IO->SWB switching code for IVAS, generate SHB ACB mem with lerp in case of switch */ -#define FIX_CONTROLLABLE_SID_UPDATE_RATE /* Issue 117: fix controllable SID update rate mechanism */ #define FIX_DIRAC_CHANNELS /* Issue 71: lower number of DirAC analysis channels */ #define FIX_CREND_CHANNELS /* Issue 71: fix number of Crend channels */ #define HARMONIZE_SBA_NCHAN_TRANSPORT /* harmonize setting of number of transport channels in SBA */ diff --git a/lib_enc/fd_cng_enc.c b/lib_enc/fd_cng_enc.c index e9bb6c18e3..e3a349b2ae 100644 --- a/lib_enc/fd_cng_enc.c +++ b/lib_enc/fd_cng_enc.c @@ -903,11 +903,9 @@ void stereoFdCngCoherence( sts[1]->core_brate = SID_2k40; } -#ifdef FIX_CONTROLLABLE_SID_UPDATE_RATE /* synchronize SID counters */ sts[0]->hDtxEnc->cnt_SID = min( sts[0]->hDtxEnc->cnt_SID, sts[1]->hDtxEnc->cnt_SID ); sts[1]->hDtxEnc->cnt_SID = sts[0]->hDtxEnc->cnt_SID; -#endif } pt_fftL = fft_buff[0]; -- GitLab From 4539535697a476a6a235f6e68774af548e9ff07a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Oct 2022 10:44:43 +0200 Subject: [PATCH 5/7] [cleanup] accept FIX_CREND_CHANNELS --- lib_com/ivas_cnst.h | 3 --- lib_com/options.h | 1 - lib_dec/ivas_crend.c | 12 ------------ lib_dec/ivas_reverb.c | 7 ------- lib_dec/ivas_stat_dec.h | 22 ---------------------- 5 files changed, 45 deletions(-) diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index df8bdf9827..02250e0f7f 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -165,9 +165,6 @@ typedef enum #define HEAD_ROTATION_HOA_ORDER 3 /* HOA 3rd order */ #define MAX_CICP_CHANNELS 16 /* max channels for loudspeaker layouts (16 for custom layouts)*/ #define MAX_OUTPUT_CHANNELS 16 /* Maximum number of output channels (HOA 3rd order) */ -#ifndef FIX_CREND_CHANNELS -#define IVAS_MAX_NUM_CH 16 /* == MAX_OUTPUT_CHANNELS */ -#endif #define FOA_CHANNELS 4 /* number of FOA channels */ diff --git a/lib_com/options.h b/lib_com/options.h index ca3cee71bb..374e60339f 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -150,7 +150,6 @@ #define FIX_I98_HANDLES_TO_NULL /* Issue 98: do the setting of all handles to NULL in one place */ #define FIX_I102_SWB_TBE_SWITCH /* Issue 102: avoid IO->SWB switching code for IVAS, generate SHB ACB mem with lerp in case of switch */ #define FIX_DIRAC_CHANNELS /* Issue 71: lower number of DirAC analysis channels */ -#define FIX_CREND_CHANNELS /* Issue 71: fix number of Crend channels */ #define HARMONIZE_SBA_NCHAN_TRANSPORT /* harmonize setting of number of transport channels in SBA */ #define DRAM_REDUCTION_MCT_IGF /* Issue 121: reduce dynamic RAM consumption in MCT IGF */ #define FIX_I13_TCX_TNS_ISSUE /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */ diff --git a/lib_dec/ivas_crend.c b/lib_dec/ivas_crend.c index 54321f0ef2..796c4a9ed4 100644 --- a/lib_dec/ivas_crend.c +++ b/lib_dec/ivas_crend.c @@ -68,11 +68,7 @@ static ivas_error ivas_hrtf_init( hHrtf->gain_lfe = 0; hHrtf->index_frequency_max_diffuse = 0; -#ifdef FIX_CREND_CHANNELS for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) -#else - for ( i = 0; i < IVAS_MAX_NUM_CH; i++ ) -#endif { hHrtf->inv_diffuse_weight[i] = 0; for ( j = 0; j < BINAURAL_CHANNELS; j++ ) @@ -677,11 +673,7 @@ ivas_error ivas_crend_open( hCrend->lfe_delay_line = NULL; -#ifdef FIX_CREND_CHANNELS for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) -#else - for ( i = 0; i < IVAS_MAX_NUM_CH; i++ ) -#endif { hCrend->freq_buffer_re[i] = NULL; hCrend->freq_buffer_im[i] = NULL; @@ -832,11 +824,7 @@ ivas_error ivas_crend_close( { if ( st_ivas->renderer_type != RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef FIX_CREND_CHANNELS for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) -#else - for ( i = 0; i < IVAS_MAX_NUM_CH; i++ ) -#endif { if ( st_ivas->hCrend->freq_buffer_re[i] != NULL ) { diff --git a/lib_dec/ivas_reverb.c b/lib_dec/ivas_reverb.c index fc70f12a85..10d3a792a5 100644 --- a/lib_dec/ivas_reverb.c +++ b/lib_dec/ivas_reverb.c @@ -795,17 +795,10 @@ static void set_reverb_acoustic_data( { int16_t nr_out_ch, hrtf_idx, offset, iter_idx, bin_idx; float ln_1e6_inverted, delay_diff, exp_argument; -#ifdef FIX_CREND_CHANNELS float *pHrtf_set_l_re[MAX_INTERN_CHANNELS]; float *pHrtf_set_l_im[MAX_INTERN_CHANNELS]; float *pHrtf_set_r_re[MAX_INTERN_CHANNELS]; float *pHrtf_set_r_im[MAX_INTERN_CHANNELS]; -#else - float *pHrtf_set_l_re[IVAS_MAX_NUM_CH]; - float *pHrtf_set_l_im[IVAS_MAX_NUM_CH]; - float *pHrtf_set_r_re[IVAS_MAX_NUM_CH]; - float *pHrtf_set_r_im[IVAS_MAX_NUM_CH]; -#endif /* use crend hrtf filters */ if ( hHrtf != NULL ) diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 5d26372155..aae4dad4b4 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1682,36 +1682,19 @@ typedef struct ivas_binaural_td_rendering_struct typedef struct ivas_hrtfs_structure { -#ifdef FIX_CREND_CHANNELS float *pOut_to_bin_re[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; float *pOut_to_bin_im[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; -#else - float *pOut_to_bin_re[IVAS_MAX_NUM_CH][BINAURAL_CHANNELS]; - float *pOut_to_bin_im[IVAS_MAX_NUM_CH][BINAURAL_CHANNELS]; -#endif float *pOut_to_bin_diffuse_re[BINAURAL_CHANNELS]; float *pOut_to_bin_diffuse_im[BINAURAL_CHANNELS]; float latency_s; -#ifdef FIX_CREND_CHANNELS uint16_t num_iterations[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; -#else - uint16_t num_iterations[IVAS_MAX_NUM_CH][BINAURAL_CHANNELS]; -#endif uint16_t num_iterations_diffuse[BINAURAL_CHANNELS]; -#ifdef FIX_CREND_CHANNELS uint16_t *pIndex_frequency_max[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS]; -#else - uint16_t *pIndex_frequency_max[IVAS_MAX_NUM_CH][BINAURAL_CHANNELS]; -#endif uint16_t *pIndex_frequency_max_diffuse[BINAURAL_CHANNELS]; uint16_t index_frequency_max_diffuse; int16_t max_num_ir; int16_t max_num_iterations; -#ifdef FIX_CREND_CHANNELS float inv_diffuse_weight[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */ -#else - float inv_diffuse_weight[IVAS_MAX_NUM_CH]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */ -#endif float gain_lfe; } HRTFS_DATA, *HRTFS_HANDLE; @@ -1852,13 +1835,8 @@ typedef struct ivas_orient_trk_state_t /* Crend structures */ typedef struct ivas_crend_state_t { -#ifdef FIX_CREND_CHANNELS float *freq_buffer_re[MAX_INTERN_CHANNELS]; float *freq_buffer_im[MAX_INTERN_CHANNELS]; -#else - float *freq_buffer_re[IVAS_MAX_NUM_CH]; - float *freq_buffer_im[IVAS_MAX_NUM_CH]; -#endif float *freq_buffer_re_diffuse; float *freq_buffer_im_diffuse; float *prev_out_buffer[BINAURAL_CHANNELS]; -- GitLab From c17ede48e2babeef941a8a71c5d33f7e3393c70a Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Oct 2022 10:45:35 +0200 Subject: [PATCH 6/7] [cleanup] accept DRAM_REDUCTION_MCT_IGF --- lib_com/options.h | 1 - lib_com/prot.h | 8 -------- lib_enc/igf_enc.c | 4 ---- lib_enc/ivas_mct_enc_mct.c | 11 ----------- lib_enc/ivas_stereo_mdct_core_enc.c | 6 ------ lib_enc/tcx_utils_enc.c | 4 ---- 6 files changed, 34 deletions(-) diff --git a/lib_com/options.h b/lib_com/options.h index 374e60339f..e3acdcb3c1 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -151,7 +151,6 @@ #define FIX_I102_SWB_TBE_SWITCH /* Issue 102: avoid IO->SWB switching code for IVAS, generate SHB ACB mem with lerp in case of switch */ #define FIX_DIRAC_CHANNELS /* Issue 71: lower number of DirAC analysis channels */ #define HARMONIZE_SBA_NCHAN_TRANSPORT /* harmonize setting of number of transport channels in SBA */ -#define DRAM_REDUCTION_MCT_IGF /* Issue 121: reduce dynamic RAM consumption in MCT IGF */ #define FIX_I13_TCX_TNS_ISSUE /* Issue 13: Fix reported artifacts. Bug in TNS with TCX5 */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 5cc6065e15..1f2e5a3042 100755 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -7396,11 +7396,7 @@ void ProcessStereoIGF( Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ int16_t ms_mask[2][MAX_SFB], /* i : bandwise MS mask */ float *pITFMDCTSpectrum[CPE_CHANNELS][2], /* i : MDCT spectrum fir ITF */ -#ifdef DRAM_REDUCTION_MCT_IGF float *pPowerSpectrum[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ -#else - float pPowerSpectrum[CPE_CHANNELS][N_MAX], /* i : MDCT^2 + MDST^2 spectrum, or estimate */ -#endif float *pPowerSpectrumMsInv[CPE_CHANNELS][2], /* i : inverse power spectrum */ float *inv_spectrum[CPE_CHANNELS][2], /* i : inverse spectrum */ const int16_t frameno, /* i : flag indicating index of current subframe*/ @@ -9802,11 +9798,7 @@ void IGFEncApplyStereo( const IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS], /* i : instance handle of IGF Encoder */ const int16_t igfGridIdx, /* i : IGF grid index */ Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ -#ifdef DRAM_REDUCTION_MCT_IGF float *pPowerSpectrum[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ -#else - float pPowerSpectrum[CPE_CHANNELS][N_MAX], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ -#endif float *pPowerSpectrumMsInv[CPE_CHANNELS][2], /* i/o: inverse power spectrum */ float *inv_spectrum[CPE_CHANNELS][2], /* i : inverse spectrum */ const int16_t frameno, /* i : flag indicating index of current subframe */ diff --git a/lib_enc/igf_enc.c b/lib_enc/igf_enc.c index 7b658908b5..e355cd2083 100755 --- a/lib_enc/igf_enc.c +++ b/lib_enc/igf_enc.c @@ -1852,11 +1852,7 @@ void IGFEncApplyStereo( const IGF_ENC_INSTANCE_HANDLE hIGFEnc[CPE_CHANNELS], /* i : instance handle of IGF Encoder */ const int16_t igfGridIdx, /* i : IGF grid index */ Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ -#ifdef DRAM_REDUCTION_MCT_IGF float *pPowerSpectrum[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ -#else - float pPowerSpectrum[CPE_CHANNELS][N_MAX], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ -#endif float *pPowerSpectrumMsInv[CPE_CHANNELS][2], /* i/o: inverse power spectrum */ float *inv_spectrum[CPE_CHANNELS][2], /* i : inverse spectrum */ const int16_t frameno, /* i : flag indicating index of current subfr. */ diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index 309a023fe7..0e36280b20 100755 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -834,11 +834,7 @@ void mctStereoIGF_enc( float *p_powerSpecMsInv[CPE_CHANNELS][NB_DIV]; float *p_inv_spectrum[CPE_CHANNELS][NB_DIV]; float *p_orig_spectrum[CPE_CHANNELS][NB_DIV]; -#ifdef DRAM_REDUCTION_MCT_IGF float *p_powerSpec[NB_DIV]; -#else - float p_powerSpec[NB_DIV][N_MAX]; -#endif int16_t singleChEle[MCT_MAX_CHANNELS]; L_subframeTCX = 0; /* to avoid compilation warning */ @@ -859,15 +855,8 @@ void mctStereoIGF_enc( p_st[0] = sts[ch1]; p_st[1] = sts[ch2]; -#ifdef DRAM_REDUCTION_MCT_IGF p_powerSpec[0] = powerSpec[ch1]; p_powerSpec[1] = powerSpec[ch2]; -#else - mvr2r( powerSpec[ch1], p_powerSpec[0], L_FRAME48k ); - set_f( &p_powerSpec[0][L_FRAME48k], 0.f, N_MAX - L_FRAME48k ); - mvr2r( powerSpec[ch2], p_powerSpec[1], L_FRAME48k ); - set_f( &p_powerSpec[1][L_FRAME48k], 0.f, N_MAX - L_FRAME48k ); -#endif /* Band-wise M/S for MDST */ nSubframes = p_st[0]->hTcxEnc->tcxMode == TCX_20 ? 1 : NB_DIV; diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index 664998967c..6d1e9a32b0 100755 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -129,9 +129,7 @@ void stereo_mdct_core_enc( float *p_orig_spectrum_long[CPE_CHANNELS], orig_spectrum_long[CPE_CHANNELS][N_MAX]; /* MDCT output (L/R). */ float *orig_spectrum[CPE_CHANNELS][2]; /* Pointers to MDCT output for a short block (L/R) */ float powerSpec[CPE_CHANNELS][N_MAX]; -#ifdef DRAM_REDUCTION_MCT_IGF float *p_powerSpec[CPE_CHANNELS]; -#endif float powerSpecMsInv_long[CPE_CHANNELS][N_MAX]; /* MS inv power spectrum, also inverse MDST spectrum */ float *powerSpecMsInv[CPE_CHANNELS][2]; float quantized_spectrum_long[CPE_CHANNELS][N_MAX]; /* quantized MDCT spectrum, inv ms mask mdst spectrum, scratch for MS spectra in the MS decision */ @@ -354,13 +352,9 @@ void stereo_mdct_core_enc( hStereoMdct->mdct_stereo_mode[n] == SMDCT_BW_MS ) && !hStereoMdct->isSBAStereoMode ) { -#ifdef DRAM_REDUCTION_MCT_IGF p_powerSpec[0] = powerSpec[0]; p_powerSpec[1] = powerSpec[1]; ProcessStereoIGF( hStereoMdct, sts, ms_mask, orig_spectrum, p_powerSpec, powerSpecMsInv, inv_spectrum, n, hCPE->hCoreCoder[0]->sp_aud_decision0, hCPE->hCoreCoder[0]->element_brate, 0 ); -#else - ProcessStereoIGF( hStereoMdct, sts, ms_mask, orig_spectrum, powerSpec, powerSpecMsInv, inv_spectrum, n, hCPE->hCoreCoder[0]->sp_aud_decision0, hCPE->hCoreCoder[0]->element_brate, 0 ); -#endif } else { diff --git a/lib_enc/tcx_utils_enc.c b/lib_enc/tcx_utils_enc.c index 9b272f0dee..04b6f0a206 100755 --- a/lib_enc/tcx_utils_enc.c +++ b/lib_enc/tcx_utils_enc.c @@ -1509,11 +1509,7 @@ void ProcessStereoIGF( Encoder_State *sts[CPE_CHANNELS], /* i : Encoder state */ int16_t ms_mask[2][MAX_SFB], /* i : bandwise MS mask */ float *pITFMDCTSpectrum[CPE_CHANNELS][2], /* i : MDCT spectrum fir ITF */ -#ifdef DRAM_REDUCTION_MCT_IGF float *pPowerSpectrum[CPE_CHANNELS], /* i/o: MDCT^2 + MDST^2 spectrum, or estimate */ -#else - float pPowerSpectrum[CPE_CHANNELS][N_MAX], /* i : MDCT^2 + MDST^2 spectrum, or estimate */ -#endif float *pPowerSpectrumMsInv[CPE_CHANNELS][2], /* i : inverse power spectrum */ float *inv_spectrum[CPE_CHANNELS][2], /* i : inverse spectrum */ const int16_t frameno, /* i : flag indicating index of current subfr. */ -- GitLab From 6109d80baecb9278f588ae00595be88dfea62bd0 Mon Sep 17 00:00:00 2001 From: Markus Multrus Date: Fri, 7 Oct 2022 10:58:58 +0200 Subject: [PATCH 7/7] [cleanup] formatting --- lib_com/ivas_stereo_psychlpc_com.c | 3 ++- lib_dec/acelp_core_dec.c | 1 - lib_dec/dec_tcx.c | 10 +++++----- lib_dec/igf_dec.c | 9 ++++----- lib_dec/ivas_core_dec.c | 1 - lib_dec/ivas_objectRenderer.c | 6 +++--- lib_dec/ivas_objectRenderer_hrFilt.c | 1 - lib_dec/ivas_objectRenderer_sfx.c | 6 +++--- lib_dec/tonalMDCTconcealment.c | 7 +++---- lib_enc/ivas_qmetadata_enc.c | 2 +- 10 files changed, 21 insertions(+), 25 deletions(-) diff --git a/lib_com/ivas_stereo_psychlpc_com.c b/lib_com/ivas_stereo_psychlpc_com.c index 4ca10255a7..cdc48f5f98 100644 --- a/lib_com/ivas_stereo_psychlpc_com.c +++ b/lib_com/ivas_stereo_psychlpc_com.c @@ -71,7 +71,8 @@ static void SpectrumWeighting_Init( #ifndef MDCT_STEREO_PLC_FADE_2_BG_NOISE static #endif -ivas_error PsychoacousticParameters_Init( + ivas_error + PsychoacousticParameters_Init( const int32_t sr_core, /* i : sampling rate of core-coder */ const int16_t nBins, /* i : Number of bins (spectral lines) */ const int8_t nBands, /* i : Number of spectrum subbands */ diff --git a/lib_dec/acelp_core_dec.c b/lib_dec/acelp_core_dec.c index e15951d7f3..ed91a78e09 100644 --- a/lib_dec/acelp_core_dec.c +++ b/lib_dec/acelp_core_dec.c @@ -706,7 +706,6 @@ ivas_error acelp_core_dec( { /* Prepare ACB memory of old_bwe_exc */ lerp( old_exc, old_bwe_exc, L_EXC_MEM_DEC * HIBND_ACB_L_FAC, L_EXC_MEM_DEC ); - } #endif /*-----------------------------------------------------------------* diff --git a/lib_dec/dec_tcx.c b/lib_dec/dec_tcx.c index f7a6db5c3e..f83a415a9c 100644 --- a/lib_dec/dec_tcx.c +++ b/lib_dec/dec_tcx.c @@ -213,7 +213,7 @@ void decoder_tcx_post( gainCNG = hTcxDec->CngLevelBackgroundTrace_bfi / ( level_syn + 0.01f ); #ifdef FADE_TO_ZERO_FOR_TOO_LONG_FRAMELOSS - if ( st->element_mode == IVAS_CPE_MDCT && ! isMCT ) + if ( st->element_mode == IVAS_CPE_MDCT && !isMCT ) { if ( st->nbLostCmpt > MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME + MDCT_ST_PLC_FADEOUT_TO_ZERO_LEN ) { @@ -714,7 +714,7 @@ void decoder_tcx_invQ( float *gain_tcx, const int16_t **prm_sqQ1, int16_t *nf_seed, - const int16_t bfi, /* i : Bad frame indicator */ + const int16_t bfi, /* i : Bad frame indicator */ const int16_t frame_cnt /* i : frame counter in the super frame */ ) { @@ -1979,10 +1979,10 @@ void decoder_tcx_IGF_stereo( const int16_t left_rect, /* i : left part is rectangular */ const int16_t k, /* i : Subframe index */ #ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE - const int16_t bfi, /* i : bad frame indicator */ - const int16_t is_mct /* i : flag to signal MCT or SMDCT */ + const int16_t bfi, /* i : bad frame indicator */ + const int16_t is_mct /* i : flag to signal MCT or SMDCT */ #else - const int16_t bfi /* i : bad frame indicator */ + const int16_t bfi /* i : bad frame indicator */ #endif ) { diff --git a/lib_dec/igf_dec.c b/lib_dec/igf_dec.c index fecc8e96df..d3638ea44a 100644 --- a/lib_dec/igf_dec.c +++ b/lib_dec/igf_dec.c @@ -680,10 +680,10 @@ static void IGF_appl( const float *igf_spec, /* i : Q31 | prepared IGF spectrum */ float *virtualSpec, /* o : Q31 | virtual IGF spectrum, used for temp flattening */ #ifdef MDCT_STEREO_PLC_FADE_2_BG_NOISE - int16_t *flag_sparse, /* o : Q0 | temp flattening indicator */ - const int16_t bfi_apply_damping /* i : flag to indicate if damping for lost frames should be applied */ + int16_t *flag_sparse, /* o : Q0 | temp flattening indicator */ + const int16_t bfi_apply_damping /* i : flag to indicate if damping for lost frames should be applied */ #else - int16_t *flag_sparse /* o : Q0 | temp flattening indicator */ + int16_t *flag_sparse /* o : Q0 | temp flattening indicator */ #endif ) { @@ -1616,8 +1616,7 @@ void init_igf_dec( int16_t get_igf_startline( Decoder_State *st, int16_t L_frame, - int16_t L_frameTCX -) + int16_t L_frameTCX ) { int16_t igf_startline; diff --git a/lib_dec/ivas_core_dec.c b/lib_dec/ivas_core_dec.c index ad350f4e30..12274f8762 100644 --- a/lib_dec/ivas_core_dec.c +++ b/lib_dec/ivas_core_dec.c @@ -442,7 +442,6 @@ ivas_error ivas_core_dec( } } #endif - } /*---------------------------------------------------------------------* diff --git a/lib_dec/ivas_objectRenderer.c b/lib_dec/ivas_objectRenderer.c index f74a25d1da..59e63bd9ff 100644 --- a/lib_dec/ivas_objectRenderer.c +++ b/lib_dec/ivas_objectRenderer.c @@ -276,9 +276,9 @@ void ObjRenderIVASFrame( static ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ float output[][L_FRAME48k], /* i/o: ISm object synth / rendered output in 0,1 */ - const int16_t subframe_length, /* i/o: subframe length */ - const int32_t output_Fs, /* i : Output sampling rate */ - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ + const int16_t subframe_length, /* i/o: subframe length */ + const int32_t output_Fs, /* i : Output sampling rate */ + const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ ) { int16_t i; diff --git a/lib_dec/ivas_objectRenderer_hrFilt.c b/lib_dec/ivas_objectRenderer_hrFilt.c index e04c5f3716..d4acda0257 100644 --- a/lib_dec/ivas_objectRenderer_hrFilt.c +++ b/lib_dec/ivas_objectRenderer_hrFilt.c @@ -383,7 +383,6 @@ ivas_error TDREND_REND_RenderSourceHRFilt( Src_p->InputFrame_p += subframe_length; /* Increment input pointer -- todo: should we remove this and input the current subframe instead? */ - return IVAS_ERR_OK; } diff --git a/lib_dec/ivas_objectRenderer_sfx.c b/lib_dec/ivas_objectRenderer_sfx.c index bd54a767ae..693180c48a 100644 --- a/lib_dec/ivas_objectRenderer_sfx.c +++ b/lib_dec/ivas_objectRenderer_sfx.c @@ -928,9 +928,9 @@ static void TDREND_SFX_SpatBin_UpdateParams( --------------------------------------------------------------------*/ void TDREND_SFX_SpatBin_Execute_Main( - SFX_SpatBin_t *SfxSpatBin_p, /* i/o: Spatial parameters struct */ - const float *InBuffer_p, /* i : Input buffer */ - const int16_t subframe_length, /* i : subframe length */ + SFX_SpatBin_t *SfxSpatBin_p, /* i/o: Spatial parameters struct */ + const float *InBuffer_p, /* i : Input buffer */ + const int16_t subframe_length, /* i : subframe length */ float *LeftOutBuffer_p, /* o : Rendered left channel */ float *RightOutBuffer_p, /* o : Rendered right channel */ int16_t *NoOfUsedInputSamples_p, /* o : Number of input samples actually used */ diff --git a/lib_dec/tonalMDCTconcealment.c b/lib_dec/tonalMDCTconcealment.c index 776d28bcb5..6c0203ed42 100644 --- a/lib_dec/tonalMDCTconcealment.c +++ b/lib_dec/tonalMDCTconcealment.c @@ -617,7 +617,7 @@ void TonalMDCTConceal_InsertNoise( { last_block_nrg_correct += hTonalMDCTConc->lastBlockData.spectralData[l] * hTonalMDCTConc->lastBlockData.spectralData[l]; hTonalMDCTConc->curr_noise_nrg -= concealment_noise[l] * concealment_noise[l]; - } + } } } @@ -732,7 +732,7 @@ void TonalMDCTConceal_InsertNoise( if ( hTonalMDCTConc->faded_signal_nrg > 0.0f && hTonalMDCTConc->curr_noise_nrg > MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG ) { float nrg_corr_factor; - + nrg_corr_factor = sqrtf( ( hTonalMDCTConc->last_block_nrg - last_block_nrg_correct ) / hTonalMDCTConc->faded_signal_nrg ); v_multc( mdctSpectrum, nrg_corr_factor, mdctSpectrum, crossOverFreq ); } @@ -1155,8 +1155,7 @@ void TonalMdctConceal_create_concealment_noise( void TonalMdctConceal_whiten_noise_shape( Decoder_State *st, const int16_t L_frame, - const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE whitening_mode -) + const TONALMDCTCONC_NOISE_SHAPE_WHITENING_MODE whitening_mode ) { int16_t inc, start_idx, stop_idx; float *noiseLevelPtr, *scfs_bg, *scfs_for_shaping; diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index ae4af46855..c9f0bd70ff 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -913,7 +913,7 @@ void reset_metadata_spatial( int32_t *total_brate, /* o : total bitrate */ const int32_t core_brate, /* i : core bitrate */ const int16_t nb_bits_metadata, /* i : number of meatdata bits */ - const SBA_MODE sba_mode /* i : SBA mode */ + const SBA_MODE sba_mode /* i : SBA mode */ ) { int16_t i, next_ind_sid, last_ind_sid; -- GitLab