diff --git a/apps/decoder.c b/apps/decoder.c index 7ceda8f6f3a244bd35a21bc039bc2f81563a79ba..fd659b74aed5a8ba522ba0f4c4d40d7055454ffc 100644 --- a/apps/decoder.c +++ b/apps/decoder.c @@ -82,9 +82,7 @@ static #ifdef VARIABLE_SPEED_DECODING #define VARIABLE_SPEED_FETCH_FRAMESIZE_MS 20 #endif -#ifdef JBM_TSM_ON_TCS #define JBM_FRONTEND_FETCH_FRAMESIZE_MS 20 -#endif typedef struct { @@ -136,12 +134,10 @@ typedef struct char *tsmScaleFileName; uint16_t tsmScale; #endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION uint16_t frontendFetchSizeMs; #endif #endif -#endif } DecArguments; @@ -218,11 +214,7 @@ int main( * Open decoder handle *------------------------------------------------------------------------------------------*/ -#ifdef FIX_439_OTR_PARAMS if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Open( &hIvasDec, arg.decMode, arg.orientation_tracking ) ) != IVAS_ERR_OK ) -#endif { fprintf( stderr, "Open failed: %s\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; @@ -386,26 +378,13 @@ int main( /*------------------------------------------------------------------------------------------* * Configure the decoder *------------------------------------------------------------------------------------------*/ -#ifdef FIX_356_ISM_METADATA_SYNC -#ifdef FIX_439_OTR_PARAMS if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain, arg.delayCompensationEnabled ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef FIX_439_OTR_PARAMS - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.orientation_tracking, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_Configure( hIvasDec, arg.output_Fs, arg.outputFormat, arg.customLsOutputEnabled, arg.hrtfReaderEnabled, arg.enableHeadRotation, arg.renderConfigEnabled, arg.Opt_non_diegetic_pan, arg.non_diegetic_pan_gain ) ) != IVAS_ERR_OK ) -#endif -#endif { fprintf( stderr, "\nConfigure failed: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); goto cleanup; } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------------------------------* * Configure VoIP mode *------------------------------------------------------------------------------------------*/ @@ -430,7 +409,6 @@ int main( } #endif #endif -#endif #ifdef DEBUGGING /*-----------------------------------------------------------------* @@ -658,17 +636,6 @@ int main( if ( arg.voipMode ) { -#ifndef JBM_TSM_ON_TCS -#ifdef VARIABLE_SPEED_DECODING - if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, IVAS_DEC_VOIP_MODE_VOIP, 100, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_DEC_EnableVoIP( hIvasDec, 60, arg.inputFormat ) ) != IVAS_ERR_OK ) -#endif - { - fprintf( stderr, "\nCould not enable VOIP: %s\n\n", IVAS_DEC_GetErrorMessage( error ) ); - goto cleanup; - } -#endif error = decodeVoIP( arg, hBsReader, hIvasDec ); } #ifdef VARIABLE_SPEED_DECODING @@ -921,11 +888,9 @@ static bool parseCmdlIVAS_dec( arg->tsmScaleFileEnabled = false; arg->tsmScaleFileName = NULL; #endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION arg->frontendFetchSizeMs = JBM_FRONTEND_FETCH_FRAMESIZE_MS; #endif -#endif #ifdef DEBUG_JBM_CMD_OPTION arg->noBadFrameDelay = false; #endif @@ -1094,7 +1059,6 @@ static bool parseCmdlIVAS_dec( } } #endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION else if ( strcmp( argv_to_upper, "-VOIP_FRAMESIZE" ) == 0 ) { @@ -1115,7 +1079,6 @@ static bool parseCmdlIVAS_dec( } } #endif -#endif #endif /* #ifdef DEBUGGING */ else if ( strcmp( argv_to_upper, "-MIME" ) == 0 ) @@ -1404,11 +1367,9 @@ static void usage_dec( void ) fprintf( stdout, "-VS fac : Variable Speed mode: change speed of playout fac as integer in percent.\n" ); fprintf( stdout, " 50 <= fac <= 150; fac<100 faster, fac>100 slower\n" ); #endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION fprintf( stdout, "-VOIP_framesize : VoIP mode: acoustic frontend fetch frame size (must be multiples of 5!)\n" ); #endif -#endif #endif fprintf( stdout, "-fec_cfg_file : Optimal channel aware configuration computed by the JBM \n" ); fprintf( stdout, " as described in Section 6.3.1 of TS26.448. The output is \n" ); @@ -2093,10 +2054,8 @@ static ivas_error decodeVoIP( uint32_t nextPacketRcvTime_ms = 0; uint32_t systemTime_ms = 0; -#ifdef JBM_TSM_ON_TCS uint32_t systemTimeInc_ms = (uint32_t) JBM_FRONTEND_FETCH_FRAMESIZE_MS; int32_t nFramesWritten = 0; -#endif int32_t nFramesFed = 0; @@ -2232,26 +2191,18 @@ static ivas_error decodeVoIP( * Main receiving/decoding loop *------------------------------------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION systemTimeInc_ms = arg.frontendFetchSizeMs; -#endif #endif while ( 1 ) { int16_t nOutSamples = 0; -#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) uint16_t nSamplesAvailableNext = 0; -#endif -#ifdef JBM_TSM_ON_TCS #ifdef DEBUG_JBM_CMD_OPTION nOutSamples = (int16_t) ( arg.output_Fs / 1000 * arg.frontendFetchSizeMs ); #else nOutSamples = (int16_t) ( arg.output_Fs / 1000 * JBM_FRONTEND_FETCH_FRAMESIZE_MS ); -#endif -#else - nOutSamples = (int16_t) ( arg.output_Fs / 50 ); #endif /* read all packets with a receive time smaller than the system time */ while ( nextPacketRcvTime_ms <= systemTime_ms ) @@ -2296,23 +2247,16 @@ static ivas_error decodeVoIP( /* we are finished when all packets have been received and jitter buffer is empty */ /* also stop when the input file contains less than two frames, because JBM cannot calculate a delay value and won't start decoding */ -#ifdef JBM_TSM_ON_TCS /* last clause should make sure that for BE tests we end up with the same number of samples...*/ if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec, nOutSamples ) || nFramesFed < 2 ) ) -#else - if ( nextPacketRcvTime_ms == (uint32_t) ( -1 ) && ( IVAS_DEC_VoIP_IsEmpty( hIvasDec ) || nFramesFed < 2 ) ) -#endif { break; } /* decode and get samples */ - if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms -#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) - , + if ( ( error = IVAS_DEC_VoIP_GetSamples( hIvasDec, nOutSamples, pcmBuf, systemTime_ms, &nSamplesAvailableNext -#endif #ifdef SUPPORT_JBM_TRACEFILE , writeJbmTraceFileFrameWrapper, @@ -2402,7 +2346,6 @@ static ivas_error decodeVoIP( delayNumSamples -= nOutSamples; } -#ifdef JBM_TSM_ON_TCS /* Write ISM metadata to external file(s) */ if ( decodedGoodFrame && arg.outputFormat == IVAS_DEC_OUTPUT_EXT ) { @@ -2449,7 +2392,6 @@ static ivas_error decodeVoIP( } } } -#endif } if ( !arg.quietModeEnabled ) @@ -2458,12 +2400,8 @@ static ivas_error decodeVoIP( } frame++; -#ifdef JBM_TSM_ON_TCS systemTime_ms += systemTimeInc_ms; nFramesWritten++; -#else - systemTime_ms += 20; -#endif #ifdef WMOPS update_mem(); diff --git a/apps/renderer.c b/apps/renderer.c index 84d616af1e1a50f77a3735a7ced9c6c408329bd6..d285499e224742a0eb0f18376c648493af7860d4 100644 --- a/apps/renderer.c +++ b/apps/renderer.c @@ -144,11 +144,7 @@ typedef struct char referenceRotationFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char customHrtfFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; char renderConfigFilePath[RENDERER_MAX_CLI_ARG_LENGTH]; -#ifdef FIX_439_OTR_PARAMS int8_t orientation_tracking; -#else - int8_t orientationTracking; -#endif int16_t nonDiegeticPan; float nonDiegeticPanGain; bool delayCompensationEnabled; @@ -771,11 +767,7 @@ int main( } } -#ifdef FIX_439_OTR_PARAMS if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientation_tracking ) ) != IVAS_ERR_OK ) -#else - if ( ( error = IVAS_REND_SetOrientationTrackingMode( hIvasRend, args.orientationTracking ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1475,54 +1467,29 @@ static bool parseDiegeticPan( static bool parseOrientationTracking( char *value, -#ifdef FIX_439_OTR_PARAMS - int8_t *orientation_tracking -#else - int8_t *tracking_type -#endif -) + int8_t *orientation_tracking ) { to_upper( value ); if ( strcmp( value, "NONE" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_NONE; -#else - *tracking_type = IVAS_ORIENT_TRK_NONE; -#endif } else if ( strcmp( value, "REF" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_REF; -#else - *tracking_type = IVAS_ORIENT_TRK_REF; -#endif } else if ( strcmp( value, "AVG" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_AVG; -#else - *tracking_type = IVAS_ORIENT_TRK_AVG; -#endif } else if ( strcmp( value, "REF_VEC" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC; -#else - *tracking_type = IVAS_ORIENT_TRK_REF_VEC; -#endif } else if ( strcmp( value, "REF_VEC_LEV" ) == 0 ) { -#ifdef FIX_439_OTR_PARAMS *orientation_tracking = HEAD_ORIENT_TRK_REF_VEC_LEV; -#else - *tracking_type = IVAS_ORIENT_TRK_REF_VEC_LEV; -#endif } else { @@ -1746,11 +1713,7 @@ static CmdlnArgs defaultArgs( clearString( args.customHrtfFilePath ); clearString( args.renderConfigFilePath ); -#ifdef FIX_439_OTR_PARAMS args.orientation_tracking = HEAD_ORIENT_TRK_NONE; -#else - args.orientationTracking = IVAS_ORIENT_TRK_NONE; -#endif args.nonDiegeticPan = 0; args.nonDiegeticPanGain = 0.f; @@ -1858,11 +1821,7 @@ static void parseOption( break; case CmdLnOptionId_orientationTracking: assert( numOptionValues == 1 ); -#ifdef FIX_439_OTR_PARAMS if ( !parseOrientationTracking( optionValues[0], &args->orientation_tracking ) ) -#else - if ( !parseOrientationTracking( optionValues[0], &args->orientationTracking ) ) -#endif { fprintf( stderr, "Unknown option for orientation tracking: %s\n", optionValues[0] ); exit( -1 ); diff --git a/lib_com/bitstream.c b/lib_com/bitstream.c index 2321d37334d7d3f3591b08425dcd17f4147754f5..81b734b400074b1b997c522c1e18c9c99a94437e 100755 --- a/lib_com/bitstream.c +++ b/lib_com/bitstream.c @@ -772,27 +772,15 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else if ( ivas_total_brate <= IVAS_256k ) { -#ifdef FIX_483b return 1050; -#else - return 1000; -#endif } else if ( ivas_total_brate <= IVAS_384k ) { -#ifdef FIX_509 return 2000; -#else - return 1500; -#endif } else { -#ifdef FIX_509 return 2500; -#else - return 2000; -#endif } } else if ( ivas_format == MASA_FORMAT ) @@ -803,59 +791,31 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else if ( ivas_total_brate <= IVAS_32k ) { -#ifdef FIX_502_IND_LIST_SIZE return 125; -#else - return 110; -#endif } else if ( ivas_total_brate <= IVAS_48k ) { -#ifdef FIX_502_IND_LIST_SIZE return 205; -#else - return 180; -#endif } else if ( ivas_total_brate <= IVAS_96k ) { -#ifdef FIX_502_IND_LIST_SIZE return 240; -#else - return 200; -#endif } else if ( ivas_total_brate <= IVAS_128k ) { -#ifdef FIX_502_IND_LIST_SIZE return 305; -#else - return 250; -#endif } else if ( ivas_total_brate <= IVAS_160k ) { -#ifdef FIX_502_IND_LIST_SIZE return 425; -#else - return 320; -#endif } else if ( ivas_total_brate <= IVAS_192k ) { -#ifdef FIX_502_IND_LIST_SIZE return 630; -#else - return 430; -#endif } else if ( ivas_total_brate <= IVAS_256k ) { -#ifdef FIX_502_IND_LIST_SIZE return 850; -#else - return 600; -#endif } else if ( ivas_total_brate <= IVAS_384k ) { @@ -863,11 +823,7 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else { -#ifdef FIX_502_IND_LIST_SIZE return 1750; -#else - return 1500; -#endif } } else if ( ivas_format == MC_FORMAT ) @@ -882,11 +838,7 @@ int16_t get_ivas_max_num_indices_metadata( /* o } else if ( ivas_total_brate <= IVAS_64k ) { -#ifdef FIX_502_IND_LIST_SIZE return 210; -#else - return 200; -#endif } else if ( ivas_total_brate <= IVAS_96k ) { @@ -2942,9 +2894,6 @@ ivas_error preview_indices( if ( bit_stream[2] == 0 ) { st_ivas->ivas_format = SBA_FORMAT; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = ivas_sba_mode_select(); -#endif } else { diff --git a/lib_com/cnst.h b/lib_com/cnst.h index a35f5280c228de623d417afd7d4b602f10a01077..cee56f7d426453c9463a3b0a48a4e5d2f2443d45 100644 --- a/lib_com/cnst.h +++ b/lib_com/cnst.h @@ -2240,13 +2240,11 @@ enum VOIP_RTPDUMP }; -#ifdef FIX_489_COV_SMOOTHING typedef enum _COV_SMOOTHING_TYPE { COV_SMOOTH_SPAR, COV_SMOOTH_MC } COV_SMOOTHING_TYPE; -#endif /* clang-format on */ #endif /* CNST_H */ diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 33ddc9e881d865970af564c2b21c974af44c6844..17cc8e2abb08db73e9088cc3c7b6a6a695cd2805 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -94,7 +94,6 @@ typedef struct float x, y, z; } IVAS_VECTOR3; -#ifdef FIX_439_OTR_PARAMS typedef enum { HEAD_ORIENT_TRK_NONE, @@ -103,7 +102,6 @@ typedef enum HEAD_ORIENT_TRK_REF_VEC, HEAD_ORIENT_TRK_REF_VEC_LEV } HEAD_ORIENT_TRK_T; -#endif typedef struct ivas_masa_metadata_frame_struct *IVAS_MASA_METADATA_HANDLE; typedef struct ivas_masa_decoder_ext_out_meta_struct *MASA_DECODER_EXT_OUT_META_HANDLE; diff --git a/lib_com/fd_cng_com.c b/lib_com/fd_cng_com.c index f0408ea3ddca06d1eac0552ecba721c7e60d6b42..dd82c4f06b11ae4a06c0286b3c0c22351abd14da 100644 --- a/lib_com/fd_cng_com.c +++ b/lib_com/fd_cng_com.c @@ -941,7 +941,6 @@ void SynthesisSTFT( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------- * SynthesisSTFT_dirac() * @@ -1007,7 +1006,6 @@ void SynthesisSTFT_dirac( return; } -#endif /*------------------------------------------------------------------- diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 9557f7aef1ae94191c97dd552d9abc7a3d060164..d314be3154d6d856524a74143b06ce9c3ef79255 100755 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -203,7 +203,6 @@ typedef enum #define IVAS_NUM_SUPPORTED_FS 3 /* number of supported sampling-rates in IVAS */ -#ifdef JBM_TSM_ON_TCS #define CLDFB_SLOT_NS 1250000L /* 1.25ms: CLDFB slot length */ #define MAX_JBM_SUBFRAMES_5MS 8 #define DEFAULT_JBM_SUBFRAMES_5MS 4 @@ -221,7 +220,6 @@ typedef enum TC_BUFFER_MODE_RENDERER, TC_BUFFER_MODE_BUFFER } TC_BUFFER_MODE; -#endif /*----------------------------------------------------------------------------------* * IVAS Bitrates @@ -871,9 +869,7 @@ enum fea_names #define MDCT_ST_PLC_FADEOUT_MIN_NOISE_NRG 0.001f #define MDCT_ST_PLC_FADEOUT_MAX_CONC_FRAME 2 * FRAMES_PER_SEC #define MDCT_ST_PLC_FADEOUT_TO_ZERO_LEN 20 -#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY #define MDCT_ST_PLC_FADEOUT_DELAY_4_LSP_FADE 3 -#endif typedef enum { EQUAL_CORES, @@ -919,15 +915,6 @@ typedef enum { #define SBA_NHARM_HOA3 16 #define SBA_T_DESIGN_11_SIZE 70 #define SBA_DTX_BITRATE_THRESHOLD IVAS_80k -#ifndef SBA_MODE_CLEAN_UP -typedef enum -{ - SBA_MODE_NONE, - SBA_MODE_DIRAC, - SBA_MODE_SPAR, -} SBA_MODE; - -#endif /*----------------------------------------------------------------------------------* * DirAC Constants @@ -1023,10 +1010,8 @@ typedef enum /* AGC constants */ #define AGC_BITS_PER_CH 3 #define AGC_EMAX 0 -#ifdef ARITH_HUFF_CODER_CHANGES #define AGC_SIGNALLING_BITS 1 #define IVAS_SPAR_ARITH_OVERSHOOT_BITS (16) -#endif /* Common SPAR metadata constants */ #define IVAS_ACTIVEW_DM_F_SCALE 0.5f @@ -1186,9 +1171,7 @@ enum #define MASA_DIRECTION_MAX_BITS 11 #define MASA_NO_INDEX 32767 #define MASA_BITS_ER 3 -#ifdef HR_METADATA #define MASA_BITS_ER_HR 4 -#endif #define MASA_MIN_BITS_TF 4 #define MASA_LIMIT_2D 2 #define MASA_NO_CV_COH 8 @@ -1208,13 +1191,9 @@ enum #define QMETADATA_MAX_NO_DIRECTIONS 2 #define MASA_MAX_BITS 1300 /* max. bit-budget for MASA metadata */ -#ifdef HR_METADATA #define MASA_MAX_BITS_HR 2000 /* max. bit-budget for MASA metadata in HR mode*/ #define HR_MASA_ER_LEVELS 16 -#endif -#ifdef FIX_HBR_MASAMETA #define MAX_REDUCED_NBANDS 18 /* max number of subbands that is less than the default value 24 */ -#endif #define LIMIT_ER_ELEVATION_ENC 4 #define LIMIT_ER_SIMPLE_ENC 6 @@ -1246,12 +1225,8 @@ enum #define MASA_STEREO_MIN_BITRATE IVAS_24k4 #define MASA_BIT_REDUCT_PARAM 10 -#ifdef HR_METADATA #define MASA_MAXIMUM_TWO_DIR_BANDS 24 #define NBITS_HR_COH 4 -#else -#define MASA_MAXIMUM_TWO_DIR_BANDS 18 -#endif typedef enum { MASA_STEREO_NOT_DEFINED, @@ -1403,11 +1378,7 @@ typedef enum #define PARAM_MC_REG_GHAT (0.001f) /* Regularization factor for mixing matrix calculation */ #define PARAM_MC_MAX_PARAMETER_BANDS 20 /* Maximum number of parameter bands */ #define PARAM_MC_MAX_PARAMETER_BANDS_RES 14 /* Maximum number of parameter bands with decorrelation */ -#ifdef JBM_TSM_ON_TCS #define PARAM_MC_MAX_NSLOTS MAX_JBM_CLDFB_TIMESLOTS /* Maximum number of CLDFB slots in a frame */ -#else -#define PARAM_MC_MAX_NSLOTS 16 /* Maximum number of CLDFB slots in a frame */ -#endif #define PARAM_MC_MAX_NSLOTS_IN_SUBFRAME 4 /* Maximum number of CLDFB slots in a subframe */ #define PARAM_MC_NSUBFRAMES_DEC 4 /* Number of subframes for the synthesis in the decoder */ #define PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND 30 /* Maximum number of CLDFB frequency bands within a parameter band */ @@ -1614,28 +1585,6 @@ typedef enum } SFX_OpMode_t; -#ifndef FIX_439_OTR_PARAMS -/*----------------------------------------------------------------------------------* - * Orientation tracking constants - *----------------------------------------------------------------------------------*/ - -/* Orientation tracking types */ -#define IVAS_ORIENT_TRK_NONE 0 -#define IVAS_ORIENT_TRK_REF 1 -#define IVAS_ORIENT_TRK_AVG 2 -#define IVAS_ORIENT_TRK_REF_VEC 3 -#define IVAS_ORIENT_TRK_REF_VEC_LEV 4 - -typedef enum -{ - OTR_TRACKING_NONE = IVAS_ORIENT_TRK_NONE, - OTR_TRACKING_REF_ORIENT = IVAS_ORIENT_TRK_REF, /* track orientation relative to external reference orientation (default: no rotation) */ - OTR_TRACKING_AVG_ORIENT = IVAS_ORIENT_TRK_AVG /* track orientation relative to average orientation */ - , - OTR_TRACKING_REF_VEC = IVAS_ORIENT_TRK_REF_VEC, /* track orientation relative to external reference vector */ - OTR_TRACKING_REF_VEC_LEV = IVAS_ORIENT_TRK_REF_VEC_LEV /* track orientation relative to level component of external reference vector */ -} OTR_TRACKING_T; -#endif /*----------------------------------------------------------------------------------* * Reverberator constants @@ -1771,10 +1720,8 @@ typedef enum #define SPAR_DIRAC_DTX_BANDS ( SPAR_DTX_BANDS + DIRAC_DTX_BANDS ) #define CLDFB_PAR_WEIGHT_START_BAND 7 -#ifdef ARITH_HUFF_CODER_CHANGES #define QUANT_STRAT_0 0 #define QUANT_STRAT_2 2 -#endif /*----------------------------------------------------------------------------------* diff --git a/lib_com/ivas_cov_smooth.c b/lib_com/ivas_cov_smooth.c index e407bccc6c67c6b7193b70b88faa8b45890f57e5..430e33e343bfa414b747e9009c6c803a7c0b540f 100644 --- a/lib_com/ivas_cov_smooth.c +++ b/lib_com/ivas_cov_smooth.c @@ -35,9 +35,7 @@ #ifdef DEBUGGING #include "debug.h" #endif -#ifdef FIX_489_COV_SMOOTHING #include "cnst.h" -#endif #include "ivas_prot.h" #include "wmc_auto.h" #include "prot.h" @@ -53,11 +51,8 @@ static void ivas_set_up_cov_smoothing( ivas_cov_smooth_state_t *hCovState, ivas_filterbank_t *pFb, const float max_update_rate, - const int16_t min_pool_size -#ifdef FIX_489_COV_SMOOTHING - , + const int16_t min_pool_size, const COV_SMOOTHING_TYPE smooth_mode /* i : flag multichannel vs SPAR */ -#endif , const int32_t ivas_total_brate ) { @@ -96,7 +91,6 @@ static void ivas_set_up_cov_smoothing( } } } -#ifdef FIX_489_COV_SMOOTHING else if ( smooth_mode == COV_SMOOTH_MC ) { for ( j = 0; j < pFb->filterbank_num_bands; j++ ) @@ -117,7 +111,6 @@ static void ivas_set_up_cov_smoothing( } } } -#endif else { for ( j = 0; j < pFb->filterbank_num_bands; j++ ) @@ -159,10 +152,8 @@ ivas_error ivas_spar_covar_smooth_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp /* i : number of input channels */ , -#ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ -#endif - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_cov_smooth_state_t *hCovState; @@ -191,11 +182,7 @@ ivas_error ivas_spar_covar_smooth_enc_open( } -#ifdef FIX_489_COV_SMOOTHING ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, smooth_mode, ivas_total_brate ); -#else - ivas_set_up_cov_smoothing( hCovState, pFb, cov_smooth_cfg->max_update_rate, cov_smooth_cfg->min_pool_size, ivas_total_brate ); -#endif *hCovState_out = hCovState; diff --git a/lib_com/ivas_dirac_com.c b/lib_com/ivas_dirac_com.c index 091215ac632ff1560211c90ebb952e3e2b4e28a5..1cd2aa3ab904a428f67c04833677804e6e3c6e5e 100644 --- a/lib_com/ivas_dirac_com.c +++ b/lib_com/ivas_dirac_com.c @@ -85,11 +85,7 @@ ivas_error ivas_dirac_config( { IVAS_FORMAT ivas_format; int16_t sba_order; -#ifndef SBA_MODE_CLEAN_UP - int16_t *nSCE, *nCPE, *element_mode, *nchan_transport; -#else int16_t *element_mode; -#endif int32_t ivas_total_brate; DIRAC_CONFIG_DATA_HANDLE hConfig; IVAS_QMETADATA_HANDLE hQMetaData; @@ -98,9 +94,6 @@ ivas_error ivas_dirac_config( ivas_error error; int16_t spar_dirac_split_band; IVAS_FB_MIXER_HANDLE hFbMdft; -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE sba_mode; -#endif int16_t *dirac_to_spar_md_bands; @@ -110,23 +103,13 @@ ivas_error ivas_dirac_config( if ( enc_dec == ENC ) { ivas_format = ( (Encoder_Struct *) st_ivas )->hEncoderConfig->ivas_format; -#ifndef SBA_MODE_CLEAN_UP - nSCE = &( ( (Encoder_Struct *) st_ivas )->nSCE ); - nCPE = &( (Encoder_Struct *) st_ivas )->nCPE; -#endif element_mode = &( (Encoder_Struct *) st_ivas )->hEncoderConfig->element_mode_init; -#ifndef SBA_MODE_CLEAN_UP - nchan_transport = &( (Encoder_Struct *) st_ivas )->nchan_transport; -#endif sba_order = ( (Encoder_Struct *) st_ivas )->sba_analysis_order; ivas_total_brate = ( (Encoder_Struct *) st_ivas )->hEncoderConfig->ivas_total_brate; Fs = ( (Encoder_Struct *) st_ivas )->hEncoderConfig->input_Fs; band_grouping = ( (Encoder_Struct *) st_ivas )->hDirAC->band_grouping; hConfig = ( (Encoder_Struct *) st_ivas )->hDirAC->hConfig; hQMetaData = ( (Encoder_Struct *) st_ivas )->hQMetaData; -#ifndef SBA_MODE_CLEAN_UP - sba_mode = ( (Encoder_Struct *) st_ivas )->sba_mode; -#endif if ( ( (Encoder_Struct *) st_ivas )->hSpar != NULL ) { hFbMdft = ( (Encoder_Struct *) st_ivas )->hSpar->hFbMixer; @@ -135,32 +118,18 @@ ivas_error ivas_dirac_config( { hFbMdft = NULL; } -#ifndef SBA_MODE_CLEAN_UP - dirac_to_spar_md_bands = ( (Encoder_Struct *) st_ivas )->hDirAC->dirac_to_spar_md_bands; -#else dirac_to_spar_md_bands = ( (Encoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands; -#endif } else { ivas_format = ( (Decoder_Struct *) st_ivas )->ivas_format; -#ifndef SBA_MODE_CLEAN_UP - nSCE = &( (Decoder_Struct *) st_ivas )->nSCE; - nCPE = &( (Decoder_Struct *) st_ivas )->nCPE; -#endif element_mode = &( (Decoder_Struct *) st_ivas )->element_mode_init; -#ifndef SBA_MODE_CLEAN_UP - nchan_transport = &( (Decoder_Struct *) st_ivas )->nchan_transport; -#endif sba_order = ( (Decoder_Struct *) st_ivas )->sba_analysis_order; ivas_total_brate = ( (Decoder_Struct *) st_ivas )->hDecoderConfig->ivas_total_brate; Fs = ( (Decoder_Struct *) st_ivas )->hDecoderConfig->output_Fs; band_grouping = ( (Decoder_Struct *) st_ivas )->hDirAC->band_grouping; hConfig = ( (Decoder_Struct *) st_ivas )->hDirAC->hConfig; hQMetaData = ( (Decoder_Struct *) st_ivas )->hQMetaData; -#ifndef SBA_MODE_CLEAN_UP - sba_mode = ( (Decoder_Struct *) st_ivas )->sba_mode; -#endif if ( ( (Decoder_Struct *) st_ivas )->hSpar != NULL ) { hFbMdft = ( (Decoder_Struct *) st_ivas )->hSpar->hFbMixer; @@ -170,18 +139,10 @@ ivas_error ivas_dirac_config( hFbMdft = NULL; } ( (Decoder_Struct *) st_ivas )->hDirAC->hFbMdft = hFbMdft; -#ifndef SBA_MODE_CLEAN_UP - dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hDirAC->dirac_to_spar_md_bands; -#else dirac_to_spar_md_bands = ( (Decoder_Struct *) st_ivas )->hSpar->dirac_to_spar_md_bands; -#endif } -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { hConfig->nbands = IVAS_MAX_NUM_BANDS; @@ -204,22 +165,14 @@ ivas_error ivas_dirac_config( #endif if ( ivas_format == SBA_FORMAT ) /* skip for MASA decoder */ { -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_dirac_sba_config( hQMetaData, nchan_transport, nSCE, nCPE, element_mode, ivas_total_brate, sba_order, sba_mode, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_dirac_sba_config( hQMetaData, element_mode, ivas_total_brate, sba_order, hConfig->nbands - spar_dirac_split_band ) ) != IVAS_ERR_OK ) -#endif { return error; } if ( hQMetaData != NULL ) { -#ifndef SBA_MODE_CLEAN_UP - if ( enc_dec == ENC || sba_mode != SBA_MODE_SPAR ) -#else if ( enc_dec == ENC || ivas_format != SBA_FORMAT ) -#endif { hConfig->nbands = hQMetaData->q_direction[0].cfg.nbands; } @@ -227,41 +180,23 @@ ivas_error ivas_dirac_config( } -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) + hConfig->dec_param_estim = TRUE; + if ( hConfig->dec_param_estim == TRUE ) { -#endif - hConfig->dec_param_estim = TRUE; - if ( hConfig->dec_param_estim == TRUE ) - { - hConfig->enc_param_start_band = spar_dirac_split_band; - } - - if ( ivas_get_hodirac_flag( ivas_total_brate, sba_order ) ) - { - hConfig->dec_param_estim = FALSE; - hConfig->enc_param_start_band = 0; - - set_c( (int8_t *) hQMetaData->twoDirBands, (int8_t) 1, hQMetaData->q_direction[0].cfg.nbands ); - hQMetaData->numTwoDirBands = (uint8_t) hQMetaData->q_direction[0].cfg.nbands; - } -#ifndef SBA_MODE_CLEAN_UP + hConfig->enc_param_start_band = spar_dirac_split_band; } - else + + if ( ivas_get_hodirac_flag( ivas_total_brate, sba_order ) ) { - if ( *nchan_transport > 2 ) - { - hConfig->dec_param_estim = TRUE; - } + hConfig->dec_param_estim = FALSE; + hConfig->enc_param_start_band = 0; + + set_c( (int8_t *) hQMetaData->twoDirBands, (int8_t) 1, hQMetaData->q_direction[0].cfg.nbands ); + hQMetaData->numTwoDirBands = (uint8_t) hQMetaData->q_direction[0].cfg.nbands; } -#endif } -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( Fs * INV_CLDFB_BANDWIDTH + 0.5f ), dirac_to_spar_md_bands, hQMetaData->useLowerBandRes, hConfig->enc_param_start_band, hFbMdft ); } @@ -377,7 +312,6 @@ void ivas_dirac_config_bands( return; } -#ifdef ARITH_HUFF_CODER_CHANGES void ivas_get_dirac_sba_max_md_bits( const int32_t sba_total_brate, int16_t *bits_frame_nominal, @@ -440,7 +374,6 @@ void ivas_get_dirac_sba_max_md_bits( return; } -#endif /*------------------------------------------------------------------------- * ivas_dirac_sba_config() @@ -450,24 +383,12 @@ void ivas_get_dirac_sba_max_md_bits( ivas_error ivas_dirac_sba_config( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ -#ifndef SBA_MODE_CLEAN_UP - int16_t *nchan_transport, /* o : number of transport channel needed for MASA format */ - int16_t *nSCE, /* o : number of SCEs */ - int16_t *nCPE, /* o : number of CPEs */ -#endif - int16_t *element_mode, /* i/o: element mode of the core coder */ - int32_t sba_total_brate, /* i : SBA total bitrate */ - const int16_t sba_order, /* i : Ambisonic (SBA) order */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif - const int16_t nbands /* i : number of frequency bands */ + int16_t *element_mode, /* i/o: element mode of the core coder */ + int32_t sba_total_brate, /* i : SBA total bitrate */ + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const int16_t nbands /* i : number of frequency bands */ ) { -#ifndef SBA_MODE_CLEAN_UP - int16_t i; - int16_t nbands_wb; -#endif int16_t nbands_coded; int16_t hodirac_flag; ivas_error error; @@ -476,299 +397,65 @@ ivas_error ivas_dirac_sba_config( hQMetaData->is_masa_ivas_format = 0; hodirac_flag = ivas_get_hodirac_flag( sba_total_brate, sba_order ); -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) + /* map the bitrate for SID frame */ + if ( sba_total_brate == IVAS_SID_5k2 ) { -#endif - /* map the bitrate for SID frame */ - if ( sba_total_brate == IVAS_SID_5k2 ) - { - if ( *element_mode == IVAS_SCE ) - { - sba_total_brate = ACELP_24k40; - } - else - { - sba_total_brate = ACELP_48k; - } - } - - ivas_set_qmetadata_maxbit_req( hQMetaData, SBA_FORMAT ); - - if ( sba_total_brate <= IVAS_16k4 ) + if ( *element_mode == IVAS_SCE ) { - hQMetaData->useLowerRes = 1; + sba_total_brate = ACELP_24k40; } else { - hQMetaData->useLowerRes = 0; + sba_total_brate = ACELP_48k; } + } - nbands_coded = nbands; - if ( sba_total_brate <= (int32_t) ( (float) IVAS_192k / (float) SPAR_DIRAC_SPLIT_START_BAND ) ) - { - hQMetaData->useLowerBandRes = 1; - nbands_coded = nbands / 2 + nbands % 2; - } - else - { - hQMetaData->useLowerBandRes = 0; - if ( hodirac_flag == 0 ) - { - nbands_coded = nbands - 1; /* always combine the last two bands */ - } - } + ivas_set_qmetadata_maxbit_req( hQMetaData, SBA_FORMAT ); - { - int16_t no_dirs = 1; - if ( hodirac_flag ) - { - no_dirs = 2; - } - - if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, nbands_coded, no_dirs, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } -#if !defined( FIX_DTX_428 ) - { - int16_t dir, j; - for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) - { - for ( j = 0; j < nbands_coded; j++ ) - { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[dir].band_data[j].energy_ratio_index[i] = 0; - hQMetaData->q_direction[dir].band_data[j].energy_ratio_index_mod[i] = 0; - } - } - } - } -#endif - } -#ifdef ARITH_HUFF_CODER_CHANGES - ivas_get_dirac_sba_max_md_bits( - sba_total_brate, - &hQMetaData->bits_frame_nominal, - &hQMetaData->metadata_max_bits, - &hQMetaData->qmetadata_max_bit_req, - hQMetaData->q_direction[0].cfg.nbands ); -#else - if ( sba_total_brate <= IVAS_13k2 ) - { - hQMetaData->bits_frame_nominal = ACELP_9k60 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 70; - } - else if ( sba_total_brate <= IVAS_16k4 ) - { - hQMetaData->bits_frame_nominal = ACELP_13k20 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 80; - } - else if ( sba_total_brate <= IVAS_24k4 ) - { - hQMetaData->bits_frame_nominal = ACELP_16k40 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 103; - } - else if ( sba_total_brate <= IVAS_32k ) + if ( sba_total_brate <= IVAS_16k4 ) { - hQMetaData->bits_frame_nominal = ACELP_32k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 214; - } - else if ( sba_total_brate <= IVAS_48k ) - { - hQMetaData->bits_frame_nominal = IVAS_48k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 240; - } - else if ( sba_total_brate <= IVAS_64k ) - { - hQMetaData->bits_frame_nominal = IVAS_64k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_80k ) - { - hQMetaData->bits_frame_nominal = IVAS_80k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_96k ) - { - hQMetaData->bits_frame_nominal = IVAS_96k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_128k ) - { - hQMetaData->bits_frame_nominal = IVAS_128k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 250; + hQMetaData->useLowerRes = 1; } else { - hQMetaData->bits_frame_nominal = (int16_t) ( sba_total_brate / FRAMES_PER_SEC ); - hQMetaData->metadata_max_bits = MAX16B; /* no limit */ + hQMetaData->useLowerRes = 0; } - hQMetaData->metadata_max_bits = (int16_t) ceilf( (float) hQMetaData->metadata_max_bits * hQMetaData->q_direction[0].cfg.nbands / 5 ); - hQMetaData->qmetadata_max_bit_req = QMETADATA_MAXBIT_REQ_SBA >> 1; -#endif - - return error; -#ifndef SBA_MODE_CLEAN_UP - } - - if ( sba_total_brate > IVAS_SID_5k2 ) + nbands_coded = nbands; + if ( sba_total_brate <= (int32_t) ( (float) IVAS_192k / (float) SPAR_DIRAC_SPLIT_START_BAND ) ) { - *nchan_transport = ivas_get_sba_num_TCs( sba_total_brate, sba_order ); + hQMetaData->useLowerBandRes = 1; + nbands_coded = nbands / 2 + nbands % 2; } - else if ( sba_total_brate == IVAS_SID_5k2 ) + else { - switch ( *element_mode ) + hQMetaData->useLowerBandRes = 0; + if ( hodirac_flag == 0 ) { - case IVAS_CPE_MDCT: - *nchan_transport = 2; - break; - case IVAS_SCE: - *nchan_transport = 1; - break; - default: - assert( !"Wrong initial element mode for SBA SID!" ); - break; + nbands_coded = nbands - 1; /* always combine the last two bands */ } } - if ( hQMetaData != NULL ) { - ivas_set_qmetadata_maxbit_req( hQMetaData, SBA_FORMAT ); - if ( sba_total_brate <= IVAS_16k4 ) - { - hQMetaData->useLowerRes = 1; - } - else - { - hQMetaData->useLowerRes = 0; - } - if ( sba_total_brate >= IVAS_96k ) - { - { - int16_t no_dirs = 1; - if ( hodirac_flag ) - { - no_dirs = 2; - } - if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, 6, no_dirs, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } - nbands_wb = 4; - } - else - { - if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, 5, 1, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - - nbands_wb = 4; - } - for ( i = 0; i < hQMetaData->no_directions; i++ ) - { - hQMetaData->q_direction[i].cfg.start_band = 0; - } - - if ( *nchan_transport > 2 && *nchan_transport <= 8 ) - { - *nCPE = ( ( *nchan_transport + 1 ) / 2 ); - *nSCE = 0; - - hQMetaData->bits_frame_nominal = (int16_t) ( sba_total_brate / FRAMES_PER_SEC ); - - hQMetaData->metadata_max_bits = MAX16B; /* no limit */ - for ( i = 0; i < hQMetaData->no_directions; i++ ) - { - hQMetaData->q_direction[i].cfg.search_effort = 1; - - if ( hodirac_flag ) - { - hQMetaData->q_direction[i].cfg.start_band = 0; - } - else - { - hQMetaData->q_direction[i].cfg.start_band = nbands_wb; - } - } - - *element_mode = IVAS_CPE_MDCT; - } - else if ( *nchan_transport == 2 ) + int16_t no_dirs = 1; + if ( hodirac_flag ) { - *nCPE = 1; - *nSCE = 0; - - if ( sba_total_brate <= IVAS_48k ) - { - hQMetaData->bits_frame_nominal = IVAS_48k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 120; - } - else if ( sba_total_brate <= IVAS_64k ) - { - hQMetaData->bits_frame_nominal = IVAS_64k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_80k ) - { - hQMetaData->bits_frame_nominal = IVAS_80k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else if ( sba_total_brate <= IVAS_96k ) - { - hQMetaData->bits_frame_nominal = IVAS_96k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 200; - } - else - { - hQMetaData->bits_frame_nominal = (int16_t) ( sba_total_brate / FRAMES_PER_SEC ); - hQMetaData->metadata_max_bits = 250; - } - - *element_mode = IVAS_CPE_MDCT; + no_dirs = 2; } - else if ( *nchan_transport == 1 ) - { - *nCPE = 0; - *nSCE = 1; - - if ( sba_total_brate <= IVAS_13k2 ) - { - hQMetaData->bits_frame_nominal = ACELP_9k60 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 70; - } - else if ( sba_total_brate <= IVAS_16k4 ) - { - hQMetaData->bits_frame_nominal = ACELP_13k20 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 80; - } - else if ( sba_total_brate <= IVAS_24k4 ) - { - hQMetaData->bits_frame_nominal = ACELP_16k40 / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 160; - } - else if ( sba_total_brate <= IVAS_32k ) - { - } - else - { - hQMetaData->bits_frame_nominal = ACELP_32k / FRAMES_PER_SEC; - hQMetaData->metadata_max_bits = 176; - } - *element_mode = IVAS_SCE; - } - else + if ( ( error = ivas_qmetadata_allocate_memory( hQMetaData, nbands_coded, no_dirs, 0 ) ) != IVAS_ERR_OK ) { - assert( !"SBA number of transport channels must be 8 or lower" ); + return error; } } + ivas_get_dirac_sba_max_md_bits( + sba_total_brate, + &hQMetaData->bits_frame_nominal, + &hQMetaData->metadata_max_bits, + &hQMetaData->qmetadata_max_bit_req, + hQMetaData->q_direction[0].cfg.nbands ); + return error; -#endif } @@ -1004,9 +691,7 @@ void deindex_spherical_component( *-----------------------------------------------------------------*/ void calculate_hodirac_sector_parameters( -#ifdef FIX_485_STATIC_BUFFERS - DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ -#endif + DIRAC_ENC_HANDLE hDirAC, /* i : DirAC handle */ float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector (L+1)^2 x N_bins, real part */ float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX], /* i : signal vector, imaginary part */ const float beta, /* i : forgetting factor for average filtering */ @@ -1025,17 +710,6 @@ void calculate_hodirac_sector_parameters( float sec_I_vec_y[NUM_ANA_SECTORS]; float sec_I_vec_z[NUM_ANA_SECTORS]; -#ifndef FIX_485_STATIC_BUFFERS - static int16_t firstrun_sector_params = 1; - - static float sec_I_vec_smth_x[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; - static float sec_I_vec_smth_y[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; - static float sec_I_vec_smth_z[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; - - static float energy_smth[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; - static float azi_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; - static float ele_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; -#endif for ( i_sec = 0; i_sec < NUM_ANA_SECTORS; i_sec++ ) { @@ -1071,7 +745,6 @@ void calculate_hodirac_sector_parameters( float *p_ene = &ene[i_sec * N_bands + i_band]; float *p_diff = &diff[i_sec * N_bands + i_band]; -#ifdef FIX_485_STATIC_BUFFERS float *p_azi_prev = &hDirAC->azi_prev[i_sec * N_bands + i_band]; float *p_ele_prev = &hDirAC->ele_prev[i_sec * N_bands + i_band]; @@ -1079,15 +752,6 @@ void calculate_hodirac_sector_parameters( float *p_sec_I_vec_smth_x = &hDirAC->sec_I_vec_smth_x[i_sec][i_band]; float *p_sec_I_vec_smth_y = &hDirAC->sec_I_vec_smth_y[i_sec][i_band]; float *p_sec_I_vec_smth_z = &hDirAC->sec_I_vec_smth_z[i_sec][i_band]; -#else - float *p_azi_prev = &azi_prev[i_sec * N_bands + i_band]; - float *p_ele_prev = &ele_prev[i_sec * N_bands + i_band]; - - float *p_energy_smth = &energy_smth[i_sec][i_band]; - float *p_sec_I_vec_smth_x = &sec_I_vec_smth_x[i_sec][i_band]; - float *p_sec_I_vec_smth_y = &sec_I_vec_smth_y[i_sec][i_band]; - float *p_sec_I_vec_smth_z = &sec_I_vec_smth_z[i_sec][i_band]; -#endif *p_sec_I_vec_x = 0.f; *p_sec_I_vec_y = 0.f; *p_sec_I_vec_z = 0.f; @@ -1153,11 +817,7 @@ void calculate_hodirac_sector_parameters( sec_z_real * sec_z_real + sec_z_imag * sec_z_imag ); } } -#ifdef FIX_485_STATIC_BUFFERS if ( hDirAC->firstrun_sector_params ) -#else - if ( firstrun_sector_params ) -#endif { *p_sec_I_vec_smth_x = *p_sec_I_vec_x; *p_sec_I_vec_smth_y = *p_sec_I_vec_y; @@ -1199,11 +859,7 @@ void calculate_hodirac_sector_parameters( } if ( tmp_diff > 0.5f ) { -#ifdef FIX_485_STATIC_BUFFERS if ( hDirAC->firstrun_sector_params ) -#else - if ( firstrun_sector_params ) -#endif { *p_azi = 0.f; *p_ele = 0.f; @@ -1222,11 +878,7 @@ void calculate_hodirac_sector_parameters( } } -#ifdef FIX_485_STATIC_BUFFERS hDirAC->firstrun_sector_params = 0; -#else - firstrun_sector_params = 0; -#endif return; } diff --git a/lib_com/ivas_error.h b/lib_com/ivas_error.h index 56e09c558df56429a5be493346b7a09f46dd6bcf..0fae8ff215c57979cdd682cf5600f1d1f62260fa 100644 --- a/lib_com/ivas_error.h +++ b/lib_com/ivas_error.h @@ -235,11 +235,7 @@ static inline const char *ivas_error_to_string( ivas_error error_code ) case IVAS_ERR_INVALID_HRTF: return "Unsupported HRTF filter set"; case IVAS_ERR_INVALID_INPUT_FORMAT: -#ifdef FIX_510 return "Invalid input format"; -#else - return "Invalid format of input bitstream"; -#endif case IVAS_ERR_INVALID_INDEX: return "Invalid index"; default: diff --git a/lib_com/ivas_fb_mixer.c b/lib_com/ivas_fb_mixer.c index dbbce9afe42e525db5d25e9cbe2e5f9126b24ce9..4dd3c588e425b2bee0d2f50d7270b8027af8b751 100644 --- a/lib_com/ivas_fb_mixer.c +++ b/lib_com/ivas_fb_mixer.c @@ -99,11 +99,8 @@ static int16_t ivas_get_num_bands( *---------------------------------------------------------------------*/ ivas_error ivas_fb_set_cfg( - IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ - const int16_t ivas_format, /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif + IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ + const int16_t ivas_format, /* i : IVAS format */ const int16_t num_in_chans, /* i : number of FB input channels */ const int16_t num_out_chans, /* i : number of FB output channels */ const int16_t active_w_mixing, /* i : active_w_mixing flag */ @@ -137,23 +134,9 @@ ivas_error ivas_fb_set_cfg( { pFb_cfg->fb_latency = NS2SA( sampling_rate, DELAY_FB_1_NS ); -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif - pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_4_NS ); - pFb_cfg->prior_input_length = NS2SA( sampling_rate, FRAME_SIZE_NS ); - pFb_cfg->windowed_fr_offset = (int16_t) ( (float) ( sampling_rate / FRAMES_PER_SEC ) * 3.0f / 4.0f ) - NS2SA( sampling_rate, DELAY_DIRAC_SPAR_ENC_CMP_NS ); -#ifndef SBA_MODE_CLEAN_UP - } - else /* SBA_MODE_DIRAC */ - { - pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_1_NS ); - pFb_cfg->prior_input_length = NS2SA( sampling_rate, DELAY_DIRAC_ENC_CMP_NS ) + NS2SA( sampling_rate, DIRAC_SLOT_ENC_NS ); - /* extra SPAR/DirAC synchro delay */ - pFb_cfg->prior_input_length += NS2SA( sampling_rate, DELAY_FB_1_NS ); - } -#endif + pFb_cfg->fade_len = NS2SA( sampling_rate, DELAY_FB_4_NS ); + pFb_cfg->prior_input_length = NS2SA( sampling_rate, FRAME_SIZE_NS ); + pFb_cfg->windowed_fr_offset = (int16_t) ( (float) ( sampling_rate / FRAMES_PER_SEC ) * 3.0f / 4.0f ) - NS2SA( sampling_rate, DELAY_DIRAC_SPAR_ENC_CMP_NS ); } else if ( ivas_format == MASA_FORMAT ) { diff --git a/lib_com/ivas_masa_com.c b/lib_com/ivas_masa_com.c index 22caa5d2cf177e64ef47ef671831b4e9b32bb657..8c821d99fd1613ce762508911878e4992baf5b2c 100644 --- a/lib_com/ivas_masa_com.c +++ b/lib_com/ivas_masa_com.c @@ -53,7 +53,6 @@ #define MASA_SMALL_INC_META_BITS 10 -#ifdef HR_METADATA /*--------------------------------------------------------------- * Local prototypes *---------------------------------------------------------------*/ @@ -62,8 +61,6 @@ static int16_t quantize_theta_masa( float x, const int16_t no_cb, float *xhat ); static int16_t quantize_phi_masa( float phi, const int16_t flag_delta, float *phi_hat, const int16_t n ); -#endif - /*--------------------------------------------------------------- * ivas_masa_setup() @@ -323,43 +320,19 @@ void ivas_masa_set_coding_config( *---------------------------------------------------------------*/ void masa_sample_rate_band_correction( - MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ - int16_t *band_mapping, /* i/o: Band mapping used and modified */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ -#ifdef FIX_HBR_MASAMETA - const uint8_t maxBand, /* i : max band */ - uint8_t is_encoder, /* i: signals if called at encoder */ -#else - const int32_t sampling_rate, /* i : Sampling rate */ -#endif + MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ + int16_t *band_mapping, /* i/o: Band mapping used and modified */ + IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ + const uint8_t maxBand, /* i : max band */ + uint8_t is_encoder, /* i: signals if called at encoder */ MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ) { uint8_t band, sf; -#ifdef FIX_HBR_MASAMETA int16_t highBand; -#else - int16_t maxBin, highBand, maxBand; -#endif uint8_t numBands48k; -#ifndef FIX_HBR_MASAMETA - if ( sampling_rate == 48000 ) - { - return; - } -#endif -#ifndef FIX_HBR_MASAMETA - /* Find maximum band usable at this sample rate */ - maxBin = (int16_t) ( CLDFB_NO_CHANNELS_MAX * sampling_rate / 48000 ); - maxBand = 0; - while ( MASA_band_grouping_24[maxBand] <= maxBin ) - { - maxBand++; - } - maxBand--; -#endif numBands48k = config->numCodingBands; for ( band = 1; band < config->numCodingBands + 1; band++ ) @@ -370,7 +343,6 @@ void masa_sample_rate_band_correction( { config->numCodingBands = band; hQMetaData->numCodingBands = band; -#ifdef FIX_HBR_MASAMETA if ( is_encoder ) { if ( hQMetaData->q_direction->cfg.nbands > band ) @@ -382,7 +354,6 @@ void masa_sample_rate_band_correction( hQMetaData->q_direction[1].cfg.nbands = band; } } -#endif band_mapping[band] = maxBand; break; } @@ -430,11 +401,7 @@ void masa_sample_rate_band_correction( /* in decoder, zero the EXT out MASA meta buffer */ for ( sf = 0; sf < MAX_PARAM_SPATIAL_SUBFRAMES; sf++ ) { -#ifdef FIX_HBR_MASAMETA for ( band = hQMetaData->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ ) -#else - for ( band = config->numCodingBands; band < MASA_FREQUENCY_BANDS; band++ ) -#endif { hExtOutMeta->directionIndex[0][sf][band] = SPH_IDX_FRONT; hExtOutMeta->directToTotalRatio[0][sf][band] = 0u; @@ -454,7 +421,6 @@ void masa_sample_rate_band_correction( } -#ifdef HR_METADATA /*------------------------------------------------------------------------- * index_theta_phi_16() * @@ -803,4 +769,3 @@ void deindex_sph_idx( return; } -#endif diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 2a040f2d57ff9751a8884ff2bec421ad63759890..cfd5e5925ad872ea2c363061f84e3d4e299b5dff 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -119,10 +119,8 @@ ivas_error ivas_spar_md_enc_init ivas_error ivas_sba_enc_reconfigure( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ ); -#ifdef ARITH_HUFF_CODER_CHANGES int16_t ivas_sba_get_max_md_bits( Encoder_Struct *st_ivas ); -#endif void destroy_sce_enc( SCE_ENC_HANDLE hSCE /* i/o: SCE encoder structure */ @@ -260,24 +258,18 @@ ivas_error ivas_compute_core_buffers( /*! r: number of clipped samples */ uint32_t ivas_syn_output( -#ifdef JBM_TSM_ON_TCS float *synth[], /* i/o: float synthesis signal */ -#else - float synth[][L_FRAME48k], /* i/o: float synthesis signal */ -#endif const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ int16_t *synth_out /* o : integer 16 bits synthesis signal */ ); -#ifdef JBM_TSM_ON_TCS void ivas_syn_output_f( float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ float *synth_out /* o : integer 16 bits synthesis signal */ ); -#endif void ivas_initialize_handles_enc( Encoder_Struct *st_ivas /* i/o: IVAS encoder structure */ @@ -323,11 +315,9 @@ ivas_error ivas_dec( ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ int16_t *data /* o : flushed PCM samples */ -#endif ); ivas_error create_sce_dec( @@ -666,11 +656,9 @@ ivas_error ivas_mc_enc_config( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ - #ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ -#endif ); /*! r: MC format mode (MCT, McMASA, ParamMC) */ @@ -771,7 +759,6 @@ void dtx_read_padding_bits( ); -#ifdef JBM_TSM_ON_TCS /*----------------------------------------------------------------------------------* * JBM prototypes *----------------------------------------------------------------------------------*/ @@ -872,7 +859,6 @@ void ivas_jbm_dec_tc_buffer_close( void ivas_jbm_dec_td_renderers_adapt_subframes( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#endif /*----------------------------------------------------------------------------------* @@ -1027,11 +1013,9 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ , const ISM_MODE last_ism_mode /* i/o: last ISM mode */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed on renderer change*/ int16_t *data /* o : flushed PCM samples */ -#endif ); ivas_error ivas_param_ism_dec_open( @@ -1048,7 +1032,6 @@ void ivas_param_ism_dec( float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ ); -#ifdef JBM_TSM_ON_TCS void ivas_ism_dec_digest_tc( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); @@ -1066,7 +1049,6 @@ void ivas_param_ism_dec_render( uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ float *output_f[] /* o : rendered time signal */ ); -#endif void ivas_param_ism_params_to_masa_param_mapping( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ @@ -1333,10 +1315,8 @@ void stereo_dft_dec( const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ const int16_t nchan_transport /* i : number of transpor channels */ -#ifdef FIX_STEREO_474 , const int16_t num_md_sub_frames /* i: number of MD subframes */ -#endif ); void stereo_dft_res_ecu( @@ -1570,10 +1550,8 @@ int16_t read_BS_adapt_GR_sg( void stereo_dft_hybrid_ITD_flag( STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ const int32_t input_Fs /* i : CPE element sampling rate */ -#ifdef HYBRID_ITD_MAX , const int16_t hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ -#endif ); void stereo_dft_enc_compute_itd( @@ -3109,7 +3087,6 @@ ivas_error ivas_qmetadata_enc_encode( const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); -#ifdef HR_METADATA ivas_error ivas_qmetadata_enc_encode_hr_384_512( BSTR_ENC_HANDLE hMetaData, /* i/o: metadata bitstream handle */ IVAS_QMETADATA *hQMetaData, /* i/o: metadata handle */ @@ -3130,7 +3107,6 @@ uint16_t index_theta_phi_16( float * p_phi, /* i/o: input azimuth to be indexed */ const SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ ); -#endif void reset_metadata_spatial( const IVAS_FORMAT ivas_format, /* i : IVAS format */ @@ -3139,10 +3115,6 @@ 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 SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ); /*! r: number of bits written */ @@ -3151,10 +3123,6 @@ void ivas_qmetadata_enc_sid_encode( IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ const int16_t masa_sid_descriptor, /* i : description of MASA SID coding structure*/ const int16_t ivas_format /* i : ivas format */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ); /*! r: number of bits read */ @@ -3166,7 +3134,6 @@ int16_t ivas_qmetadata_dec_decode( const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); -#ifdef HR_METADATA /*! r: number of bits read */ int16_t ivas_qmetadata_dec_decode_hr_384_512( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: hQMetaData handle */ @@ -3175,12 +3142,9 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( const SPHERICAL_GRID_DATA *sph_grid16, /* i: spherical grid for deindexing */ const int16_t bits_sph_idx, const int16_t bits_sp_coh -#ifdef FIX_HBR_MASAMETA , uint8_t ncoding_bands_config -#endif ); -#endif /*! r: number of bits read */ int16_t ivas_qmetadata_dec_sid_decode( @@ -3190,10 +3154,6 @@ int16_t ivas_qmetadata_dec_sid_decode( const int16_t nchan_transport, /* i : number of transport channels */ int16_t *element_mode, /* o : element mode */ const int16_t ivas_format /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ); void ivas_qmetadata_to_dirac( @@ -3201,11 +3161,7 @@ void ivas_qmetadata_to_dirac( DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#else const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); @@ -3266,10 +3222,8 @@ void quantize_direction_frame( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ); /*! r: quantized spherical index */ @@ -3408,27 +3362,13 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode -#else const IVAS_FORMAT ivas_format -#endif , const int16_t hodirac_flag, const int16_t nchan_fb_in ); -#ifndef SBA_MODE_CLEAN_UP -/*----------------------------------------------------------------------------------* - * SBA format prototypes - *----------------------------------------------------------------------------------*/ - -/*! r: SBA format mode */ -SBA_MODE ivas_sba_mode_select( - void -); -#endif void ivas_sba_config( const int32_t sba_total_brate, /* i : SBA total bitrate */ int16_t sba_order, /* i : Ambisonic (SBA) order */ @@ -3448,7 +3388,6 @@ ivas_error ivas_sba_dec_reconfigure( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ); -#ifdef JBM_TSM_ON_TCS ivas_error ivas_sba_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nchan_transport, /* i : number of transport channels */ @@ -3456,7 +3395,6 @@ ivas_error ivas_sba_digest_tc( const int16_t nSamplesForRendering, /* i : number of samples provided */ float *data[] /* i : transport channel samples */ ); -#endif void ivas_init_dec_get_num_cldfb_instances( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ @@ -3555,10 +3493,8 @@ void ivas_sba_dirac_stereo_smooth_parameters( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs /* i : Fs for delay calculation */ -#ifdef FIX_STEREO_474 , const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ -#endif ); void ivas_sba2mc_cldfb( @@ -3567,9 +3503,7 @@ void ivas_sba2mc_cldfb( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ const int16_t nb_channels_out, /* i : nb of output channels */ const int16_t nb_bands, /* i : nb of CLDFB bands to process */ -#ifdef JBM_TSM_ON_TCS const int16_t nb_timeslots, /* i : number of time slots to process */ -#endif const float *hoa_dec_mtx /* i : HOA decoding mtx */ ); @@ -3591,18 +3525,6 @@ void ivas_dirac_enc_close( const int32_t input_Fs /* i : input sampling_rate */ ); -#ifndef SBA_MODE_CLEAN_UP -void ivas_dirac_enc( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - int16_t *nb_bits_metadata, /* o : number of metadata bits written */ - const int16_t Opt_DTX_ON, /* i : flag signaling DTX on */ - float data_f[][L_FRAME48k], /* i/o: SBA channels */ - const int16_t input_frame, /* i : input frame length */ - const int16_t sba_planar /* i : SBA planar flag */ -); -#else void ivas_dirac_enc( DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ @@ -3615,7 +3537,6 @@ void ivas_dirac_enc( const IVAS_FORMAT ivas_format, /* i : ivas format */ int16_t hodirac_flag /* i : hodirac flag */ ); -#endif ivas_error ivas_dirac_config( void *st_ivas, /* i/o: IVAS encoder/decoder state structure */ const int16_t enc_dec /* i : encoder or decoder flag */ @@ -3631,28 +3552,18 @@ void ivas_dirac_config_bands( IVAS_FB_MIXER_HANDLE hFbMdft ); -#ifdef ARITH_HUFF_CODER_CHANGES void ivas_get_dirac_sba_max_md_bits( const int32_t sba_total_brate, int16_t *bits_frame_nominal, int16_t *metadata_max_bits, int16_t *qmetadata_max_bit_req, int16_t nbands ); -#endif ivas_error ivas_dirac_sba_config( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ -#ifndef SBA_MODE_CLEAN_UP - int16_t *nchan_transport, /* o : number of transport channel needed for MASA format */ - int16_t *nSCE, /* o : number of SCEs */ - int16_t *nCPE, /* o : number of CPEs */ -#endif int16_t *element_mode, /* o : element mode of the core coder */ int32_t sba_total_brate, /* i : SBA total bitrate */ const int16_t sba_order, /* i : Ambisonic (SBA) order */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t nbands /* i : number of frequency bands */ ); @@ -3685,14 +3596,10 @@ void ivas_dirac_dec_read_BS( DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q metadata */ int16_t *nb_bits, /* o : number of bits read */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ); -#ifdef JBM_TSM_ON_TCS void generate_masking_noise_lb_dirac( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ float *tdBuffer, /* i/o: time-domain signal, if NULL no LB-CNA */ @@ -3710,9 +3617,7 @@ void ivas_dirac_dec( float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport /* i : number of transport channels */ ); -#endif -#ifdef JBM_TSM_ON_TCS void ivas_dirac_dec_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const int16_t nchan_transport, /* i : number of transport channels */ @@ -3721,26 +3626,13 @@ void ivas_dirac_dec_render( uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ float *output_f[] /* o : rendered time signal */ ); -#endif -#ifndef JBM_TSM_ON_TCS -void ivas_dirac_dec( -#else void ivas_dirac_dec_render_sf( -#endif Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] -#ifndef JBM_TSM_ON_TCS - , - const int16_t i_sf -#endif ); ivas_error ivas_td_decorr_reconfig_dec( @@ -3855,23 +3747,17 @@ void ivas_dirac_dec_output_synthesis_close( void ivas_dirac_dec_output_synthesis_process_slot( const float *reference_power, /* i : Estimated power */ const float *onset, /* i : onset filter */ -#ifdef JBM_TSM_ON_TCS const int16_t *azimuth, const int16_t *elevation, const float *diffuseness, -#endif DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ -#ifdef JBM_TSM_ON_TCS const int16_t sh_rot_max_order, -#endif const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ const int16_t nchan_transport /* i : number of transport channels */ -#if defined( JBM_TSM_ON_TCS ) , const int16_t index_slot -#endif , const int16_t hodirac_flag ); @@ -3881,17 +3767,13 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ -#ifdef JBM_TSM_ON_TCS const int16_t nbslots, /* i : number of slots to process */ -#endif const float *onset_filter , #ifdef FIX_393_459_460_SBA_MD float *diffuseness, #else -#ifdef JBM_TSM_ON_TCS const int16_t md_idx, -#endif #endif const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ); @@ -3900,13 +3782,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX],/* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ -#ifdef JBM_TSM_ON_TCS const int16_t nbslots, /* i : number of slots to process */ #ifdef FIX_393_459_460_SBA_MD float *diffuseness_vector, /* i : diffuseness (needed for direction smoothing)*/ #else const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ -#endif #endif float *reference_power_smooth, float qualityBasedSmFactor @@ -3946,11 +3826,9 @@ void ivas_dirac_dec_compute_directional_responses( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ -#ifdef JBM_TSM_ON_TCS const int16_t *azimuth, const int16_t *elevation, const int16_t md_idx, -#endif const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ const float *p_Rmat, /* i : rotation matrix */ @@ -3963,9 +3841,7 @@ void ivas_dirac_dec_get_frequency_axis( const int16_t num_freq_bands ); /* i : number of frequency bands */ void calculate_hodirac_sector_parameters( -#ifdef FIX_485_STATIC_BUFFERS DIRAC_ENC_HANDLE hDirAC, -#endif float RealBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector (L+1)^2 x N_bins, real part */ float ImagBuffer[DIRAC_MAX_ANA_CHANS][DIRAC_NO_FB_BANDS_MAX],/* i : signal vector, imaginary part */ const float beta, /* i : forgetting factor for average filtering */ @@ -4092,7 +3968,6 @@ void ivas_param_mc_dec_read_BS( int16_t *nb_bits /* o : number of bits written */ ); -#ifdef JBM_TSM_ON_TCS void ivas_param_mc_dec_digest_tc( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint8_t nCldfbSlots, /* i : number of CLFBS slots in the transport channels */ @@ -4106,15 +3981,10 @@ void ivas_param_mc_dec_render( uint16_t *nSamplesAvailable, /* o : number of CLDFB slots still to render */ float *output_f[] /* o : rendered time signal */ ); -#endif void ivas_param_mc_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ -#ifdef JBM_TSM_ON_TCS float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif ); void ivas_param_mc_default_icc_map( @@ -4245,12 +4115,10 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( const float *proto_matrix /* i : the prototype (upmix) matrix (only used if mode == 1) */ ); -#ifdef JBM_TSM_ON_TCS void ivas_dirac_dec_output_synthesis_get_interpolator( DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params, /* i/o: handle for the covariance synthesis parameters */ const uint16_t interp_length /* i : interpolator length */ ); -#endif void ivas_dirac_dec_output_synthesis_cov_init( DIRAC_OUTPUT_SYNTHESIS_COV_STATE *h_dirac_output_synthesis_state, /* i/o: pointer to the state of the covariance synthesis */ @@ -4266,40 +4134,21 @@ void ivas_dirac_dec_output_synthesis_cov_close( ); void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( -#ifdef JBM_TSM_ON_TCS float *RealBuffer, /* i : input channel filter bank samples (real part) */ float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ -#else - float RealBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ - float ImagBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part */ -#endif float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ const int16_t nchan_in /* i : number of input channels */ -#ifndef JBM_TSM_ON_TCS - , - const int16_t idx_slot /* i : index of the slot to be added to the input covariance */ -#endif ); void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( -#ifdef JBM_TSM_ON_TCS float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ -#else - float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ - float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ -#endif float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ -#ifdef JBM_TSM_ON_TCS float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : parameter band wise mixing matrices (direct part) */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : parameter band wise mixing matrices (residual part) */ -#endif const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ const int16_t nX, /* i : number of input channels */ @@ -4388,11 +4237,7 @@ void ivas_sba_upmixer_renderer( ); ivas_error ivas_sba_linear_renderer( -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : number of input ambisonics channels */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ @@ -4505,13 +4350,11 @@ void ivas_spar_set_bitrate_config( ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ const int16_t table_idx, /* i : config. table index */ const int16_t num_bands /* i : number of bands */ -#ifdef ARITH_HUFF_CODER_CHANGES , const int16_t dirac2spar_md_flag, const int16_t enc_flag, const int16_t pca_flag, const int16_t agc_flag -#endif ); void ivas_spar_bitrate_dist( @@ -4571,7 +4414,6 @@ int16_t ivas_is_res_channel( const int16_t nchan_transport /* i : number of transport channels (1-4) */ ); -#ifdef JBM_TSM_ON_TCS void ivas_spar_dec_agc_pca( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float output[][L_FRAME48k], /* i/o: input/output audio channels */ @@ -4614,7 +4456,6 @@ void ivas_spar_dec_upmixer_sf( float *output[], /* o : output audio channels */ const int16_t nchan_internal /* i : number of internal channels */ ); -#endif void ivas_spar_dec_upmixer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ @@ -4790,9 +4631,7 @@ ivas_error ivas_spar_covar_enc_open( const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ , -#ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); @@ -4823,9 +4662,7 @@ ivas_error ivas_spar_covar_smooth_enc_open( ivas_filterbank_t *pFb, /* i/o: FB handle */ const int16_t nchan_inp /* i : number of input channels */ , -#ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC*/ -#endif const int32_t ivas_total_brate /* i : IVAS total bitrate */ ); @@ -4883,11 +4720,7 @@ void ivas_td_decorr_dec_close( void ivas_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */ -#ifdef JBM_TSM_ON_TCS float *pcm_in[], /* i : input audio channels */ -#else - float pcm_in[][L_FRAME48k], /* i : input audio channels */ -#endif float **ppOut_pcm, /* o : output audio channels */ const int16_t output_frame /* i : output frame length */ ); @@ -5033,15 +4866,9 @@ int16_t ivas_get_bits_to_encode( void ivas_huffman_encode( ivas_huffman_cfg_t *huff_cfg, int16_t in, int16_t *hcode, int16_t *hlen ); void ivas_spar_huff_coeffs_com_init( ivas_huff_coeffs_t *pHuff_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, const int16_t enc_dec ); void ivas_spar_arith_coeffs_com_init( ivas_arith_coeffs_t *pArith_coeffs, ivas_spar_md_com_cfg *pSpar_cfg, const int16_t table_idx, const int16_t enc_dec ); -#ifdef ARITH_HUFF_CODER_CHANGES int16_t ivas_arith_encode_cmplx_cell_array( -#else -void ivas_arith_encode_cmplx_cell_array( -#endif ivas_arith_t *pArith_re, ivas_arith_t *pArith_re_diff, const int16_t *pDo_diff, const int16_t nB, int16_t *pSymbol_re, int16_t *pSymbol_old_re, ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, const int16_t any_diff -#ifdef ARITH_HUFF_CODER_CHANGES , int32_t wc_strat_arith -#endif ); ivas_error ivas_huffman_decode( ivas_huffman_cfg_t *huff_cfg, Decoder_State *st0, int16_t *dec_out ); void ivas_arith_decode_cmplx_cell_array( ivas_arith_t *pArith_re, ivas_arith_t *pArith_re_diff, Decoder_State *st0, ivas_cell_dim_t *pCell_dims, int16_t *pDo_diff, const int16_t nB, int16_t *pSymbol_re, int16_t *pSymbol_re_old ); @@ -5221,12 +5048,8 @@ void masa_sample_rate_band_correction( MASA_CODEC_CONFIG *config, /* i/o: MASA codec config */ int16_t *band_mapping, /* i/o: Band mapping used and modified */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: QMetadata structure for modification */ -#ifdef FIX_HBR_MASAMETA const uint8_t maxBand, /* i : max band */ uint8_t is_encoder, /* i: signals if called at encoder */ -#else - const int32_t sampling_rate, /* i : sampling rate */ -#endif MASA_DECODER_EXT_OUT_META_HANDLE hExtOutMeta /* i/o: MASA decoder metadata ext out buffer */ ); @@ -5249,8 +5072,6 @@ void ivas_masa_prerender( const int16_t output_frame /* i : output frame length per channel */ ); -#ifdef JBM_TSM_ON_TCS -#endif void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ @@ -5275,29 +5096,21 @@ void ivas_binRenderer_close( #ifdef DEBUGGING void ivas_binaural_cldfb( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif ); -#ifdef JBM_TSM_ON_TCS void ivas_binaural_cldfb_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t n_samples_to_render, /* i : output frame length per channel */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ); -#endif #endif void ivas_binRenderer( BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: fastconv binaural renderer handle */ HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i: : number of time slots to process */ -#endif float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ @@ -5307,12 +5120,8 @@ void ivas_binRenderer( void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ -#ifdef JBM_TSM_ON_TCS float *input_f[], /* i : transport channels */ float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif ); @@ -5326,21 +5135,15 @@ ivas_error ivas_ism_renderer_open( void ivas_ism_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output_f[], /* i/o: core-coder transport channels/object output */ -#else - float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ -#endif const int16_t output_frame /* i : output frame length per channel */ ); -#ifdef JBM_TSM_ON_TCS void ivas_ism_render_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t n_samples_to_render /* i : output frame length per channel */ ); -#endif void ivas_ism_get_stereo_gains( const float azimuth, /* i : object azimuth */ @@ -5351,23 +5154,15 @@ void ivas_ism_get_stereo_gains( void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ -#ifdef JBM_TSM_ON_TCS float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ float *buffer_td[], /* o : MC signals (on input) and the HOA3 (on output) */ -#else - float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ -#endif const int16_t output_frame, /* i : output frame length per channel */ const int16_t sba_order, /* i : SBA order */ const float gain_lfe /* i : gain for LFE, 0=ignore LFE */ ); void ivas_ism2sba( -#ifdef JBM_TSM_ON_TCS float *buffer_td[], /* i/o: TD signal buffers */ -#else - float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ -#endif ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ const int16_t nchan_ism, /* i : number of objects */ @@ -5375,7 +5170,6 @@ void ivas_ism2sba( const int16_t sba_order /* i : SBA order */ ); -#ifdef JBM_TSM_ON_TCS void ivas_ism2sba_sf( float *buffer_in[], /* i : TC buffer */ float *buffer_out[], /* o : TD signal buffers */ @@ -5385,7 +5179,6 @@ void ivas_ism2sba_sf( const int16_t offset, /* i : offset for the interpolatr */ const int16_t sba_order /* i : Ambisonic (SBA) order */ ); -#endif /*----------------------------------------------------------------------------------* @@ -5440,12 +5233,8 @@ void ivas_ls_setup_conversion( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ const int16_t input_chans, /* i : number of input channels to the renderer */ const int16_t output_frame, /* i : frame length */ -#ifdef JBM_TSM_ON_TCS float *input[], /* i : LS input/output synthesis signal */ float *output[] /* i/o: LS input/output synthesis signal */ -#else - float output[][L_FRAME48k] /* i/o: LS input/output synthesis signal */ -#endif ); void ivas_ls_setup_conversion_process_mdct( @@ -5460,9 +5249,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( void ivas_lssetupconversion_process_param_mc( Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ -#ifdef JBM_TSM_ON_TCS const int16_t num_timeslots, /* i : number of time slots to process */ -#endif float Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ float Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ int16_t channel_active[MAX_CICP_CHANNELS] /* i : bitmap indicating which output channels are active */ @@ -5581,12 +5368,8 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode /* i : SBA mode */ -#else const IVAS_FORMAT ivas_format, /* i : ivas_format */ int16_t ref_power_w /* i : use 0 if hodirac is enabled */ -#endif , const int16_t nchan_ana /* i : number of analysis channels */ ); @@ -5696,21 +5479,15 @@ ivas_error ivas_td_binaural_open( ivas_error ivas_td_binaural_renderer( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: SCE channels / Binaural synthesis */ -#else - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ -#endif const int16_t output_frame /* i : output frame length */ ); -#ifdef JBM_TSM_ON_TCS ivas_error ivas_td_binaural_renderer_sf( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t n_samples_granularity /* i : granularity of the renderer/buffer */ ); -#endif /*----------------------------------------------------------------------------------* * Filter-bank (FB) Mixer @@ -5719,9 +5496,6 @@ ivas_error ivas_td_binaural_renderer_sf( ivas_error ivas_fb_set_cfg( IVAS_FB_CFG **pFb_cfg_out, /* o : FB config. handle */ const int16_t ivas_format, /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif const int16_t num_in_chans, /* i : number of FB input channels */ const int16_t num_out_chans, /* i : number of FB output channels */ const int16_t active_w_mixing, /* i : active_w_mixing flag */ @@ -5752,13 +5526,6 @@ void ivas_fb_mixer_pcm_ingest( const int16_t HOA_md_ind[IVAS_SPAR_MAX_CH] ); -#ifndef SBA_MODE_CLEAN_UP -void ivas_dirac_enc_spar_delay_synchro( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const int16_t input_frame, /* i : input frame length */ - float data_f[][L_FRAME48k] /* i/o: SBA channels (ACN / SN3D) */ -); -#endif void ivas_fb_mixer_update_prior_input( IVAS_FB_MIXER_HANDLE hFbMixer, /* i/o: FB mixer handle */ float *pcm_in[], /* i : input audio channels */ diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c index 9f67c602f6aaf3d2994aee41aeefdc48a3941d04..6d1482d5f65caed7d598640b9aae9828fd9918be 100644 --- a/lib_com/ivas_rom_com.c +++ b/lib_com/ivas_rom_com.c @@ -888,19 +888,11 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] = /* When AGC is ON additional (AGC_BITS_PER_CH+1) bits may be taken from each core-coder channel so minimum core-coder bitrate per channel can be min core-coder bitrates as per the table - AGC_BITS_PER_CH */ { 13200, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, -#ifdef FIX_487_LOWRATE_SBA_TUNING_FIX { { 10000, 8150, 13150 } }, -#else - { { 10000, 8300, 13150 } }, -#endif { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, { 16400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0, -#ifdef FIX_487_LOWRATE_SBA_TUNING_FIX { { 13200, 11350, 16350 } }, -#else - { { 13200, 11500, 16350 } }, -#endif { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, { 24400, 0, SBA_FOA_ORDER, FB, 24000, 1, WYXZ, 1, 0,{ { 16400, 14850, 24350 } }, { { 15, 1, 5, 1 },{ 15, 1, 3, 1 },{ 7, 1, 3, 1 } }, 0, 0, 0 }, @@ -936,11 +928,7 @@ const ivas_spar_br_table_t ivas_spar_br_table_consts[IVAS_SPAR_BR_TABLE_LEN] = { 256000, 0, SBA_HOA3_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 76300, 73550, 112000 },{ 59350, 57200, 56000 },{ 42400, 40850, 48000 },{ 25450, 24500, 40000 } }, { { 31, 11, 11, 1 },{ 1, 1, 1, 1 }, -#ifdef ARITH_HUFF_CODER_CHANGES { 1, 1, 1, 1 } -#else - { 31, 1, 1, 1 } -#endif }, 1, 2, 0 }, { 384000, 0, SBA_FOA_ORDER, FB, 24000, 4, WYXZ, 0, 0,{ { 128000, 128000, 128000 },{ 100000, 100000, 128000 },{ 79850, 79850, 104000 },{ 66600, 66600, 104000 } }, // not yet optimized @@ -2538,7 +2526,6 @@ const uint16_t ivas_param_mc_sym_freq_ild_delta_combined_48_16bits[2 * PARAM_MC_ /*----------------------------------------------------------------------------------* * MASA ROM tables *----------------------------------------------------------------------------------*/ -#ifdef HR_METADATA const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS] = { @@ -2579,7 +2566,6 @@ const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1] = 0.8673095703125f, 2.0f /* out-of-range large value to make searching easier */ }; -#endif const int16_t bits_direction_masa[DIRAC_DIFFUSE_LEVELS] = { 11, @@ -2775,11 +2761,7 @@ const uint8_t masa_joined_nbands[IVAS_NUM_ACTIVE_BRATES] = const uint8_t masa_twodir_bands[IVAS_NUM_ACTIVE_BRATES] = { -#ifdef HR_METADATA 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 24 -#else - 0, 0, 0, 0, 0, 1, 1, 1, 3, 4, 6, 6, 9, 12 -#endif }; const uint8_t masa_twodir_bands_joined[IVAS_NUM_ACTIVE_BRATES] = diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h index a6437565c995239d1d71d7fcb6b76dcbfe0e1398..ed3ffa6c0892158c271296e7234a2e491b28f53c 100644 --- a/lib_com/ivas_rom_com.h +++ b/lib_com/ivas_rom_com.h @@ -298,10 +298,8 @@ extern const uint8_t masa_joined_nbands[]; extern const uint8_t masa_twodir_bands[]; extern const uint8_t masa_twodir_bands_joined[]; -#ifdef HR_METADATA extern const float diffuseness_reconstructions_hr[HR_MASA_ER_LEVELS]; extern const float diffuseness_thresholds_hr[HR_MASA_ER_LEVELS + 1]; -#endif /* Multi-channel input and output setups */ extern const float ls_azimuth_CICP2[2]; diff --git a/lib_com/ivas_sba_config.c b/lib_com/ivas_sba_config.c index 450ebef7910ffd1a04e5a0b3760a19950d899e6f..91137d3433894fbab32fea52f17eb4ecf9ceaf45 100644 --- a/lib_com/ivas_sba_config.c +++ b/lib_com/ivas_sba_config.c @@ -47,19 +47,6 @@ #include "wmc_auto.h" -#ifndef SBA_MODE_CLEAN_UP -/*-------------------------------------------------------------------* - * ivas_sba_mode_select() - * - * Return SBA mode - *-------------------------------------------------------------------*/ - -/*! r: SBA format mode */ -SBA_MODE ivas_sba_mode_select() -{ - return SBA_MODE_SPAR; -} -#endif /*-------------------------------------------------------------------* * ivas_sba_config() * diff --git a/lib_com/ivas_spar_com.c b/lib_com/ivas_spar_com.c index 8e7da38580ae116e99a3ea224d1251533d0b6e49..d00b802cd72d312cb5b74b8813b2fb3cc7144612 100644 --- a/lib_com/ivas_spar_com.c +++ b/lib_com/ivas_spar_com.c @@ -435,12 +435,6 @@ int16_t ivas_get_sba_num_TCs( { nchan_transport = 1; } -#ifndef SBA_MODE_CLEAN_UP - else if ( ivas_sba_mode_select() == SBA_MODE_DIRAC ) - { - nchan_transport = 1; - } -#endif else { table_idx = ivas_get_spar_table_idx( ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); @@ -2132,27 +2126,22 @@ void ivas_spar_set_bitrate_config( ivas_spar_md_com_cfg *pSpar_md_cfg, /* i/o: SPAR MD config. handle */ const int16_t table_idx, /* i : config. table index */ const int16_t num_bands /* i : number of bands */ -#ifdef ARITH_HUFF_CODER_CHANGES , const int16_t dirac2spar_md_flag, const int16_t enc_flag, const int16_t pca_flag, - const int16_t agc_flag -#endif -) + const int16_t agc_flag ) { int32_t ivas_total_brate; int16_t i, total_bits, max_bits, code, length; int16_t sba_order; int16_t md_coding_bits_header; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t agc_bits, pca_bits, num_PR_bits_dirac_bands; int16_t bits_PR, bits_C, bits_P; int16_t wc_coarse_strat; int16_t n_input, n_dmx, n_dec; int16_t quant_strat; int16_t bands_bw; -#endif pSpar_md_cfg->nchan_transport = ivas_spar_br_table_consts[table_idx].nchan_transport; for ( i = 0; i < pSpar_md_cfg->nchan_transport; i++ ) @@ -2191,7 +2180,6 @@ void ivas_spar_set_bitrate_config( pSpar_md_cfg->tgt_bits_per_blk -= md_coding_bits_header; pSpar_md_cfg->max_bits_per_blk -= md_coding_bits_header; -#ifdef ARITH_HUFF_CODER_CHANGES if ( ivas_total_brate < IVAS_24k4 ) { bands_bw = 2; @@ -2200,7 +2188,6 @@ void ivas_spar_set_bitrate_config( { bands_bw = 1; } -#endif pSpar_md_cfg->tgt_bits_per_blk = (int16_t) ceilf( ( 1.0f * pSpar_md_cfg->tgt_bits_per_blk * num_bands ) / IVAS_MAX_NUM_BANDS ); pSpar_md_cfg->max_bits_per_blk = (int16_t) ceilf( ( 1.0f * pSpar_md_cfg->max_bits_per_blk * num_bands ) / IVAS_MAX_NUM_BANDS ); @@ -2208,7 +2195,6 @@ void ivas_spar_set_bitrate_config( pSpar_md_cfg->tgt_bits_per_blk += md_coding_bits_header; pSpar_md_cfg->max_bits_per_blk += md_coding_bits_header; -#ifdef ARITH_HUFF_CODER_CHANGES if ( enc_flag ) { /*calculate the actual worst case bits*/ @@ -2275,7 +2261,6 @@ void ivas_spar_set_bitrate_config( } pSpar_md_cfg->max_md_bits_spar = pSpar_md_cfg->max_bits_per_blk + agc_bits + pca_bits; } -#endif return; } diff --git a/lib_com/ivas_stat_com.h b/lib_com/ivas_stat_com.h index cc0fbf89b308e4917456c4a9331fccb17eaec61d..43b7adcc7cd9fba02efaa1bc4c9f4e07972d2678 100644 --- a/lib_com/ivas_stat_com.h +++ b/lib_com/ivas_stat_com.h @@ -265,9 +265,7 @@ typedef struct ivas_spar_md_com_cfg int16_t agc_bits_ch_idx; int16_t planarCP; int16_t num_umx_chs; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t max_md_bits_spar; -#endif } ivas_spar_md_com_cfg; @@ -432,9 +430,7 @@ typedef struct ivas_masa_directional_spatial_meta_struct float elevation[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; float spread_coherence[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#ifdef HR_METADATA uint16_t spherical_index[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS]; -#endif } MASA_DIRECTIONAL_SPATIAL_META; @@ -479,9 +475,7 @@ typedef struct int16_t nbands; int16_t nblocks; int16_t start_band; -#ifdef FIX_HBR_MASAMETA uint8_t inactiveBands; -#endif int16_t search_effort; MC_LS_SETUP mc_ls_setup; @@ -712,9 +706,7 @@ typedef struct ivas_td_decorr_state_t int16_t num_apd_sections; int16_t ducking_flag; -#ifdef JBM_TSM_ON_TCS int16_t offset; -#endif } ivas_td_decorr_state_t; diff --git a/lib_com/ivas_td_decorr.c b/lib_com/ivas_td_decorr.c index f2dd0871dc1ea18a9cbc3dbad1a8c494f5605820..4bf813ac35a0af46eedcaf4a3b91af489d722ae9 100644 --- a/lib_com/ivas_td_decorr.c +++ b/lib_com/ivas_td_decorr.c @@ -222,9 +222,7 @@ ivas_error ivas_td_decorr_dec_open( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR COV decoder" ); } set_f( hTdDecorr_loc->look_ahead_buf, 0, (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ) ); -#ifdef JBM_TSM_ON_TCS hTdDecorr_loc->offset = (int16_t) ( output_Fs * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); -#endif hTdDecorr_loc->num_apd_sections = ivas_get_APD_filt_orders( num_out_chans, output_Fs, hTdDecorr_loc->APD_filt_state[0].order ); for ( j = 0; j < num_out_chans; j++ ) @@ -471,32 +469,18 @@ static void ivas_td_decorr_APD_sections( void ivas_td_decorr_process( ivas_td_decorr_state_t *hTdDecorr, /* i/o: SPAR Covar. decoder handle */ -#ifdef JBM_TSM_ON_TCS - float *pcm_in[], /* i : input audio channels */ -#else - float pcm_in[][L_FRAME48k], /* i : input audio channels */ -#endif - float **ppOut_pcm, /* o : output audio channels */ - const int16_t output_frame /* i : output frame length */ + float *pcm_in[], /* i : input audio channels */ + float **ppOut_pcm, /* o : output audio channels */ + const int16_t output_frame /* i : output frame length */ ) { int16_t i, j; -#ifndef JBM_TSM_ON_TCS - int16_t offset; -#endif float in_duck_gain[L_FRAME48k], out_duck_gain[L_FRAME48k]; -#ifndef JBM_TSM_ON_TCS - offset = (int16_t) ( output_frame * FRAMES_PER_SEC * IVAS_DECORR_PARM_LOOKAHEAD_TAU ); -#endif /* Look-ahead delay */ mvr2r( pcm_in[0], ppOut_pcm[0], output_frame ); -#ifdef JBM_TSM_ON_TCS delay_signal( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, hTdDecorr->offset ); -#else - delay_signal( ppOut_pcm[0], output_frame, hTdDecorr->look_ahead_buf, offset ); -#endif /* In ducking gains */ if ( hTdDecorr->ducking_flag ) diff --git a/lib_com/ivas_tools.c b/lib_com/ivas_tools.c index cf59a751a6a50efc3fc01c31753b515e8a44c59f..45c87e4ff5b528559c96392dcd2c843296a64e07 100644 --- a/lib_com/ivas_tools.c +++ b/lib_com/ivas_tools.c @@ -122,22 +122,14 @@ void mvc2c( /*! r: number of clipped samples */ uint32_t ivas_syn_output( -#ifdef JBM_TSM_ON_TCS - float *synth[], /* i/o: float synthesis signal */ -#else - float synth[][L_FRAME48k], /* i/o: float synthesis signal */ -#endif + float *synth[], /* i/o: float synthesis signal */ const int16_t output_frame, /* i : output frame length (one channel) */ const int16_t n_channels, /* i : number of output channels */ int16_t *synth_out /* o : integer 16 bits synthesis signal */ ) { int16_t i, n; -#ifdef JBM_TSM_ON_TCS int16_t synth_loc[MAX_JBM_L_FRAME48k]; -#else - int16_t synth_loc[L_FRAME48k]; -#endif uint32_t noClipping = 0; /*-----------------------------------------------------------------* @@ -164,7 +156,6 @@ uint32_t ivas_syn_output( } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_syn_output_f() * @@ -196,7 +187,6 @@ void ivas_syn_output_f( return; } -#endif /*-------------------------------------------------------------------* diff --git a/lib_com/options.h b/lib_com/options.h index 3a1e1b24c147df6f816975c28a697b3b22f32dc1..3ff30c75053ac63c338232f823897a6c703c0870 100755 --- a/lib_com/options.h +++ b/lib_com/options.h @@ -127,7 +127,6 @@ /*#define DEBUG_BINAURAL_FILTER_DESIGN*/ /* debugging of Crend binaural filter design */ //#define DEBUG_AGC_ENCODER_CMD_OPTION /* Ability to force enable or disable AGC behaviour in DIRAC/SPAR via command line option */ #define DEBUG_JBM_CMD_OPTION /* ability for telling the decoder the frontend fetch size and to not delay compensate for bad frames at the beginning */ - #endif /* #################### End DEBUGGING switches ############################ */ @@ -146,91 +145,13 @@ #define USE_HRIR_128_METH5_IRC_53_Q10_SYML_ITRP1_48000 /* Dolby (Orange, FhG) : Contribution 36 - SBA HRIR update */ #define UPDATE_SBA_FILTER /* Dolby (Orange, FhG) : Contribution 36 - SBA HRIR update */ +#define VARIABLE_SPEED_DECODING /* variable speed decoding employing the JBM functioniality; move to DEBUGGING after build for disabled is fixed */ /*#define FIX_XXX_JBM_FIFO_BUFFER */ /* FhG: prevent wraparound of a length identifier in cause of large frames and many channels*/ -#define HR_METADATA /* Nok: Contribution #45: encode directional MASA metadata with more bits at 384k and 512k */ - -#define SBA_TD_RESIDUAL /* Dlb : Issue 426: SBA encoder complexity optimization */ - -#define FIX_357_DTX_32K /* Eri: issue 357 - Forced LP-CNG at 32k */ -#define FIX_435_ISM_MERGE_BUG /* Eri: Merge bug fix for ISM NULL metadata and tcx_only cases */ -#define FIX_355_REFACTOR_PARAMBIN_TO_5MS /* Nokia: Fixes issue 355 by refactoring parametric binauralizer code to 5 ms mode */ -#define FIX_411_EVS_BE_TESTS_ON_WINDOWS_FAILING /* Eri: Fix incorrect use of stack variable used for channel aware config file */ -#define COMBINED_FORMAT_SIGNALING /* VA: Introduce a signaling bit for combined format coding */ - -#define FIX_356_ISM_METADATA_SYNC /* Eri: issue 356: Metadata out-of-synch for -no_delay_comp */ - -#define FIX_446_STEREO_DMX_CRASH /* FhG: fix discrepancy with EVS code that could cause crashes in rare cases */ - -#define FIX_386_CORECODER_RECONFIG_2 /* VA: Issue 386: Resolve remaining ToDo comments in CoreCoder reconfig. */ - -#define FIX_439_OTR_PARAMS /* Philips: Issue 439: orientation tracking parameter aspects. */ - -#define FIX_440_PARAM_ISM_DIR_NOISE /* FhG: Issue 440: Fix directional background noise becoming diffuse in ParamISM */ - -#define LBR_SBA_DIRAC_FIX /* DLB: Bug fix for DirAC at low bitrates */ - -#define FIX_445_SNS_BUGFIXES /* FhG: bug fix for spectral tilt in SNS computation + necessary update of codebooks and converison to fixedpoint-compatible tables */ -#define FIX_447_PARAMBIN_MASA_REGU_FAC /* Nokia: Issue 447: Fix issue by adjusting regularization factor minimum value. */ -#define FIX_441_SBA_PARAMBIN_GAINS /* Nokia: Fix issue 441 by changing gains in SBA path of parametric binauralizer */ - -#define MC_PARAMUPMIX_MODE /* Dlb: Contribution 39: Multichannel Parametric Upmix */ -#define FIX_469_BRSWITCH_PUPMIX /* Dlb: Fix issue 469 for Param Upmix bitrate switching */ -#define FIX_MASA_DELAY_PRINTOUT /* VA: issue 444: fix MASA decoder delay printout */ - -#define HODIRAC /* FhG: Contribution 32: Sector-based HO-DirAC method for SBA at high bitrates */ -#define DIRAC_ALLOC_HARM /* VA: harmonize DirAC parameters allocation/deallocation */ - -#define COMPLEXITY_LEVEL_INDICATION - -#define FIX_439_OTR_PARAMS /* Philips: Issue 439: orientation tracking parameter aspects. */ - -#define ARITH_HUFF_CODER_CHANGES /* DLB: Optimization of metadata memory for Huffman and arithmetic coders */ - -#define FIX_463_TD_RENDERER_DIRECTIVITY_RESET /* Eri: Remove unintentional reset of directivity pattern */ -#define FIX_642 /* FhG: Fix for issue 642, buggy DoA-array access in DirAC head rotation*/ -#define FIX_443_FD_CNG_INIT /* FhG: correct bitrate value for FD-CNG init */ -#define VARIABLE_SPEED_DECODING /* FhG: Contribution 37: variable speed decoding employing the JBM functioniality */ -#define JBM_TSM_ON_TCS /* FhG: Contribution 37: run the TSM part of JBM on the TCs instead of the final output pcm waveforms */ -#define FIX_DTX_428 /* FhG: fix for issue 428, crash with DTX and bitrate switching */ -#define FIX_STEREO_474 /* FhG fix for issue 574, crash with SBA to stereo output at 512 kbps */ -#define FIX_MDCT_ST_PLC_FADEOUT_DELAY -#define FIX_DIRAC_LS_SYNTHESIS_CONFIG_479 /* FhG: fix for issue 479, broken LS output with DirAC at high BRs */ -#define HYBRID_ITD_MAX /* FhG: Improvement for DFT-stereo for cases with large ITDs */ -#define FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR /* Eri: Fix for issue 462: Use-of-uninitialized memory in external HRTF deallocation in decoder together with BR switching */ -#define FIX_487_LOWRATE_SBA_TUNING_FIX /* Dlb: TUning fix for low bitrate cases to match theoretical longest SPAR MD bitstream */ -#define FIX_490_MASA_2TC_LBR_DTX /* Nokia: Fixes issue 490 by correcting condition. */ #define FIX_393_459_460_SBA_MD /* FhG: fix issues 393, 459, 460, 494 all related to MD buffers and the read index for accessing them */ - -#define FIX_163_SBA_TD_DECORR_OPT /* Dlb : Issue 163 : TD decorr state optimization in SBA for certain output formats */ - -#define FIX_HBR_MASAMETA /* Nokia: Fixes to HBR MASA metadata at 384 and 512 kbps. Addresses issues 438 and 477 as well. */ -#define FIX_482_DUMMYDEC_INIT /* Nokia: fix issue #428: missing inits for dummyDec in IVAS_rend */ -#define FIX_468_16KHZ_PUPMIX /* Dlb: Fix issue 468 for Param Upmix at 16kHz sampling rate */ -#define FIX_499_DFT_STEREO_PLC /* Eri: Fix for issue 499: Wrong past memory addressed for computing energy of DFT stereo residual ECU frame */ -#define FIX_489_COV_SMOOTHING /* Dlb: Fix covariance smoothing for ParamUpmix */ #define FIX_501_TABLE_IDX_INIT /* Dlb: Fix for the issue 501 */ - -#define FIX_485_STATIC_BUFFERS /* FhG: move static buffers in DirAC parameter estimator to the DirAC struct */ -#define FIX_I503_ASAN_ERROR_IND_LIST /* VA: fix issue #503: address sanitizer error with IND_LIST_DYN */ -#define FIX_473_JITTER_NONDIEGETIC_PANNING /* FhG,Orange: add missing non-diegetic panning to JITTER */ - -#define SBA_MODE_CLEAN_UP /* Dlb: Cean up SBA mode references */ -#define FIX_502_IND_LIST_SIZE /* Fix issue #502: insufficient index buffer sizes */ - -#ifdef HR_METADATA -#define FIX_505_MASA_SPHGRID_REUSE /* Nokia: Fix issue #505: MASA spherical grid reuse fix */ -#endif - -#define FIX_481_UNUSED_VARIABLES /* Nokia: Fix issue #481: Unused debug variables */ - -#define FIX_483 /* FhG: fix issue 483, division by zero in nois_est */ -#define FIX_483b /* FhG: fix issue 483, uninitialized values in ivas_mct_core_enc */ #define FIX_506_WARNINGS /* FhG/Eri/Dlb/VA: Issue 508, Warnings on MacOS */ -#define FIX_170_DTX_MASA /* Nokia: Fix issue 170, relaxing the use of DTX in MASA format */ #define FIX_296_CFG_LFE_SCENE_DESC /* FhG: Fix issue 296 - add configurable LFE handling to the scene description file */ -#define FIX_510 /* FhG: fix issue 510, misleading error message for invalid input format */ -#define FIX_509 /* FhG: fix issue 509, too low number of bitsream indices in SBA */ #define FIX_519_JBM_ACCESS_NULL_TC_BUFFER /* FhG: fix issue 519, accessing a yet uninitialized TC Buffer in frame 0*/ #ifdef IND_LIST_DYN #define FIX_545_ASSERT /* VA: fix issue 545, replace assert() with warning message when hitting memory limit in the buffer of indices */ diff --git a/lib_com/prot.h b/lib_com/prot.h index 23c3b98756812ba7eefcb07b814ff6f85a35d448..172053bc5434e70b39057e416452e9829fa0eb52 100644 --- a/lib_com/prot.h +++ b/lib_com/prot.h @@ -177,11 +177,7 @@ float sum2_f( void set_c( int8_t y[], /* i/o: Vector to set */ const int8_t a, /* i : Value to set the vector to */ -#ifdef JBM_TSM_ON_TCS const int32_t N /* i : Length of the vector */ -#else - const int16_t N /* i : Length of the vector */ -#endif ); void set_s( @@ -8680,7 +8676,6 @@ void generate_masking_noise_mdct( HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ); -#ifdef JBM_TSM_ON_TCS void SynthesisSTFT_dirac( float *fftBuffer, /* i : FFT bins */ float *timeDomainOutput, @@ -8689,7 +8684,6 @@ void SynthesisSTFT_dirac( const int16_t samples_out, HANDLE_FD_CNG_COM hFdCngCom /* i/o: FD_CNG structure containing all buffers and variables */ ); -#endif void generate_masking_noise_dirac( HANDLE_FD_CNG_COM hFdCngCom, /* i/o: FD_CNG structure containing all buffers and variables */ diff --git a/lib_com/tools.c b/lib_com/tools.c index ab688adbb9f77cfc81f361399a4bedd55486d7a7..ecd2fdbfa4335d846d5eba766498779445adb374 100644 --- a/lib_com/tools.c +++ b/lib_com/tools.c @@ -210,11 +210,7 @@ float sum2_f( void set_c( int8_t y[], /* i/o: Vector to set */ const int8_t a, /* i : Value to set the vector to */ -#ifdef JBM_TSM_ON_TCS const int32_t N /* i : Length of the vector */ -#else - const int16_t N /* i : Length of the vector */ -#endif ) { int16_t i; @@ -391,11 +387,7 @@ uint32_t mvr2s( return 0; } -#ifdef JBM_TSM_ON_TCS if ( (void *) y <= (const void *) x ) -#else - if ( (void *) y < (const void *) x ) -#endif { for ( i = 0; i < n; i++ ) { diff --git a/lib_dec/er_dec_tcx.c b/lib_dec/er_dec_tcx.c index fb797f92c9da1216601ceaf646c687e71bd30cd9..24a4817052c6054e54169a07699aa5e5f7a7c91e 100644 --- a/lib_dec/er_dec_tcx.c +++ b/lib_dec/er_dec_tcx.c @@ -553,7 +553,6 @@ void con_tcx( if ( A_cng != NULL ) { -#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY float alpha_delayed; alpha_delayed = 1.0f; @@ -563,27 +562,16 @@ void con_tcx( } if ( st->plcBackgroundNoiseUpdated && alpha_delayed != 1.0f ) -#else - if ( st->plcBackgroundNoiseUpdated && alpha != 1.0f ) -#endif { float lsp_local[M], lsp_fade[M], alpha_inv; -#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY alpha_inv = 1.0f - alpha_delayed; -#else - alpha_inv = 1.0f - alpha; -#endif a2lsp_stab( A_local, lsp_local, lsp_local ); for ( i = 0; i < M; i++ ) { -#ifdef FIX_MDCT_ST_PLC_FADEOUT_DELAY lsp_fade[i] = alpha_delayed * lsp_local[i] + alpha_inv * st->lspold_cng[i]; -#else - lsp_fade[i] = alpha * lsp_local[i] + alpha_inv * st->lspold_cng[i]; -#endif } lsp2a_stab( lsp_fade, A_local, M ); diff --git a/lib_dec/fd_cng_dec.c b/lib_dec/fd_cng_dec.c index db8b6a659f45ea35805d908d8b962cd3195f737d..45ab2e343576d088ab1a7eeebcc5277f7f847c79 100644 --- a/lib_dec/fd_cng_dec.c +++ b/lib_dec/fd_cng_dec.c @@ -1794,7 +1794,6 @@ void generate_stereo_masking_noise( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------- * generate_masking_noise_hf_cldfb() * @@ -1946,7 +1945,6 @@ void generate_masking_noise_lb_dirac( return; } -#endif /*------------------------------------------------------------------- @@ -1967,12 +1965,6 @@ void generate_masking_noise_dirac( ) { int16_t i; -#ifndef JBM_TSM_ON_TCS - float *cngNoiseLevel = hFdCngCom->cngNoiseLevel; - float *fftBuffer = hFdCngCom->fftBuffer; - float *ptr_r; - float *ptr_i; -#endif float *ptr_level; int16_t *seed = &( hFdCngCom->seed ); float scale; @@ -2024,91 +2016,11 @@ void generate_masking_noise_dirac( { if ( scale != 0 ) { -#ifndef JBM_TSM_ON_TCS - /*Generate LF comfort noise only at first slot, for the whole frame*/ - if ( slot_index == 0 ) - { - ptr_level = cngNoiseLevel; - - /* Generate Gaussian random noise in real and imaginary parts of the FFT bins - Amplitudes are adjusted to the estimated noise level cngNoiseLevel in each bin */ - if ( hFdCngCom->startBand == 0 ) - { - rand_gauss( &fftBuffer[0], seed ); - ptr_r = fftBuffer + 2; - fftBuffer[0] *= (float) sqrt( scale * *ptr_level ); /* DC component in FFT */ - ptr_level++; - } - else - { - fftBuffer[0] = 0.f; - set_f( fftBuffer + 2, 0.0f, 2 * ( hFdCngCom->startBand - 1 ) ); - ptr_r = fftBuffer + 2 * hFdCngCom->startBand; - } - ptr_i = ptr_r + 1; - - for ( ; ptr_level < cngNoiseLevel + hFdCngCom->stopFFTbin - hFdCngCom->startBand; ptr_level++ ) - { - /* Real part in FFT bins */ - rand_gauss( ptr_r, seed ); - ( *ptr_r ) *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); - ptr_r += 2; - /* Imaginary part in FFT bins */ - rand_gauss( ptr_i, seed ); - ( *ptr_i ) *= (float) sqrt( ( scale * *ptr_level ) * 0.5f ); - ptr_i += 2; - } - - /* Remaining FFT bins are set to zero */ - set_f( fftBuffer + 2 * hFdCngCom->stopFFTbin, 0.0f, hFdCngCom->fftlen - 2 * hFdCngCom->stopFFTbin ); - /* Nyquist frequency is discarded */ - fftBuffer[1] = 0.f; - - /* Perform STFT synthesis */ - SynthesisSTFT( fftBuffer, tdBuffer, hFdCngCom->olapBufferSynth2, hFdCngCom->olapWinSyn, 0, hFdCngCom, -1, -1 ); - -#ifdef DEBUG_MODE_DIRAC - { - int16_t tmp[1000]; - - for ( i = 0; i < hFdCngCom->frameSize; i++ ) - { - tmp[i] = (int16_t) ( tdBuffer[i] + 0.5f ); - } - dbgwrite( tmp, sizeof( int16_t ), hFdCngCom->frameSize, 1, "./res/ivas_dirac_cna_fft.pcm" ); - } -#endif - } -#endif /* LF CLDFB*/ cldfbAnalysis_ts( &( tdBuffer[hFdCngCom->numCoreBands * slot_index] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, hFdCngCom->numCoreBands, h_cldfb ); } else { -#ifndef JBM_TSM_ON_TCS - if ( slot_index == 0 ) - { - /* very low level case - update random seeds */ - generate_masking_noise_update_seed( hFdCngCom ); - - set_f( fftBuffer, 0.f, hFdCngCom->fftlen ); - - /* Perform STFT synthesis */ - SynthesisSTFT( fftBuffer, tdBuffer, hFdCngCom->olapBufferSynth2, hFdCngCom->olapWinSyn, 0, hFdCngCom, -1, -1 ); - -#ifdef DEBUG_MODE_DIRAC - { - int16_t tmp[1000]; - - for ( i = 0; i < hFdCngCom->frameSize; i++ ) - { - tmp[i] = (int16_t) ( tdBuffer[i] + 0.5f ); - } - dbgwrite( tmp, sizeof( int16_t ), hFdCngCom->frameSize, 1, "./res/ivas_dirac_cna_fft.pcm" ); - } -#endif - } -#endif /* LB ana CLDFB*/ cldfbAnalysis_ts( &( tdBuffer[hFdCngCom->numCoreBands * slot_index] ), Cldfb_RealBuffer, Cldfb_ImagBuffer, hFdCngCom->numCoreBands, h_cldfb ); } diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c index d4bd43f5449af438e31bda4e766d88ff08e3cd25..2e0c4f782925cee27c75aebefb444e789066c918 100644 --- a/lib_dec/ivas_binRenderer_internal.c +++ b/lib_dec/ivas_binRenderer_internal.c @@ -59,10 +59,8 @@ static void ivas_binRenderer_filterModule( float out_Conv_CLDFB_imag[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : imag part of Binaural signals */ float CLDFB_real[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : real part of LS signals */ float CLDFB_imag[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : imag part of LS signals */ -#ifdef JBM_TSM_ON_TCS - const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif - BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ + const int16_t numTimeSlots, /* i : number of time slots to process */ + BINAURAL_RENDERER_HANDLE hBinRenderer /* i/o: fastconv binaural renderer handle */ ) { int16_t bandIdx, k, chIdx, tapIdx; @@ -81,11 +79,7 @@ static void ivas_binRenderer_filterModule( filterTapsRightRealPtr = hBinRenderer->hBinRenConvModule->filterTapsRightReal[bandIdx][chIdx]; filterTapsRightImagPtr = hBinRenderer->hBinRenConvModule->filterTapsRightImag[bandIdx][chIdx]; -#ifdef JBM_TSM_ON_TCS for ( k = 0; k < numTimeSlots; k++ ) -#else - for ( k = 0; k < MAX_PARAM_SPATIAL_SUBFRAMES; k++ ) -#endif { float outRealLeft = 0.0f, outRealRight = 0.0f, outImagLeft = 0.0f, outImagRight = 0.0f; @@ -951,12 +945,8 @@ void ivas_binRenderer_close( void ivas_binaural_add_LFE( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ int16_t output_frame, /* i : length of input frame */ -#ifdef JBM_TSM_ON_TCS - float *input_f[], /* i : transport channels */ - float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif + float *input_f[], /* i : transport channels */ + float *output_f[] /* o : synthesized core-coder transport channels/DirAC output */ ) { int16_t render_lfe, idx_lfe; @@ -983,17 +973,10 @@ void ivas_binaural_add_LFE( } for ( idx_lfe = 0; idx_lfe < st_ivas->hIntSetup.num_lfe; idx_lfe++ ) { -#ifdef JBM_TSM_ON_TCS v_multc( input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain, input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame ); /* copy LFE to left and right channels */ v_add( output_f[0], input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[0], output_frame ); v_add( output_f[1], input_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[1], output_frame ); -#else - v_multc( output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], gain, output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_frame ); - /* copy LFE to left and right channels */ - v_add( output_f[0], output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[0], output_frame ); - v_add( output_f[1], output_f[st_ivas->hIntSetup.index_lfe[idx_lfe]], output_f[1], output_frame ); -#endif } } @@ -1010,11 +993,7 @@ void ivas_binaural_add_LFE( void ivas_binaural_cldfb( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS - float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif + float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ ) { float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -1057,11 +1036,7 @@ void ivas_binaural_cldfb( } /* Implement binaural rendering */ -#ifdef JBM_TSM_ON_TCS ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, JBM_CLDFB_SLOTS_IN_SUBFRAME, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#else - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#endif /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { @@ -1084,7 +1059,6 @@ void ivas_binaural_cldfb( } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------------* * ivas_binaural_cldfb_sf() * @@ -1153,11 +1127,7 @@ void ivas_binaural_cldfb_sf( } /* Implement binaural rendering */ -#ifdef JBM_TSM_ON_TCS ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, st_ivas->hTcBuffer->subframe_nbslots[subframeIdx], Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#else - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); -#endif /* Implement CLDFB synthesis */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) @@ -1182,7 +1152,6 @@ void ivas_binaural_cldfb_sf( return; } #endif -#endif /*------------------------------------------------------------------------- @@ -1192,11 +1161,9 @@ void ivas_binaural_cldfb_sf( *-------------------------------------------------------------------------*/ void ivas_binRenderer( - BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ - HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ -#ifdef JBM_TSM_ON_TCS - const int16_t numTimeSlots, /* i : number of time slots to render*/ -#endif + BINAURAL_RENDERER_HANDLE hBinRenderer, /* i/o: binaural renderer handle */ + HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i/o: head track handle */ + const int16_t numTimeSlots, /* i : number of time slots to render*/ float Cldfb_RealBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float Cldfb_ImagBuffer_Binaural[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : Binaural signals */ float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ @@ -1204,9 +1171,6 @@ void ivas_binRenderer( ) { int16_t chIdx, k; -#ifndef JBM_TSM_ON_TCS - int16_t numTimeSlots = MAX_PARAM_SPATIAL_SUBFRAMES; -#endif push_wmops( "fastconv_binaural_rendering" ); @@ -1230,47 +1194,27 @@ void ivas_binRenderer( if ( hHeadTrackData->shd_rot_max_order == -1 ) { QuatToRotMat( hHeadTrackData->Quaternions[hHeadTrackData->num_quaternions++], hHeadTrackData->Rmat ); -#ifdef JBM_TSM_ON_TCS rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, 3 ); -#else - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, 3 ); -#endif } else if ( hHeadTrackData->shd_rot_max_order > 0 ) { -#ifdef JBM_TSM_ON_TCS rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, numTimeSlots, hHeadTrackData->shd_rot_max_order ); -#else - rotateFrame_shd_cldfb( RealBuffer, ImagBuffer, hHeadTrackData->Rmat, hBinRenderer->hInputSetup->nchan_out_woLFE, hHeadTrackData->shd_rot_max_order ); -#endif } } else { /* Rotation in SD (CICPx) */ -#ifdef JBM_TSM_ON_TCS rotateFrame_sd_cldfb( hHeadTrackData, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, numTimeSlots, hBinRenderer->conv_band ); -#else - rotateFrame_sd_cldfb( hHeadTrackData, RealBuffer, ImagBuffer, hBinRenderer->hInputSetup, hBinRenderer->hEFAPdata, hBinRenderer->conv_band ); -#endif } } /* HOA decoding to CICP19 if needed*/ if ( hBinRenderer->hInputSetup->is_loudspeaker_setup == 0 && hBinRenderer->nInChannels != 16 ) { -#ifdef JBM_TSM_ON_TCS ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, numTimeSlots, hBinRenderer->hoa_dec_mtx ); -#else - ivas_sba2mc_cldfb( *( hBinRenderer->hInputSetup ), RealBuffer, ImagBuffer, hBinRenderer->nInChannels, hBinRenderer->conv_band, hBinRenderer->hoa_dec_mtx ); -#endif } -#ifdef JBM_TSM_ON_TCS ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, numTimeSlots, hBinRenderer ); -#else - ivas_binRenderer_filterModule( Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, RealBuffer, ImagBuffer, hBinRenderer ); -#endif /* Obtain the binaural dmx and compute the reverb */ if ( hBinRenderer->hReverb != NULL ) @@ -1290,11 +1234,7 @@ void ivas_binRenderer( } } -#ifdef JBM_TSM_ON_TCS ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, numTimeSlots, inRe, inIm, reverbRe, reverbIm ); -#else - ivas_binaural_reverb_processSubframe( hBinRenderer->hReverb, BINAURAL_CHANNELS, inRe, inIm, reverbRe, reverbIm ); -#endif /* Add the conv module and reverb module output */ for ( chIdx = 0; chIdx < BINAURAL_CHANNELS; chIdx++ ) diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index e112a8ec040ce6bc96adc27314eafd8d69f3ab69..ffd96b635c6954d319a866cb58a74cfba034b469 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -511,13 +511,8 @@ ivas_error ivas_cldfb_dec_reconfig( } } -#ifndef SBA_MODE_CLEAN_UP - /* CLDFB Interpolation weights */ - if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) && numCldfbAnalyses != 0 && numCldfbSyntheses != 0 ) -#else /* CLDFB Interpolation weights */ if ( st_ivas->ivas_format == SBA_FORMAT && ( numCldfbAnalyses_old != numCldfbAnalyses || numCldfbSyntheses_old != numCldfbSyntheses || nchan_transport_old != st_ivas->nchan_transport ) && numCldfbAnalyses != 0 && numCldfbSyntheses != 0 ) -#endif { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } diff --git a/lib_dec/ivas_cpe_dec.c b/lib_dec/ivas_cpe_dec.c old mode 100755 new mode 100644 index a19fb21dc2fdcbb8574a9147eb0989cc936c662b..948b475c74383240756136ec6abea38f518a3608 --- a/lib_dec/ivas_cpe_dec.c +++ b/lib_dec/ivas_cpe_dec.c @@ -405,12 +405,8 @@ ivas_error ivas_cpe_dec( } else { - stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0 -#ifdef FIX_STEREO_474 - , - MAX_PARAM_SPATIAL_SUBFRAMES -#endif - ); + stereo_dft_dec( hCPE->hStereoDft, sts[0], DFT, hCPE->input_mem[1], hCPE->hStereoCng, 0, 0, 0, 0, 0, 0, + MAX_PARAM_SPATIAL_SUBFRAMES ); } /* synthesis iFFT */ diff --git a/lib_dec/ivas_dec.c b/lib_dec/ivas_dec.c index 82f03fdb3b24e501cc8ef073e9c1b69a220cc1d2..e53e11037ed80cc1580042b7e762b847ca3aacee 100644 --- a/lib_dec/ivas_dec.c +++ b/lib_dec/ivas_dec.c @@ -66,9 +66,7 @@ ivas_error ivas_dec( AUDIO_CONFIG output_config; float pan_left, pan_right; ivas_error error; -#ifdef JBM_TSM_ON_TCS float *p_output[MAX_OUTPUT_CHANNELS]; -#endif error = IVAS_ERR_OK; @@ -84,11 +82,7 @@ ivas_error ivas_dec( if ( st_ivas->bfi == 0 ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_dec_setup( st_ivas, NULL, NULL ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_dec_setup( st_ivas ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -105,12 +99,10 @@ ivas_error ivas_dec( output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); -#ifdef JBM_TSM_ON_TCS for ( n = 0; n < MAX_OUTPUT_CHANNELS; n++ ) { p_output[n] = &output[n][0]; } -#endif /*----------------------------------------------------------------* * Decoding + Rendering @@ -149,11 +141,7 @@ ivas_error ivas_dec( /* Rendering */ if ( st_ivas->renderer_type == RENDERER_MC ) { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); -#endif } } else if ( st_ivas->ivas_format == ISM_FORMAT ) @@ -219,11 +207,7 @@ ivas_error ivas_dec( if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { /* Convert CICP19 -> Ambisonics */ -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#else - ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif } } } @@ -244,11 +228,7 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_TD_PANNING || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ -#ifdef JBM_TSM_ON_TCS ivas_ism_render( st_ivas, p_output, output_frame ); -#else - ivas_ism_render( st_ivas, output, output_frame ); -#endif } #ifdef DEBUGGING else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) @@ -257,22 +237,14 @@ ivas_error ivas_dec( #endif { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ -#ifdef JBM_TSM_ON_TCS ivas_ism2sba( p_output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_ism, output_frame, st_ivas->hIntSetup.ambisonics_order ); -#else - ivas_ism2sba( output, st_ivas->hIsmRendererData, st_ivas->hIsmMetaData, st_ivas->nchan_ism, output_frame, st_ivas->hIntSetup.ambisonics_order ); -#endif } /* Binaural rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef JBM_TSM_ON_TCS if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) -#else - if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -280,29 +252,17 @@ ivas_error ivas_dec( else if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, -#ifdef JBM_TSM_ON_TCS p_output, -#else - output, -#endif output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#ifdef JBM_TSM_ON_TCS ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } #ifdef DEBUGGING else if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { -#ifdef JBM_TSM_ON_TCS ivas_binaural_cldfb( st_ivas, p_output ); -#else - ivas_binaural_cldfb( st_ivas, output ); -#endif } #endif } @@ -312,54 +272,17 @@ ivas_error ivas_dec( set_s( nb_bits_metadata, 0, MAX_SCE ); /* read parameters from the bitstream */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hQMetaData != NULL ) -#endif { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT ) - { - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ), - 0 ); - } - else + if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) { -#endif - if ( ( error = ivas_masa_decode( st_ivas, st, &nb_bits_metadata[0] ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifndef SBA_MODE_CLEAN_UP + return error; } -#endif } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL ) - { - st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; - -#ifndef SBA_MODE_CLEAN_UP - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ), - st_ivas->hSpar->dirac_to_spar_md_bands ); -#else - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ), - st_ivas->hSpar->dirac_to_spar_md_bands ); -#endif - } -#endif if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { @@ -416,11 +339,7 @@ ivas_error ivas_dec( { nchan_remapped = nchan_out; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -451,25 +370,15 @@ ivas_error ivas_dec( { nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame ); -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) -#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); } -#ifdef JBM_TSM_ON_TCS -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->renderer_type != RENDERER_DISABLE ) -#else else if ( st_ivas->renderer_type != RENDERER_DISABLE ) -#endif { ivas_spar_dec_agc_pca( st_ivas, output, output_frame ); } -#endif } if ( st_ivas->ivas_format == MASA_FORMAT ) @@ -500,30 +409,18 @@ ivas_error ivas_dec( { ivas_dirac_dec_binaural( st_ivas, output, nchan_remapped ); } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_DIRAC || st_ivas->ivas_format == MASA_FORMAT ) -#else else if ( st_ivas->ivas_format == MASA_FORMAT ) -#endif { if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_sba_linear_renderer( p_output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_sba_linear_renderer( output, output_frame, nchan_remapped, output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ) ) != IVAS_ERR_OK ) -#endif { return error; } } else if ( st_ivas->renderer_type == RENDERER_DIRAC ) { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec( st_ivas, output, nchan_remapped ); -#else - ivas_dirac_dec( st_ivas, output, nchan_remapped, NULL, NULL, -1 ); -#endif } } else if ( !st_ivas->sba_dirac_stereo_flag && nchan_out != 1 ) @@ -561,11 +458,7 @@ ivas_error ivas_dec( if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -#else - ivas_mc2sba( st_ivas->hTransSetup, output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -#endif } /* Rendering */ @@ -573,54 +466,30 @@ ivas_error ivas_dec( { if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, -#ifdef JBM_TSM_ON_TCS p_output, -#else - output, -#endif output_Fs ) ) != IVAS_ERR_OK ) { return error; } -#ifdef JBM_TSM_ON_TCS ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); -#endif } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#else - ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef JBM_TSM_ON_TCS if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) { return error; } ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) - { - return error; - } - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMUPMIX ) @@ -649,74 +518,42 @@ ivas_error ivas_dec( if ( st_ivas->transport_config != st_ivas->intern_config && ( st_ivas->intern_config == AUDIO_CONFIG_FOA || st_ivas->intern_config == AUDIO_CONFIG_HOA2 || st_ivas->intern_config == AUDIO_CONFIG_HOA3 ) ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hTransSetup, p_output, p_output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -#else - ivas_mc2sba( st_ivas->hTransSetup, output, output_frame, st_ivas->hIntSetup.ambisonics_order, GAIN_LFE ); -#endif } /* Rendering */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV || st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, p_output, output_Fs ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( st_ivas->hCrendWrapper, st_ivas->intern_config, st_ivas->hOutSetup.output_config, st_ivas->hDecoderConfig, st_ivas->hHeadTrackData, &st_ivas->hIntSetup, st_ivas->hEFAPdata, output, output_Fs ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef JBM_TSM_ON_TCS ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { if ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO ) || ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, audioCfg2channels( AUDIO_CONFIG_5_1_2 ), output_frame, output ); -#endif } else { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, MC_PARAMUPMIX_MAX_INPUT_CHANS, output_frame, output ); -#endif } } else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#else - ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif } else if ( st_ivas->renderer_type == RENDERER_BINAURAL_OBJECTS_TD ) { -#ifdef JBM_TSM_ON_TCS if ( ( ivas_td_binaural_renderer( st_ivas, p_output, output_frame ) ) != IVAS_ERR_OK ) -#else - if ( ( ivas_td_binaural_renderer( st_ivas, output, output_frame ) ) != IVAS_ERR_OK ) -#endif { return error; } -#ifdef JBM_TSM_ON_TCS ivas_binaural_add_LFE( st_ivas, output_frame, p_output, p_output ); -#else - ivas_binaural_add_LFE( st_ivas, output_frame, output ); -#endif } } else if ( st_ivas->mc_mode == MC_MODE_PARAMMC ) @@ -748,19 +585,11 @@ ivas_error ivas_dec( /* Rendering */ if ( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) { -#ifdef JBM_TSM_ON_TCS ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, p_output, p_output ); -#else - ivas_ls_setup_conversion( st_ivas, st_ivas->nchan_transport, output_frame, output ); -#endif } else { -#ifdef JBM_TSM_ON_TCS ivas_param_mc_dec( st_ivas, p_output ); -#else - ivas_param_mc_dec( st_ivas, output ); -#endif } } else if ( st_ivas->mc_mode == MC_MODE_MCMASA ) @@ -842,19 +671,11 @@ ivas_error ivas_dec( } else if ( st_ivas->renderer_type == RENDERER_DIRAC || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) /* rendering to CICPxx and Ambisonics */ { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport ); -#else - ivas_dirac_dec( st_ivas, output, st_ivas->nchan_transport, NULL, NULL, -1 ); -#endif if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { -#ifdef JBM_TSM_ON_TCS ivas_mc2sba( st_ivas->hIntSetup, p_output, p_output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#else - ivas_mc2sba( st_ivas->hIntSetup, output, output_frame, st_ivas->hOutSetup.ambisonics_order, 0.f ); -#endif } else if ( st_ivas->intern_config == AUDIO_CONFIG_5_1 && ( output_config == AUDIO_CONFIG_5_1_2 || output_config == AUDIO_CONFIG_5_1_4 || output_config == AUDIO_CONFIG_7_1 ) ) { @@ -878,21 +699,12 @@ ivas_error ivas_dec( * - float to integer conversion *----------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS ivas_limiter_dec( st_ivas->hLimiter, p_output, nchan_out, output_frame, st_ivas->BER_detect ); #ifdef DEBUGGING st_ivas->noClipping += #endif ivas_syn_output( p_output, output_frame, nchan_out, data ); -#else - ivas_limiter_dec( st_ivas->hLimiter, output, nchan_out, output_frame, st_ivas->BER_detect ); - -#ifdef DEBUGGING - st_ivas->noClipping += -#endif - ivas_syn_output( output, output_frame, nchan_out, data ); -#endif /*----------------------------------------------------------------* * Common updates diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c index 502420781f29ae7d824d85c65ffc51eb2d26752a..098aa348ebcca3fe32165e1288db4a82b89a7861 100644 --- a/lib_dec/ivas_dirac_dec.c +++ b/lib_dec/ivas_dirac_dec.c @@ -269,9 +269,7 @@ ivas_error ivas_dirac_dec_config( ivas_error error; int16_t nchan_transport_orig; int16_t hodirac_flag; -#ifdef JBM_TSM_ON_TCS int16_t map_idx; -#endif DIRAC_CONFIG_FLAG flag_config; flag_config = ( flag_config_inp == DIRAC_RECONFIGURE_MODE ) ? DIRAC_RECONFIGURE : flag_config_inp; @@ -302,10 +300,8 @@ ivas_error ivas_dirac_dec_config( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); } nchan_transport_old = 0; -#ifdef JBM_TSM_ON_TCS hDirAC->hParamIsm = NULL; hDirAC->hParamIsmRendering = NULL; -#endif st_ivas->hDirAC = hDirAC; } @@ -316,11 +312,7 @@ ivas_error ivas_dirac_dec_config( num_protos_diff_old = 0; nchan_transport_orig = st_ivas->nchan_transport; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) -#else if ( st_ivas->ivas_format == SBA_FORMAT && !( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) -#endif { st_ivas->nchan_transport = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -401,18 +393,12 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); -#ifdef JBM_TSM_ON_TCS set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); hDirAC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; hDirAC->subframes_rendered = 0; hDirAC->slots_rendered = 0; hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; -#else - hDirAC->subframe_nbslots = (int16_t) ( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); - hDirAC->nb_subframes = CLDFB_NO_COL_MAX / hDirAC->subframe_nbslots; - assert( hDirAC->nb_subframes <= MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif } if ( st_ivas->ivas_format == SBA_FORMAT && flag_config == DIRAC_RECONFIGURE && ( ( ivas_total_brate > IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate <= IVAS_256k ) || ( ivas_total_brate <= IVAS_256k && st_ivas->hDecoderConfig->last_ivas_total_brate > IVAS_256k ) ) ) @@ -431,11 +417,7 @@ ivas_error ivas_dirac_dec_config( } /* band config needed only for SPAR with FOA output */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->sba_mode == SBA_MODE_SPAR && !hodirac_flag ) -#else if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA && st_ivas->ivas_format == SBA_FORMAT && !hodirac_flag ) -#endif { return IVAS_ERR_OK; } @@ -597,11 +579,7 @@ ivas_error ivas_dirac_dec_config( set_s( hDirAC->proto_index_diff, 0, hDirAC->num_outputs_diff ); hDirAC->sba_map_tc = sba_map_tc; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { if ( st_ivas->sba_order > SBA_FOA_ORDER && ivas_total_brate >= IVAS_512k ) { @@ -706,11 +684,7 @@ ivas_error ivas_dirac_dec_config( { hDirAC->num_protos_diff = 1; hDirAC->num_protos_dir = nchan_transport; -#ifndef SBA_MODE_CLEAN_UP - if ( ( st_ivas->sba_planar ) && ( !( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) ) ) -#else if ( ( st_ivas->sba_planar ) && ( !( st_ivas->ivas_format == SBA_FORMAT ) ) ) -#endif { hDirAC->num_protos_dir++; } @@ -820,11 +794,7 @@ ivas_error ivas_dirac_dec_config( if ( flag_config == DIRAC_OPEN ) { hDirAC->hoa_decoder = NULL; -#ifndef SBA_MODE_CLEAN_UP - if ( ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) || st_ivas->sba_mode == SBA_MODE_SPAR || ( nchan_transport > 2 ) ) -#else if ( ( hDirAC->panningConf == DIRAC_PANNING_HOA3 ) || st_ivas->ivas_format == SBA_FORMAT || ( nchan_transport > 2 ) ) -#endif { if ( hDirAC->hOutSetup.is_loudspeaker_setup ) { @@ -1035,63 +1005,38 @@ ivas_error ivas_dirac_dec_config( { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef JBM_TSM_ON_TCS set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) { hDirAC->render_to_md_map[map_idx] = map_idx; } - -#endif } else if ( st_ivas->ivas_format == MASA_FORMAT ) { hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_MASA_PARAM_DEC_SFR; hDirAC->dirac_bs_md_write_idx = DELAY_MASA_PARAM_DEC_SFR; -#ifdef JBM_TSM_ON_TCS set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); for ( map_idx = 0; map_idx < DEFAULT_JBM_SUBFRAMES_5MS; map_idx++ ) { hDirAC->render_to_md_map[map_idx] = map_idx; } -#endif } else { int16_t num_slots_in_subfr; num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) - { -#ifdef FIX_393_459_460_SBA_MD - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; -#else - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES * num_slots_in_subfr; -#endif - hDirAC->dirac_bs_md_write_idx = 0; - hDirAC->spar_to_dirac_write_idx = 0; - hDirAC->dirac_read_idx = 0; - hDirAC->dirac_estimator_idx = 0; - } - else - { -#endif #ifdef FIX_393_459_460_SBA_MD - hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); - hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; - hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; + hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ); + hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; + hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR; #else hDirAC->dirac_md_buffer_length = ( MAX_PARAM_SPATIAL_SUBFRAMES + DELAY_DIRAC_PARAM_DEC_SFR ) * num_slots_in_subfr; hDirAC->dirac_bs_md_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; hDirAC->spar_to_dirac_write_idx = DELAY_DIRAC_PARAM_DEC_SFR * num_slots_in_subfr; #endif - hDirAC->dirac_read_idx = 0; - hDirAC->dirac_estimator_idx = 0; -#ifndef SBA_MODE_CLEAN_UP - } -#endif -#ifdef JBM_TSM_ON_TCS + hDirAC->dirac_read_idx = 0; + hDirAC->dirac_estimator_idx = 0; set_s( hDirAC->render_to_md_map, 0, MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME ); #ifdef FIX_393_459_460_SBA_MD @@ -1106,7 +1051,6 @@ ivas_error ivas_dirac_dec_config( hDirAC->render_to_md_map[map_idx] = hDirAC->dirac_read_idx + map_idx * num_slots_in_subfr / JBM_CLDFB_SLOTS_IN_SUBFRAME; #endif } -#endif } if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 1 ) ) != IVAS_ERR_OK ) @@ -1139,11 +1083,7 @@ ivas_error ivas_dirac_dec_config( { int16_t num_slots_in_subfr; num_slots_in_subfr = hDirAC->hConfig->dec_param_estim ? CLDFB_NO_COL_MAX / MAX_PARAM_SPATIAL_SUBFRAMES : 1; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { if ( ( hDirAC->hConfig->dec_param_estim_old != hDirAC->hConfig->dec_param_estim ) ) { @@ -1162,17 +1102,12 @@ ivas_error ivas_dirac_dec_config( } } #endif -#ifdef JBM_TSM_ON_TCS /* allocate transport channels*/ if ( flag_config == DIRAC_OPEN ) { if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { int16_t nchan_to_allocate; @@ -1192,7 +1127,6 @@ ivas_error ivas_dirac_dec_config( } } } -#endif /* JBM_TMS_ON_TCS*/ return error; } @@ -1764,11 +1698,8 @@ void ivas_dirac_dec_read_BS( DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata */ int16_t *nb_bits, /* o : number of bits read */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#endif - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t i, j, b, dir, orig_dirac_bands; @@ -1783,79 +1714,40 @@ void ivas_dirac_dec_read_BS( b = st->bit_stream[( st->next_bit_pos )--]; ( *nb_bits )++; -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode != SBA_MODE_SPAR ) - { - assert( ( b == 0 ) || ( hQMetaData->q_direction[0].cfg.start_band > 0 ) ); - } -#endif if ( b == 1 ) /* WB 4TCs condition, no other metadata to read*/ { -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode != SBA_MODE_SPAR ) - { - if ( hDirAC != NULL ) - { - /* No Data transmitted*/ - hQMetaData->q_direction[0].cfg.nblocks = 0; - for ( dir = 0; dir < hQMetaData->no_directions; dir++ ) - { - for ( b = 0; b < hQMetaData->q_direction[dir].cfg.nbands; b++ ) - { - set_zero( hQMetaData->q_direction[dir].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[dir].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[dir].band_data[b].energy_ratio_index[i] = 0; - } - } - } - } - } - } - else - { -#endif - orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; + orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - hQMetaData->sba_inactive_mode = 1; + hQMetaData->sba_inactive_mode = 1; - /* if we start with a SID frame, we need to init the azi/ele arrays.*/ - if ( st->ini_frame == 0 ) + /* if we start with a SID frame, we need to init the azi/ele arrays.*/ + if ( st->ini_frame == 0 ) + { + for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) { - for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) - { - set_zero( hQMetaData->q_direction[0].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); - set_zero( hQMetaData->q_direction[0].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); - } + set_zero( hQMetaData->q_direction[0].band_data[b].azimuth, MAX_PARAM_SPATIAL_SUBFRAMES ); + set_zero( hQMetaData->q_direction[0].band_data[b].elevation, MAX_PARAM_SPATIAL_SUBFRAMES ); } + } -#ifndef SBA_MODE_CLEAN_UP - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, sba_mode ); -#else *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); -#endif - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; + } + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) + { + for ( j = orig_dirac_bands - 2; j >= 0; j-- ) { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } + hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; + hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; + hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; } - - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; -#ifndef SBA_MODE_CLEAN_UP } -#endif + + hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; } else { @@ -1905,55 +1797,33 @@ void ivas_dirac_dec_read_BS( } } -#ifndef SBA_MODE_CLEAN_UP - *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT, sba_mode ); -#else *nb_bits += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), 0, NULL, SBA_FORMAT ); -#endif -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { -#endif - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } - } - - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; -#ifndef SBA_MODE_CLEAN_UP + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; + hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; } - else + for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) { - *nb_bits += SID_FORMAT_NBITS; + for ( j = orig_dirac_bands - 2; j >= 0; j-- ) + { + hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; + hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; + hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; + } } -#endif + hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; st->next_bit_pos = next_bit_pos_orig; } if ( hDirAC != NULL ) { -#ifndef SBA_MODE_CLEAN_UP - ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, sba_mode, - hodirac_flag, - dirac_to_spar_md_bands ); -#else ivas_qmetadata_to_dirac( hQMetaData, hDirAC, NULL, ivas_total_brate, SBA_FORMAT, hodirac_flag, dirac_to_spar_md_bands ); -#endif } return; @@ -1971,13 +1841,9 @@ void ivas_qmetadata_to_dirac( DIRAC_DEC_HANDLE hDirAC, /* o : DirAC decoder structure */ MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#else - const IVAS_FORMAT ivas_format, /* i : IVAS format */ -#endif - const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ - int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ + const IVAS_FORMAT ivas_format, /* i : IVAS format */ + const int16_t hodirac_flag, /* i : flag to indicate HO-DirAC mode */ + int16_t *dirac_to_spar_md_bands /* o : DirAC->SPAR MD bands */ ) { int16_t block, band; @@ -2100,11 +1966,7 @@ void ivas_qmetadata_to_dirac( nbands = hDirAC->band_grouping[hDirAC->hConfig->nbands]; band_grouping = hDirAC->band_grouping; -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_total_brate <= IVAS_SID_5k2 && sba_mode != SBA_MODE_SPAR ) -#else if ( ivas_total_brate <= IVAS_SID_5k2 && ivas_format != SBA_FORMAT ) -#endif { /* SID/zero-frame: 1 direction, 5 bands, nblocks re-generated out of SID decoder*/ start_band = 0; @@ -2115,11 +1977,7 @@ void ivas_qmetadata_to_dirac( else { start_band = hDirAC->hConfig->enc_param_start_band; -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { hDirAC->hConfig->nbands = IVAS_MAX_NUM_BANDS; } @@ -2144,29 +2002,20 @@ void ivas_qmetadata_to_dirac( { band_start = band_grouping[band]; band_end = band_grouping[band + 1]; -#ifdef JBM_TSM_ON_TCS tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#else - for ( block = 0; block < hDirAC->nb_subframes; block++ ) -#endif { -#ifdef JBM_TSM_ON_TCS #ifndef FIX_393_459_460_SBA_MD ts_start = hDirAC->block_grouping[block]; ts_end = hDirAC->block_grouping[block + 1]; -#endif #endif for ( b = band_start; b < band_end; b++ ) { -#ifdef JBM_TSM_ON_TCS tmp_write_idx_band = tmp_write_idx_param_band; -#endif hDirAC->spreadCoherence[block][b] = 0.0f; hDirAC->surroundingCoherence[block][b] = 0.0f; -#ifdef JBM_TSM_ON_TCS #ifndef FIX_393_459_460_SBA_MD if ( hDirAC->hConfig->dec_param_estim == FALSE ) { @@ -2196,7 +2045,6 @@ void ivas_qmetadata_to_dirac( tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; } } -#endif #endif } } @@ -2216,11 +2064,7 @@ void ivas_qmetadata_to_dirac( band_end = band_grouping[band + 1]; tmp_write_idx_param_band = hDirAC->dirac_bs_md_write_idx; -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { qBand_idx = dirac_to_spar_md_bands[band] - start_band; } @@ -2234,11 +2078,7 @@ void ivas_qmetadata_to_dirac( #endif diff_idx = q_direction->band_data[qBand_idx].energy_ratio_index[0]; -#ifdef JBM_TSM_ON_TCS for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#else - for ( block = 0; block < hDirAC->nb_subframes; block++ ) -#endif { int16_t block_qmetadata; @@ -2365,11 +2205,7 @@ void ivas_qmetadata_to_dirac( { tmp_write_idx_band = hDirAC->dirac_bs_md_write_idx; -#ifdef JBM_TSM_ON_TCS for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#else - for ( block = 0; block < hDirAC->nb_subframes; block++ ) -#endif { #ifndef FIX_393_459_460_SBA_MD ts_start = hDirAC->block_grouping[block]; @@ -2387,11 +2223,9 @@ void ivas_qmetadata_to_dirac( hDirAC->elevation[tmp_write_idx_band][b] = 0; hDirAC->azimuth[tmp_write_idx_band][b] = 0; hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; -#ifdef JBM_TSM_ON_TCS hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; -#endif tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; #ifndef FIX_393_459_460_SBA_MD } @@ -2402,11 +2236,9 @@ void ivas_qmetadata_to_dirac( hDirAC->elevation[tmp_write_idx_band][b] = 0; hDirAC->azimuth[tmp_write_idx_band][b] = 0; hDirAC->diffuseness_vector[tmp_write_idx_band][b] = 0.f; -#ifdef JBM_TSM_ON_TCS hDirAC->spreadCoherence[tmp_write_idx_band][b] = 0.0f; hDirAC->surroundingCoherence[tmp_write_idx_band][b] = 0.0f; hDirAC->energy_ratio1[tmp_write_idx_band][b] = 0; -#endif tmp_write_idx_band = ( tmp_write_idx_band + 1 ) % hDirAC->dirac_md_buffer_length; } } @@ -2432,7 +2264,6 @@ void ivas_qmetadata_to_dirac( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------------- * ivas_dirac_dec_set_md_map() * @@ -2538,11 +2369,7 @@ void ivas_dirac_dec( st_ivas->hTcBuffer->tc[n] = output_f[n]; } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) -#endif { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; @@ -2572,11 +2399,7 @@ void ivas_dirac_dec( { st_ivas->hTcBuffer->tc[n] = NULL; } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) -#endif { st_ivas->hTcBuffer->tc[nchan_transport] = NULL; } @@ -2657,7 +2480,6 @@ void ivas_dirac_dec_render( return; } -#endif /*------------------------------------------------------------------------- @@ -2666,25 +2488,12 @@ void ivas_dirac_dec_render( * DirAC decoding process *------------------------------------------------------------------------*/ -#ifndef JBM_TSM_ON_TCS -void ivas_dirac_dec( -#else void ivas_dirac_dec_render_sf( -#endif - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t nchan_transport, /* i : number of transport channels */ float *pppQMfFrame_ts_re[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX], - float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] -#ifndef JBM_TSM_ON_TCS - , - const int16_t i_sf -#endif -) + float *pppQMfFrame_ts_im[IVAS_MAX_FB_MIXER_IN_CH][CLDFB_NO_COL_MAX] ) { int16_t i, ch, idx_in, idx_lfe; DIRAC_DEC_HANDLE hDirAC; @@ -2692,15 +2501,10 @@ void ivas_dirac_dec_render_sf( float surCohEner; float surCohRatio[CLDFB_NO_CHANNELS_MAX]; int16_t subframe_idx; -#ifndef JBM_TSM_ON_TCS - int16_t sf1, sf2; -#endif int16_t slot_idx, index_slot; int16_t hodirac_flag; float *p_Rmat; -#ifdef JBM_TSM_ON_TCS int16_t slot_idx_start, slot_idx_start_cldfb_synth, md_idx; -#endif /*CLDFB: last output channels reserved to LFT for CICPx*/ float Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; @@ -2709,7 +2513,6 @@ void ivas_dirac_dec_render_sf( float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; int16_t index, num_freq_bands; -#ifdef JBM_TSM_ON_TCS /* local copies of azi, ele, diffuseness */ #ifdef FIX_393_459_460_SBA_MD int16_t azimuth[CLDFB_NO_CHANNELS_MAX]; @@ -2719,7 +2522,6 @@ void ivas_dirac_dec_render_sf( int16_t azimuth[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; int16_t elevation[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; float diffuseness_vector[JBM_CLDFB_SLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; -#endif #endif DIRAC_DEC_STACK_MEM DirAC_mem; @@ -2727,11 +2529,7 @@ void ivas_dirac_dec_render_sf( float *onset_filter, *onset_filter_subframe, *p_onset_filter = NULL; uint16_t coherence_flag; -#ifndef JBM_TSM_ON_TCS - push_wmops( "ivas_dirac_dec" ); -#else push_wmops( "ivas_dirac_dec_render" ); -#endif /* Initialize aux buffers */ hDirAC = st_ivas->hDirAC; @@ -2745,11 +2543,7 @@ void ivas_dirac_dec_render_sf( hodirac_flag = ivas_get_hodirac_flag( st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ); -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT ) -#else - if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) -#endif { coherence_flag = st_ivas->hQMetaData->coherence_flag; } @@ -2777,30 +2571,10 @@ void ivas_dirac_dec_render_sf( #endif /* Subframe loop */ -#ifndef JBM_TSM_ON_TCS - if ( i_sf == -1 ) - { - sf1 = 0; - sf2 = hDirAC->nb_subframes; - } - else - { - sf1 = i_sf; - sf2 = i_sf + 1; - } -#endif -#ifdef JBM_TSM_ON_TCS slot_idx_start = hDirAC->slots_rendered; slot_idx_start_cldfb_synth = 0; -#endif -#ifdef JBM_TSM_ON_TCS subframe_idx = hDirAC->subframes_rendered; -#else - for ( subframe_idx = sf1; subframe_idx < sf2; subframe_idx++ ) - { -#endif -#ifdef JBM_TSM_ON_TCS if ( hDirAC->hConfig->dec_param_estim == FALSE ) { md_idx = hDirAC->render_to_md_map[subframe_idx]; @@ -2809,31 +2583,7 @@ void ivas_dirac_dec_render_sf( { md_idx = hDirAC->render_to_md_map[slot_idx_start]; } -#endif -#ifdef JBM_TSM_ON_TCS /* Another workaround for self test BE */ -#ifndef FIX_642 - if ( st_ivas->hHeadTrackData && st_ivas->hDecoderConfig->voip_active == 0 ) - { - QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); - - p_Rmat = &st_ivas->hHeadTrackData->Rmat[0][0]; - - if ( st_ivas->hHeadTrackData->shd_rot_max_order == 0 ) - { - num_freq_bands = hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band]; - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) - { - index_slot = slot_idx_start + slot_idx; - rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); - } - } - } - else - { - p_Rmat = 0; - } -#endif /* copy parameters into local buffers*/ #ifdef FIX_393_459_460_SBA_MD @@ -2866,7 +2616,6 @@ void ivas_dirac_dec_render_sf( mvr2r( hDirAC->diffuseness_vector[hDirAC->render_to_md_map[subframe_idx]], diffuseness_vector[slot_idx], hDirAC->num_freq_bands ); } } -#endif #endif if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) @@ -2878,15 +2627,7 @@ void ivas_dirac_dec_render_sf( set_zero( onset_filter_subframe, hDirAC->num_freq_bands ); } -#ifdef JBM_TSM_ON_TCS - if ( st_ivas->hHeadTrackData -#ifndef FIX_642 - && st_ivas->hDecoderConfig->voip_active == 1 -#endif - ) -#else - if ( st_ivas->hHeadTrackData ) -#endif + if ( st_ivas->hHeadTrackData ) { QuatToRotMat( st_ivas->hHeadTrackData->Quaternions[st_ivas->hHeadTrackData->num_quaternions++], st_ivas->hHeadTrackData->Rmat ); @@ -2901,29 +2642,14 @@ void ivas_dirac_dec_render_sf( rotateAziEle_DirAC( azimuth, elevation, num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); } #else -#ifdef JBM_TSM_ON_TCS - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif - { -#ifdef JBM_TSM_ON_TCS - rotateAziEle_DirAC( azimuth[slot_idx], elevation[slot_idx], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); -#else - /* note, this seems wrong since it does not take the dirac read ptr into account */ - index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; - /* Todo: This access to azimuth & elevation may use wrong indices as access should probably be based on hDirAC->dirac_read_idx */ - rotateAziEle_DirAC( hDirAC->azimuth[index_slot], hDirAC->elevation[index_slot], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); -#endif - } + for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) + { + rotateAziEle_DirAC( azimuth[slot_idx], elevation[slot_idx], num_freq_bands, hDirAC->num_freq_bands, p_Rmat ); + } #endif } } -#if defined( JBM_TSM_ON_TCS ) & !defined( FIX_642 ) - else if ( !st_ivas->hHeadTrackData ) -#else - else -#endif + else { p_Rmat = 0; } @@ -2934,14 +2660,10 @@ void ivas_dirac_dec_render_sf( if ( hDirAC->synthesisConf != DIRAC_SYNTHESIS_GAIN_SHD ) { ivas_dirac_dec_compute_power_factors( hDirAC->num_freq_bands, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD diffuseness_vector, #else diffuseness_vector[0], -#endif -#else - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], #endif hDirAC->h_output_synthesis_psd_params.max_band_decorr, hDirAC->h_output_synthesis_psd_state.direct_power_factor, @@ -2952,11 +2674,7 @@ void ivas_dirac_dec_render_sf( for ( i = 0; i < hDirAC->num_freq_bands; i++ ) { dirEne = hDirAC->h_output_synthesis_psd_state.direct_power_factor[i]; -#ifdef JBM_TSM_ON_TCS surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[md_idx][i]; -#else - surCohEner = hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] * hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; -#endif hDirAC->h_output_synthesis_psd_state.diffuse_power_factor[i] -= surCohEner; hDirAC->h_output_synthesis_psd_state.direct_power_factor[i] += surCohEner; @@ -2971,11 +2689,7 @@ void ivas_dirac_dec_render_sf( else { ivas_dirac_dec_compute_gain_factors( hDirAC->num_freq_bands, -#ifdef JBM_TSM_ON_TCS hDirAC->diffuseness_vector[md_idx], -#else - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], -#endif hDirAC->h_output_synthesis_psd_params.max_band_decorr, hDirAC->h_output_synthesis_psd_state.direct_power_factor, hDirAC->h_output_synthesis_psd_state.diffuse_power_factor ); @@ -2984,11 +2698,7 @@ void ivas_dirac_dec_render_sf( { for ( i = 0; i < hDirAC->num_freq_bands; i++ ) { -#ifdef JBM_TSM_ON_TCS surCohRatio[i] = hDirAC->surroundingCoherence[md_idx][i]; -#else - surCohRatio[i] = hDirAC->surroundingCoherence[hDirAC->dirac_read_idx][i]; -#endif } } else @@ -3002,7 +2712,6 @@ void ivas_dirac_dec_render_sf( ivas_dirac_dec_compute_directional_responses( hDirAC, st_ivas->hVBAPdata, st_ivas->hMasa, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD azimuth, elevation, @@ -3011,7 +2720,6 @@ void ivas_dirac_dec_render_sf( hDirAC->elevation[md_idx], #endif md_idx, -#endif surCohRatio, st_ivas->hHeadTrackData->shd_rot_max_order, p_Rmat, @@ -3022,7 +2730,6 @@ void ivas_dirac_dec_render_sf( ivas_dirac_dec_compute_directional_responses( hDirAC, st_ivas->hVBAPdata, st_ivas->hMasa, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD azimuth, elevation, @@ -3031,7 +2738,6 @@ void ivas_dirac_dec_render_sf( hDirAC->elevation[md_idx], #endif md_idx, -#endif surCohRatio, 0, NULL, @@ -3039,13 +2745,8 @@ void ivas_dirac_dec_render_sf( } } -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { -#ifdef JBM_TSM_ON_TCS index_slot = slot_idx_start + slot_idx; if ( hDirAC->hConfig->dec_param_estim == TRUE ) { @@ -3055,15 +2756,8 @@ void ivas_dirac_dec_render_sf( { md_idx = hDirAC->render_to_md_map[subframe_idx]; } -#else - index_slot = subframe_idx * hDirAC->subframe_nbslots + slot_idx; -#endif -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { for ( ch = 0; ch < nchan_transport; ch++ ) { @@ -3076,38 +2770,22 @@ void ivas_dirac_dec_render_sf( /* CLDFB Analysis*/ for ( ch = 0; ch < nchan_transport; ch++ ) { -#ifdef JBM_TSM_ON_TCS cldfbAnalysis_ts( &( st_ivas->hTcBuffer->tc[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), Cldfb_RealBuffer[ch][0], Cldfb_ImagBuffer[ch][0], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); -#else - cldfbAnalysis_ts( &( output_f[hDirAC->sba_map_tc[ch]][hDirAC->num_freq_bands * index_slot] ), - Cldfb_RealBuffer[ch][0], - Cldfb_ImagBuffer[ch][0], - hDirAC->num_freq_bands, - st_ivas->cldfbAnaDec[ch] ); -#endif } } /* CNG in DirAC, extra CLDFB ana for CNA*/ -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format != SBA_FORMAT ) -#else - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) -#endif { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; generate_masking_noise_dirac( st->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], -#ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer->tc[1], -#else - &( output_f[1][L_FRAME48k - L_FRAME16k] ), -#endif Cldfb_RealBuffer[1][0], Cldfb_ImagBuffer[1][0], index_slot, @@ -3122,11 +2800,7 @@ void ivas_dirac_dec_render_sf( Cldfb_RealBuffer, Cldfb_ImagBuffer, Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1], Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1], slot_idx, -#ifdef JBM_TSM_ON_TCS md_idx, -#else - subframe_idx, -#endif nchan_transport ); } @@ -3242,17 +2916,12 @@ void ivas_dirac_dec_render_sf( hDirAC->buffer_intensity_real[1][index - 1], hDirAC->buffer_intensity_real[2][index - 1], num_freq_bands, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD azimuth, elevation #else azimuth[slot_idx], elevation[slot_idx] -#endif -#else - hDirAC->azimuth[hDirAC->dirac_estimator_idx], - hDirAC->elevation[hDirAC->dirac_estimator_idx] #endif ); @@ -3261,21 +2930,12 @@ void ivas_dirac_dec_render_sf( computeDiffuseness( hDirAC->buffer_intensity_real, hDirAC->buffer_energy, num_freq_bands, -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD hDirAC->diffuseness_vector[md_idx] #else diffuseness_vector[slot_idx] -#endif -#else - hDirAC->diffuseness_vector[hDirAC->dirac_estimator_idx] #endif ); - - -#ifndef JBM_TSM_ON_TCS - hDirAC->dirac_estimator_idx = ( hDirAC->dirac_estimator_idx + 1 ) % hDirAC->dirac_md_buffer_length; -#endif } #ifdef DEBUG_MODE_DIRAC @@ -3397,81 +3057,52 @@ void ivas_dirac_dec_render_sf( } /*Compute PSDs*/ -#ifndef JBM_TSM_ON_TCS - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order == 2 ) + if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) { ivas_dirac_dec_output_synthesis_process_slot( reference_power, p_onset_filter, +#ifdef FIX_393_459_460_SBA_MD + azimuth, + elevation, + hDirAC->diffuseness_vector[md_idx], +#else + azimuth[slot_idx], + elevation[slot_idx], + diffuseness_vector[slot_idx], +#endif hDirAC, + st_ivas->hHeadTrackData->shd_rot_max_order, p_Rmat, st_ivas->hVBAPdata, hDirAC->hOutSetup, nchan_transport, - st_ivas->sba_analysis_order > 1 && - st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k ); + md_idx, + hodirac_flag + + ); } else { ivas_dirac_dec_output_synthesis_process_slot( reference_power, p_onset_filter, +#ifdef FIX_393_459_460_SBA_MD + azimuth, + elevation, + hDirAC->diffuseness_vector[md_idx], +#else + azimuth[slot_idx], + elevation[slot_idx], + diffuseness_vector[slot_idx], +#endif hDirAC, 0, + 0, st_ivas->hVBAPdata, hDirAC->hOutSetup, nchan_transport, - st_ivas->sba_analysis_order > 1 && - st_ivas->hDecoderConfig->ivas_total_brate > IVAS_256k - - ); + md_idx, + hodirac_flag ); } -#else - if ( st_ivas->hDecoderConfig->Opt_Headrotation && st_ivas->hHeadTrackData->shd_rot_max_order > 0 ) - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, -#ifdef FIX_393_459_460_SBA_MD - azimuth, - elevation, - hDirAC->diffuseness_vector[md_idx], -#else - azimuth[slot_idx], - elevation[slot_idx], - diffuseness_vector[slot_idx], -#endif - hDirAC, - st_ivas->hHeadTrackData->shd_rot_max_order, - p_Rmat, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag - - ); - } - else - { - ivas_dirac_dec_output_synthesis_process_slot( reference_power, - p_onset_filter, -#ifdef FIX_393_459_460_SBA_MD - azimuth, - elevation, - hDirAC->diffuseness_vector[md_idx], -#else - azimuth[slot_idx], - elevation[slot_idx], - diffuseness_vector[slot_idx], -#endif - hDirAC, - 0, - 0, - st_ivas->hVBAPdata, - hDirAC->hOutSetup, - nchan_transport, - md_idx, - hodirac_flag ); - } -#endif #ifdef FIX_393_459_460_SBA_MD if ( hDirAC->hConfig->dec_param_estim ) @@ -3485,22 +3116,8 @@ void ivas_dirac_dec_render_sf( { v_add( reference_power, reference_power_smooth, reference_power_smooth, hDirAC->num_freq_bands ); } - -#ifndef JBM_TSM_ON_TCS - if ( hDirAC->hConfig->dec_param_estim ) - { - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; - } -#endif } -#ifndef JBM_TSM_ON_TCS - if ( hDirAC->hConfig->dec_param_estim == 0 ) - { - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; - } -#endif -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec_output_synthesis_get_interpolator( &hDirAC->h_output_synthesis_psd_params, hDirAC->subframe_nbslots[subframe_idx] ); #ifndef FIX_393_459_460_SBA_MD @@ -3543,23 +3160,18 @@ void ivas_dirac_dec_render_sf( } #endif -#endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC, nchan_transport, -#ifdef JBM_TSM_ON_TCS hDirAC->subframe_nbslots[subframe_idx], -#endif p_onset_filter, #ifdef FIX_393_459_460_SBA_MD diffuseness_vector, #else -#ifdef JBM_TSM_ON_TCS - md_idx, -#endif + md_idx, #endif hodirac_flag ); } @@ -3574,7 +3186,6 @@ void ivas_dirac_dec_render_sf( qualityBasedSmFactor *= qualityBasedSmFactor; } -#ifdef JBM_TSM_ON_TCS #ifndef FIX_393_459_460_SBA_MD /* Workaround for BE (should be gone when #393 is adressed) */ if ( hDirAC->hConfig->dec_param_estim == 1 ) @@ -3589,17 +3200,14 @@ void ivas_dirac_dec_render_sf( } #endif -#endif ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( Cldfb_RealBuffer, Cldfb_ImagBuffer, hDirAC, -#ifdef JBM_TSM_ON_TCS hDirAC->subframe_nbslots[subframe_idx], #ifdef FIX_393_459_460_SBA_MD diffuseness_vector, #else md_idx, -#endif #endif reference_power_smooth, qualityBasedSmFactor ); @@ -3609,20 +3217,14 @@ void ivas_dirac_dec_render_sf( * CLDFB synthesis (and binaural rendering) *-----------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS index_slot = slot_idx_start_cldfb_synth; -#else - index_slot = subframe_idx * hDirAC->subframe_nbslots; -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) { /* Perform binaural rendering */ ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, -#ifdef JBM_TSM_ON_TCS hDirAC->subframe_nbslots[subframe_idx], -#endif Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, @@ -3635,44 +3237,24 @@ void ivas_dirac_dec_render_sf( float *RealBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; float *ImagBuffer[MAX_PARAM_SPATIAL_SUBFRAMES]; -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; } -#ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); -#else - cldfbSynthesis( RealBuffer, - ImagBuffer, - &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots, - st_ivas->cldfbSynDec[ch] ); -#endif } } -#ifdef SBA_MODE_CLEAN_UP else if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { for ( ch = 0; ch < hDirAC->hOutSetup.nchan_out_woLFE; ch++ ) { -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { mvr2r( Cldfb_RealBuffer[ch][slot_idx], pppQMfFrame_ts_re[ch][slot_idx], hDirAC->num_freq_bands ); mvr2r( Cldfb_ImagBuffer[ch][slot_idx], pppQMfFrame_ts_im[ch][slot_idx], hDirAC->num_freq_bands ); @@ -3704,11 +3286,7 @@ void ivas_dirac_dec_render_sf( float tmp_separated[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; float tmp_lfe[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; const int16_t subframe_start_sample = index_slot * hDirAC->num_freq_bands; -#ifdef JBM_TSM_ON_TCS const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx]; -#else - const int16_t num_samples_subframe = hDirAC->num_freq_bands * hDirAC->subframe_nbslots; -#endif /* Move the separated and the LFE channels to temporary variables as spatial synthesis may overwrite current channels */ mvr2r( &( output_f[st_ivas->hOutSetup.separateChannelIndex][subframe_start_sample] ), tmp_separated, num_samples_subframe ); @@ -3735,11 +3313,7 @@ void ivas_dirac_dec_render_sf( else { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; @@ -3765,20 +3339,12 @@ void ivas_dirac_dec_render_sf( { if ( st_ivas->mc_mode == MC_MODE_MCMASA && !hDirAC->hOutSetup.separateChannelEnabled ) { -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer[MAX_OUTPUT_CHANNELS - 1][i]; ImagBuffer[i] = Cldfb_ImagBuffer[MAX_OUTPUT_CHANNELS - 1][i]; } -#ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); -#else - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[hDirAC->hOutSetup.nchan_out_woLFE + idx_lfe] ); -#endif } else if ( st_ivas->mc_mode == MC_MODE_MCMASA && hDirAC->hOutSetup.separateChannelEnabled ) { @@ -3786,11 +3352,7 @@ void ivas_dirac_dec_render_sf( } else { -#ifdef JBM_TSM_ON_TCS set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); -#else - set_zero( &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); -#endif } if ( idx_lfe < ( hDirAC->hOutSetup.num_lfe - 1 ) ) @@ -3806,36 +3368,23 @@ void ivas_dirac_dec_render_sf( else { /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } -#ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[idx_in] ); -#else - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][index_slot * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[idx_in] ); -#endif idx_in++; } } } } -#ifdef JBM_TSM_ON_TCS hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe_idx]; hDirAC->subframes_rendered++; -#endif -#ifndef JBM_TSM_ON_TCS -} -#endif -pop_wmops(); + pop_wmops(); -return; + return; } diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c index ffe6fea38249029d090ac8ee38e6171705641479..d71d8165577f409ccbf74b5ef60a854d0cf77d13 100644 --- a/lib_dec/ivas_dirac_output_synthesis_cov.c +++ b/lib_dec/ivas_dirac_output_synthesis_cov.c @@ -105,22 +105,18 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); -#ifdef JBM_TSM_ON_TCS if ( ( h_dirac_output_synthesis_state->mixing_matrix[idx] = (float *) malloc( nchan_out * nchan_in * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); -#endif } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { h_dirac_output_synthesis_state->cx_old[idx] = NULL; h_dirac_output_synthesis_state->cy_old[idx] = NULL; h_dirac_output_synthesis_state->mixing_matrix_old[idx] = NULL; -#ifdef JBM_TSM_ON_TCS h_dirac_output_synthesis_state->mixing_matrix[idx] = NULL; -#endif } for ( idx = 0; idx < num_param_bands_residual; idx++ ) @@ -131,20 +127,16 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); -#ifdef JBM_TSM_ON_TCS if ( ( h_dirac_output_synthesis_state->mixing_matrix_res[idx] = (float *) malloc( nchan_out * nchan_out * sizeof( float ) ) ) == NULL ) { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis matrix\n" ) ); } set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); -#endif } for ( ; idx < CLDFB_NO_CHANNELS_MAX; idx++ ) { h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = NULL; -#ifdef JBM_TSM_ON_TCS h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; -#endif } /*-----------------------------------------------------------------* @@ -168,7 +160,6 @@ ivas_error ivas_dirac_dec_output_synthesis_cov_open( } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_dirac_dec_output_synthesis_get_interpolator() * @@ -189,7 +180,6 @@ void ivas_dirac_dec_output_synthesis_get_interpolator( return; } -#endif /*-------------------------------------------------------------------* @@ -215,17 +205,13 @@ void ivas_dirac_dec_output_synthesis_cov_init( set_zero( h_dirac_output_synthesis_state->cx_old[idx], nchan_in * nchan_in ); set_zero( h_dirac_output_synthesis_state->cy_old[idx], nchan_out * nchan_out ); set_zero( h_dirac_output_synthesis_state->mixing_matrix_old[idx], nchan_out * nchan_in ); -#ifdef JBM_TSM_ON_TCS set_zero( h_dirac_output_synthesis_state->mixing_matrix[idx], nchan_out * nchan_in ); -#endif } for ( idx = 0; idx < n_param_bands_res; idx++ ) { set_zero( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx], nchan_out * nchan_out ); -#ifdef JBM_TSM_ON_TCS set_zero( h_dirac_output_synthesis_state->mixing_matrix_res[idx], nchan_out * nchan_out ); -#endif } return; @@ -297,7 +283,6 @@ void ivas_dirac_dec_output_synthesis_cov_close( h_dirac_output_synthesis_state->mixing_matrix_res_old[idx] = NULL; } -#ifdef JBM_TSM_ON_TCS if ( h_dirac_output_synthesis_state->mixing_matrix[idx] != NULL ) { free( h_dirac_output_synthesis_state->mixing_matrix[idx] ); @@ -309,7 +294,6 @@ void ivas_dirac_dec_output_synthesis_cov_close( free( h_dirac_output_synthesis_state->mixing_matrix_res[idx] ); h_dirac_output_synthesis_state->mixing_matrix_res[idx] = NULL; } -#endif } return; @@ -323,21 +307,12 @@ void ivas_dirac_dec_output_synthesis_cov_close( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( -#ifdef JBM_TSM_ON_TCS - float *RealBuffer, /* i : input channel filter bank samples (real part) */ - float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ -#else - float RealBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (real part) */ - float ImagBuffer[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : input channel filter bank samples (imaginary part */ -#endif + float *RealBuffer, /* i : input channel filter bank samples (real part) */ + float *ImagBuffer, /* i : input channel filter bank samples (imaginary part */ float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */ float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (imaginary part) */ PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */ const int16_t nchan_in /* i : number of input channels */ -#ifndef JBM_TSM_ON_TCS - , - const int16_t idx_slot /* i : index of the slot to be added to the input covariance */ -#endif ) { int16_t param_band, band_idx, ch_idx; @@ -363,13 +338,8 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( int16_t band = brange[0] + band_idx; for ( ch_idx = 0; ch_idx < nchan_in; ch_idx++ ) { -#ifdef JBM_TSM_ON_TCS real_in_buffer[band_idx + num_bands * ch_idx] = RealBuffer[ch_idx * hParamMC->num_freq_bands + band]; imag_in_buffer[band_idx + num_bands * ch_idx] = ImagBuffer[ch_idx * hParamMC->num_freq_bands + band]; -#else - real_in_buffer[band_idx + num_bands * ch_idx] = RealBuffer[ch_idx][idx_slot][band]; - imag_in_buffer[band_idx + num_bands * ch_idx] = ImagBuffer[ch_idx][idx_slot][band]; -#endif } } @@ -392,27 +362,17 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( *-------------------------------------------------------------------*/ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( -#ifdef JBM_TSM_ON_TCS - float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ - float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ -#else - float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ - float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ -#endif + float *Cldfb_RealBuffer_in, /* i : input channel filter bank samples (real part) */ + float *Cldfb_ImagBuffer_in, /* i : input channel filter bank samples (imaginary part) */ float Cldfb_RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (real part) */ float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* o : output channel filter bank samples (imaginary part) */ -#ifdef JBM_TSM_ON_TCS - float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ - float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : parameter band wise mixing matrices (direct part) */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : parameter band wise mixing matrices (residual part) */ -#endif - const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ - const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ - const int16_t nX, /* i : number of input channels */ - const int16_t nY, /* i : number of output channels */ - PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ + float *mixing_matrix[], /* i : parameter band wise mixing matrices (direct part) */ + float *mixing_matrix_res[], /* i : parameter band wise mixing matrices (residual part) */ + const uint16_t slot_idx_sfr, /* i : time slot index for the current slot within the current subframe */ + const uint16_t slot_idx_tot, /* i : time slot index for the current slot within the frame */ + const int16_t nX, /* i : number of input channels */ + const int16_t nY, /* i : number of output channels */ + PARAM_MC_DEC_HANDLE hParamMC /* i : handle to the Parametric MC decoder state */ ) { int16_t param_band_idx, band, ch_idx; @@ -497,13 +457,8 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( /* collect input signals, still in cldfb buffers */ for ( ch_idx = 0; ch_idx < nX; ch_idx++ ) { -#ifdef JBM_TSM_ON_TCS input_f_real[ch_idx] = Cldfb_RealBuffer_in[ch_idx * hParamMC->num_freq_bands + band]; input_f_imag[ch_idx] = Cldfb_ImagBuffer_in[ch_idx * hParamMC->num_freq_bands + band]; -#else - input_f_real[ch_idx] = Cldfb_RealBuffer_in[ch_idx][slot_idx_tot][band]; - input_f_imag[ch_idx] = Cldfb_ImagBuffer_in[ch_idx][slot_idx_tot][band]; -#endif } /* apply mixing matrix */ diff --git a/lib_dec/ivas_dirac_output_synthesis_dec.c b/lib_dec/ivas_dirac_output_synthesis_dec.c old mode 100755 new mode 100644 index 33004c540c55f0bf162793198d51e79b192b40a4..61682fca444a5d0df0721071c78e2bb29b5a5e88 --- a/lib_dec/ivas_dirac_output_synthesis_dec.c +++ b/lib_dec/ivas_dirac_output_synthesis_dec.c @@ -164,11 +164,7 @@ ivas_error ivas_dirac_dec_output_synthesis_open( } /* buffer length and interpolator */ -#ifdef JBM_TSM_ON_TCS if ( ( dirac_output_synthesis_params->interpolator = (float *) malloc( JBM_CLDFB_SLOTS_IN_SUBFRAME * sizeof( float ) ) ) == NULL ) -#else - if ( ( dirac_output_synthesis_params->interpolator = (float *) malloc( hDirAC->subframe_nbslots * sizeof( float ) ) ) == NULL ) -#endif { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC synthesis\n" ) ); } @@ -287,17 +283,9 @@ ivas_error ivas_dirac_dec_output_synthesis_open( } /* compute interpolator */ -#ifdef JBM_TSM_ON_TCS for ( idx = 1; idx <= JBM_CLDFB_SLOTS_IN_SUBFRAME; ++idx ) -#else - for ( idx = 1; idx <= hDirAC->subframe_nbslots; ++idx ) -#endif { -#ifdef JBM_TSM_ON_TCS dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) JBM_CLDFB_SLOTS_IN_SUBFRAME; -#else - dirac_output_synthesis_params->interpolator[idx - 1] = (float) idx / (float) hDirAC->subframe_nbslots; -#endif } /* prepare diffuse response function */ @@ -548,24 +536,17 @@ void ivas_dirac_dec_output_synthesis_close( void ivas_dirac_dec_output_synthesis_process_slot( const float *reference_power, /* i : Estimated power */ const float *onset, /* i : onset filter */ -#ifdef JBM_TSM_ON_TCS const int16_t *azimuth, const int16_t *elevation, const float *diffuseness, -#endif DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ -#ifdef JBM_TSM_ON_TCS const int16_t sh_rot_max_order, -#endif const float *p_Rmat, /* i : rotation matrix */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const IVAS_OUTPUT_SETUP hOutSetup, /* i : output setup structure */ const int16_t nchan_transport /* i : number of transport channels*/ -#if defined( JBM_TSM_ON_TCS ) - , - const int16_t md_idx -#endif , + const int16_t md_idx, const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) { @@ -574,15 +555,9 @@ void ivas_dirac_dec_output_synthesis_process_slot( int16_t ch_idx; float aux_buf[CLDFB_NO_CHANNELS_MAX]; int16_t diff_start_band; -#ifndef JBM_TSM_ON_TCS - const float *diffuseness; -#endif DIRAC_OUTPUT_SYNTHESIS_PARAMS *h_dirac_output_synthesis_params; DIRAC_OUTPUT_SYNTHESIS_STATE *h_dirac_output_synthesis_state; -#ifndef JBM_TSM_ON_TCS - diffuseness = hDirAC->diffuseness_vector[hDirAC->dirac_read_idx]; -#endif h_dirac_output_synthesis_params = &( hDirAC->h_output_synthesis_psd_params ); h_dirac_output_synthesis_state = &( hDirAC->h_output_synthesis_psd_state ); @@ -608,11 +583,9 @@ void ivas_dirac_dec_output_synthesis_process_slot( ivas_dirac_dec_compute_directional_responses( hDirAC, hVBAPdata, NULL, -#ifdef JBM_TSM_ON_TCS azimuth, elevation, md_idx, -#endif NULL, 2, p_Rmat, @@ -623,7 +596,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( { if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { -#ifdef JBM_TSM_ON_TCS v_multc( hDirAC->energy_ratio1[md_idx], -1.f, aux_buf, num_freq_bands ); v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); mvr2r( hDirAC->energy_ratio1[md_idx], @@ -641,41 +613,14 @@ void ivas_dirac_dec_output_synthesis_process_slot( mvr2r( aux_buf, &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], num_freq_bands ); -#else - v_multc( hDirAC->energy_ratio1[hDirAC->dirac_read_idx], -1.f, aux_buf, num_freq_bands ); - v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( hDirAC->energy_ratio1[hDirAC->dirac_read_idx], - h_dirac_output_synthesis_state->direct_power_factor, - num_freq_bands ); - mvr2r( aux_buf, - h_dirac_output_synthesis_state->diffuse_power_factor, - num_freq_bands ); - - v_multc( hDirAC->energy_ratio2[hDirAC->dirac_read_idx], -1.f, aux_buf, num_freq_bands ); - v_addc( aux_buf, 1.f, aux_buf, num_freq_bands ); - mvr2r( hDirAC->energy_ratio2[hDirAC->dirac_read_idx], - &h_dirac_output_synthesis_state->direct_power_factor[hDirAC->num_freq_bands], - num_freq_bands ); - mvr2r( aux_buf, - &h_dirac_output_synthesis_state->diffuse_power_factor[hDirAC->num_freq_bands], - num_freq_bands ); -#endif } else { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec_compute_gain_factors( num_freq_bands, hDirAC->diffuseness_vector[md_idx], h_dirac_output_synthesis_params->max_band_decorr, h_dirac_output_synthesis_state->direct_power_factor, h_dirac_output_synthesis_state->diffuse_power_factor ); -#else - ivas_dirac_dec_compute_gain_factors( num_freq_bands, - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx], - h_dirac_output_synthesis_params->max_band_decorr, - h_dirac_output_synthesis_state->direct_power_factor, - h_dirac_output_synthesis_state->diffuse_power_factor ); -#endif } } else // ( hDirAC->hConfig->dec_param_estim == TRUE ) @@ -683,7 +628,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( { /* compute direct responses */ -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec_compute_directional_responses( hDirAC, hVBAPdata, NULL, @@ -694,7 +638,6 @@ void ivas_dirac_dec_output_synthesis_process_slot( sh_rot_max_order, p_Rmat, hodirac_flag ); -#endif if ( hDirAC->synthesisConf == DIRAC_SYNTHESIS_GAIN_SHD ) { @@ -831,16 +774,12 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const int16_t nchan_transport, /* i : number of transport channels */ -#ifdef JBM_TSM_ON_TCS - const int16_t nbslots, /* i : number of slots to process */ -#endif + const int16_t nbslots, /* i : number of slots to process */ const float *onset_filter, #ifdef FIX_393_459_460_SBA_MD float *diffuseness, #else -#ifdef JBM_TSM_ON_TCS const int16_t md_idx, -#endif #endif const int16_t hodirac_flag /* i : flag to indicate HO-DirAC mode */ ) @@ -881,11 +820,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( nchan_transport_foa = min( 4, nchan_transport ); #ifndef FIX_393_459_460_SBA_MD -#ifdef JBM_TSM_ON_TCS diffuseness = hDirAC->diffuseness_vector[md_idx]; -#else - diffuseness = hDirAC->diffuseness_vector[hDirAC->dirac_read_idx]; -#endif #endif /*-----------------------------------------------------------------* @@ -1087,11 +1022,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_gain_shd( * gain interpolation and output streams *-----------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS for ( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) -#else - for ( buf_idx = 0; buf_idx < hDirAC->subframe_nbslots; ++buf_idx ) -#endif { g1 = h_dirac_output_synthesis_params.interpolator[buf_idx]; g2 = 1.f - g1; @@ -1300,13 +1231,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( float RealBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i : LS signals */ DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ -#ifdef JBM_TSM_ON_TCS - const int16_t nbslots, /* i : number of slots to process */ + const int16_t nbslots, /* i : number of slots to process */ #ifdef FIX_393_459_460_SBA_MD float *diffuseness_vector, #else const int16_t diff_md_idx, /* i : md slot idx of diffuseness to use */ -#endif #endif float *reference_power_smooth, float qualityBasedSmFactor ) @@ -1435,15 +1364,11 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /* Estimate the smoothness of the directions based on the diffuseness parameter */ /* TODO: check this, seems buggy in the case of parame estim on the decoder side, because the pointer here points already to the following subframe, ist this intended?*/ -#ifdef JBM_TSM_ON_TCS #ifdef FIX_393_459_460_SBA_MD instDirectionSmoothness = 1.0f - diffuseness_vector[l]; #else /* Workaround for BE */ instDirectionSmoothness = 1.0f - hDirAC->diffuseness_vector[diff_md_idx][l]; /* Currently, all subframes have same energy ratio value. */ -#endif -#else - instDirectionSmoothness = 1.0f - hDirAC->diffuseness_vector[hDirAC->dirac_read_idx][l]; /* Currently, all subframes have same energy ratio value. */ #endif instDirectionSmoothness = min( max( instDirectionSmoothness, 0.0f ), 1.0f ); @@ -1588,11 +1513,7 @@ void ivas_dirac_dec_output_synthesis_process_subframe_psd_ls( /*-----------------------------------------------------------------* * gain interpolation and output streams *-----------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS for ( buf_idx = 0; buf_idx < nbslots; ++buf_idx ) -#else - for ( buf_idx = 0; buf_idx < hDirAC->subframe_nbslots; ++buf_idx ) -#endif { g1 = h_dirac_output_synthesis_params->interpolator[buf_idx]; g2 = 1.f - g1; @@ -1834,11 +1755,9 @@ void ivas_dirac_dec_compute_directional_responses( DIRAC_DEC_HANDLE hDirAC, /* i/o: DirAC handle */ const VBAP_HANDLE hVBAPdata, /* i : VBAP structure */ const MASA_DECODER_HANDLE hMasa, /* i : MASA decoder structure */ -#ifdef JBM_TSM_ON_TCS const int16_t *azimuth, const int16_t *elevation, const int16_t md_idx, -#endif const float *surCohRatio, const int16_t shd_rot_max_order, /* i : split-order rotation method */ const float *p_Rmat /* i : rotation matrix */ @@ -1852,9 +1771,6 @@ void ivas_dirac_dec_compute_directional_responses( float direct_response_ls[MAX_OUTPUT_CHANNELS]; float direct_response_square[MAX_OUTPUT_CHANNELS]; float *direct_response; -#ifndef JBM_TSM_ON_TCS - const int16_t *azimuth, *elevation; -#endif const int16_t *azimuth2, *elevation2; float direct_response_dir2[MAX_OUTPUT_CHANNELS]; float directRatio[MASA_MAXIMUM_DIRECTIONS]; @@ -1875,21 +1791,11 @@ void ivas_dirac_dec_compute_directional_responses( } num_channels_dir = hDirAC->num_outputs_dir; -#ifdef JBM_TSM_ON_TCS if ( hDirAC->numSimultaneousDirections == 2 ) { azimuth2 = hDirAC->azimuth2[md_idx]; elevation2 = hDirAC->elevation2[md_idx]; } -#else - azimuth = hDirAC->azimuth[hDirAC->dirac_read_idx]; - elevation = hDirAC->elevation[hDirAC->dirac_read_idx]; - if ( hDirAC->numSimultaneousDirections == 2 ) - { - azimuth2 = hDirAC->azimuth2[hDirAC->dirac_read_idx]; - elevation2 = hDirAC->elevation2[hDirAC->dirac_read_idx]; - } -#endif codingBand = -1; assert( num_channels_dir <= MAX_OUTPUT_CHANNELS && "Number of channels is too high" ); @@ -1957,29 +1863,15 @@ void ivas_dirac_dec_compute_directional_responses( hDirAC->synthesisConf == DIRAC_SYNTHESIS_PSD_SHD || hDirAC->synthesisConf == DIRAC_SYNTHESIS_MONO ) { /* Synthesize the first direction */ -#ifdef JBM_TSM_ON_TCS spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#else - spreadCoherencePanningHoa( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_idx][k], direct_response_hoa, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#endif /* Synthesize the second direction and combine the gains */ if ( hDirAC->numSimultaneousDirections == 2 ) { -#ifdef JBM_TSM_ON_TCS spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#else - spreadCoherencePanningHoa( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hDirAC->hOutSetup.ambisonics_order ); -#endif /* Combine gains from the two directions */ -#ifdef JBM_TSM_ON_TCS totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; -#else - totalDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] / totalDirect; -#endif for ( l = 0; l < num_channels_dir; l++ ) { direct_response_hoa[l] *= directRatio[0]; @@ -2027,33 +1919,19 @@ void ivas_dirac_dec_compute_directional_responses( else if ( hDirAC->panningConf == DIRAC_PANNING_VBAP ) /*VBAP*/ { /* Synthesize the first direction */ -#ifdef JBM_TSM_ON_TCS spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[md_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); -#else - spreadCoherencePanningVbap( azimuth[k], elevation[k], hDirAC->spreadCoherence[hDirAC->dirac_read_idx][k], direct_response_ls, num_channels_dir, hVBAPdata ); -#endif normalizePanningGains( direct_response_ls, num_channels_dir ); /* Synthesize the second direction and combine the gains */ if ( hDirAC->numSimultaneousDirections == 2 ) { -#ifdef JBM_TSM_ON_TCS spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[md_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); -#else - spreadCoherencePanningVbap( azimuth2[k], elevation2[k], hDirAC->spreadCoherence2[hDirAC->dirac_read_idx][k], direct_response_dir2, num_channels_dir, hVBAPdata ); -#endif normalizePanningGains( direct_response_dir2, num_channels_dir ); /* Combine gains from the two directions */ -#ifdef JBM_TSM_ON_TCS totalDirect = hDirAC->energy_ratio1[md_idx][k] + hDirAC->energy_ratio2[md_idx][k] + EPSILON; directRatio[0] = hDirAC->energy_ratio1[md_idx][k] / totalDirect; directRatio[1] = hDirAC->energy_ratio2[md_idx][k] / totalDirect; -#else - totalDirect = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] + hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] + EPSILON; - directRatio[0] = hDirAC->energy_ratio1[hDirAC->dirac_read_idx][k] / totalDirect; - directRatio[1] = hDirAC->energy_ratio2[hDirAC->dirac_read_idx][k] / totalDirect; -#endif for ( l = 0; l < num_channels_dir; l++ ) { direct_response_ls[l] *= directRatio[0]; diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 2452b34edb91c8f22d80675802b95e0c7bbb5e4b..0f0365d437d5c1be66e095f94500dfbf6cf590f1 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -63,11 +63,9 @@ static ivas_error doSanityChecks_IVAS( Decoder_Struct *st_ivas ); ivas_error ivas_dec_setup( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed from the previous frame (JBM) */ int16_t *data /* o : flushed PCM samples */ -#endif ) { int16_t k, idx, num_bits_read; @@ -117,17 +115,10 @@ ivas_error ivas_dec_setup( st_ivas->nchan_ism = nchan_ism; -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( ( error = ivas_ism_dec_config( st_ivas, st_ivas->ism_mode ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else if ( st_ivas->ivas_format == SBA_FORMAT ) { @@ -201,11 +192,7 @@ ivas_error ivas_dec_setup( num_bits_read += MC_LS_SETUP_BITS; /* select MC format mode; reconfigure the MC format decoder */ -#ifdef JBM_TSM_ON_TCS ivas_mc_dec_config( st_ivas, idx, nSamplesRendered, data ); -#else - ivas_mc_dec_config( st_ivas, idx ); -#endif } /*-------------------------------------------------------------------* @@ -273,18 +260,10 @@ ivas_error ivas_dec_setup( if ( st_ivas->ini_frame > 0 && st_ivas->ivas_format == SBA_FORMAT ) { int16_t nchan_transport_old, nchan_transport; -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE sba_mode_old; - sba_mode_old = ivas_sba_mode_select(); -#endif nchan_transport_old = st_ivas->nchan_transport; nchan_transport = ( st_ivas->sid_format == SID_SBA_2TC ) ? 2 : 1; -#ifdef SBA_MODE_CLEAN_UP if ( ( nchan_transport_old != nchan_transport ) ) -#else - if ( ( nchan_transport_old != nchan_transport ) || ( sba_mode_old != st_ivas->sba_mode ) ) -#endif { /*Setting the default bitrate for the reconfig function*/ if ( st_ivas->sid_format == SID_SBA_2TC ) @@ -293,12 +272,7 @@ ivas_error ivas_dec_setup( } else { -#ifdef SBA_MODE_CLEAN_UP st_ivas->hDecoderConfig->ivas_total_brate = IVAS_24k4; -#else - st_ivas->hDecoderConfig->ivas_total_brate = ( st_ivas->sba_mode == SBA_MODE_SPAR ) ? IVAS_24k4 : IVAS_13k2; - -#endif } if ( ( error = ivas_sba_dec_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) @@ -419,9 +393,6 @@ static ivas_error ivas_read_format( else { st_ivas->ivas_format = SBA_FORMAT; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = ivas_sba_mode_select(); -#endif } ( *num_bits_read )++; break; @@ -489,16 +460,6 @@ static ivas_error ivas_read_format( { st_ivas->sba_analysis_order = SBA_FOA_ORDER; } -#ifndef SBA_MODE_CLEAN_UP - if ( idx == 1 ) - { - st_ivas->sba_mode = SBA_MODE_SPAR; - } - else - { - st_ivas->sba_mode = SBA_MODE_DIRAC; - } -#endif } /* reset bitstream handle to avoid BER detection after reading the 2400 kbps for ch0 */ @@ -593,9 +554,6 @@ ivas_error ivas_init_decoder_front( st_ivas->ism_mode = ISM_MODE_NONE; st_ivas->mc_mode = MC_MODE_NONE; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = SBA_MODE_NONE; -#endif st_ivas->sba_dirac_stereo_flag = 0; @@ -689,16 +647,10 @@ ivas_error ivas_init_decoder( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ ) { -#ifndef SBA_MODE_CLEAN_UP - int16_t i, k, n; -#else int16_t i, n; -#endif int16_t sce_id, cpe_id; int16_t numCldfbAnalyses, numCldfbSyntheses; -#ifdef JBM_TSM_ON_TCS int16_t granularity, n_channels_transport_jbm; -#endif int32_t output_Fs, ivas_total_brate; int32_t binauralization_delay_ns; AUDIO_CONFIG output_config; @@ -786,52 +738,10 @@ ivas_error ivas_init_decoder( if ( st_ivas->hDecoderConfig->Opt_Headrotation ) { -#ifdef FIX_439_OTR_PARAMS if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, st_ivas->hDecoderConfig->orientation_tracking ) ) != IVAS_ERR_OK ) { return error; } -#else - if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_NONE ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_NONE ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_AVG ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_AVG_ORIENT ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_ORIENT ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else if ( st_ivas->hDecoderConfig->orientation_tracking == IVAS_ORIENT_TRK_REF_VEC_LEV ) - { - if ( ( error = ivas_orient_trk_SetTrackingType( st_ivas->hHeadTrackData->OrientationTracker, OTR_TRACKING_REF_VEC_LEV ) ) != IVAS_ERR_OK ) - { - return error; - } - } - else - { - return IVAS_ERR_WRONG_MODE; - } -#endif } /*-----------------------------------------------------------------* @@ -943,94 +853,59 @@ ivas_error ivas_init_decoder( } else if ( st_ivas->ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { -#endif - if ( ( error = ivas_spar_dec_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) + return error; + } + + if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) + { + if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) { return error; } + } - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->hOutSetup.is_loudspeaker_setup ) - { - if ( ( error = ivas_sba_get_hoa_dec_matrix( st_ivas->hOutSetup, &st_ivas->hoa_dec_mtx, st_ivas->hIntSetup.ambisonics_order ) ) != IVAS_ERR_OK ) - { - return error; - } - } + if ( ( error = ivas_dirac_sba_config( + st_ivas->hQMetaData, + &st_ivas->element_mode_init, + ivas_total_brate, + st_ivas->sba_analysis_order, + ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + { + return error; + } - if ( ( error = ivas_dirac_sba_config( - st_ivas->hQMetaData, -#ifndef SBA_MODE_CLEAN_UP - &st_ivas->nchan_transport, - &st_ivas->nSCE, - &st_ivas->nCPE, -#endif - &st_ivas->element_mode_init, - ivas_total_brate, - st_ivas->sba_analysis_order, -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode, -#endif - ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) + if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) + { + if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; } - if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && st_ivas->hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) - { - if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - -#ifndef SBA_MODE_CLEAN_UP - for ( k = 0; k < DIRAC_MAX_NBANDS; k++ ) - { - st_ivas->hSpar->dirac_to_spar_md_bands[k] = st_ivas->hDirAC->dirac_to_spar_md_bands[k]; - } -#endif - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; - } - else - { - int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; - - st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) - { - st_ivas->hSpar->enc_param_start_band = 0; - - set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); - st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; - } - - ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), - st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); - } - st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#ifndef SBA_MODE_CLEAN_UP + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; } - else /* SBA_MODE_DIRAC */ + else { - if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, st_ivas->sba_mode, -1 ) ) != IVAS_ERR_OK ) + int16_t band_grouping[IVAS_MAX_NUM_BANDS + 1]; + + st_ivas->hSpar->enc_param_start_band = min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); + if ( ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ) { - return error; + st_ivas->hSpar->enc_param_start_band = 0; + + set_c( (int8_t *) st_ivas->hQMetaData->twoDirBands, (int8_t) 1, st_ivas->hQMetaData->q_direction[0].cfg.nbands ); + st_ivas->hQMetaData->numTwoDirBands = (uint8_t) st_ivas->hQMetaData->q_direction[0].cfg.nbands; } - st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); + ivas_dirac_config_bands( band_grouping, IVAS_MAX_NUM_BANDS, (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ), + st_ivas->hSpar->dirac_to_spar_md_bands, st_ivas->hQMetaData->useLowerBandRes, st_ivas->hSpar->enc_param_start_band, 0 ); } -#endif + st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); } -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->ivas_format != SBA_FORMAT ) -#else - if ( st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV && st_ivas->renderer_type != RENDERER_BINAURAL_MIXER_CONV_ROOM && - st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode != SBA_MODE_SPAR ) -#endif { if ( ( error = ivas_dirac_dec_open( st_ivas ) ) != IVAS_ERR_OK ) { @@ -1365,7 +1240,6 @@ ivas_error ivas_init_decoder( } } -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -1376,7 +1250,6 @@ ivas_error ivas_init_decoder( return error; } } -#endif } else if ( st_ivas->renderer_type == RENDERER_MC ) { @@ -1410,7 +1283,6 @@ ivas_error ivas_init_decoder( st_ivas->binaural_latency_ns = st_ivas->hCrendWrapper->binaural_latency_ns; -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { granularity = NS2SA( st_ivas->hDecoderConfig->output_Fs, FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ); @@ -1421,7 +1293,6 @@ ivas_error ivas_init_decoder( return error; } } -#endif } if ( st_ivas->ivas_format == ISM_FORMAT && @@ -1499,11 +1370,7 @@ ivas_error ivas_init_decoder( } /* CLDFB Interpolation weights */ -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT && !st_ivas->sba_dirac_stereo_flag && st_ivas->hDecoderConfig->nchan_out != 1 ) -#else - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && !st_ivas->sba_dirac_stereo_flag && st_ivas->hDecoderConfig->nchan_out != 1 ) -#endif { ivas_spar_get_cldfb_gains( st_ivas->hSpar, st_ivas->cldfbAnaDec[0], st_ivas->cldfbSynDec[0], hDecoderConfig ); } @@ -1517,7 +1384,6 @@ ivas_error ivas_init_decoder( return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Failed to open limiter handle" ); } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * Allocate and initialize JBM struct + buffer *-----------------------------------------------------------------*/ @@ -1541,7 +1407,6 @@ ivas_error ivas_init_decoder( return error; } } -#endif return error; } @@ -1764,9 +1629,7 @@ void ivas_initialize_handles_dec( st_ivas->hLsSetupCustom = NULL; st_ivas->hRenderConfig = NULL; -#ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer = NULL; -#endif return; } @@ -1845,9 +1708,7 @@ void ivas_destroy_dec( /* ISM renderer handle */ if ( st_ivas->hIsmRendererData != NULL ) { -#ifdef JBM_TSM_ON_TCS free( st_ivas->hIsmRendererData->interpolator ); -#endif free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } @@ -1961,9 +1822,7 @@ void ivas_destroy_dec( st_ivas->hDecoderConfig = NULL; } -#ifdef JBM_TSM_ON_TCS ivas_jbm_dec_tc_buffer_close( &st_ivas->hTcBuffer ); -#endif /* main IVAS handle */ free( st_ivas ); @@ -2018,11 +1877,7 @@ void ivas_init_dec_get_num_cldfb_instances( } break; case RENDERER_DIRAC: -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { *numCldfbAnalyses = st_ivas->hSpar->hFbMixer->fb_cfg->num_in_chans; @@ -2039,11 +1894,7 @@ void ivas_init_dec_get_num_cldfb_instances( *numCldfbSyntheses = MAX_OUTPUT_CHANNELS; } } -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format != SBA_FORMAT ) -#else - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) -#endif { if ( st_ivas->nchan_transport > 2 && st_ivas->sba_planar ) { @@ -2084,11 +1935,7 @@ void ivas_init_dec_get_num_cldfb_instances( case RENDERER_BINAURAL_MIXER_CONV_ROOM: case RENDERER_BINAURAL_FASTCONV: case RENDERER_BINAURAL_FASTCONV_ROOM: -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { if ( st_ivas->sba_dirac_stereo_flag ) { diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index fe98ca0dcb4fff6317395dc2ffc9701fd98d4b5a..1ee468dc80316d21bb043548e93c777cd8289fbd 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -32,9 +32,7 @@ #include #include "options.h" -#ifdef JBM_TSM_ON_TCS #include "prot.h" -#endif #include "ivas_prot.h" #include "ivas_prot_rend.h" #ifdef DEBUGGING @@ -52,18 +50,15 @@ static ivas_error ivas_ism_bitrate_switching( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_transport_old, /* i : last number of transport channels */ const ISM_MODE last_ism_mode /* i : last ISM mode */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples rendered */ int16_t *data /* o : rendered samples */ -#endif ) { ivas_error error; int32_t element_brate_tmp[MAX_NUM_OBJECTS]; int16_t nSCE_old, nCPE_old; int16_t numCldfbAnalyses_old, numCldfbSyntheses_old, ism_mode; -#ifdef JBM_TSM_ON_TCS TC_BUFFER_MODE tc_buffer_mode_new; int16_t tc_nchan_tc_new; int16_t tc_nchan_allocate_new; @@ -71,7 +66,6 @@ static ivas_error ivas_ism_bitrate_switching( AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; RENDERER_TYPE renderer_type_old; -#endif error = IVAS_ERR_OK; @@ -109,13 +103,11 @@ static ivas_error ivas_ism_bitrate_switching( return error; } -#ifdef JBM_TSM_ON_TCS /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; hIntSetupOld = st_ivas->hIntSetup; tc_granularity_new = 1; renderer_type_old = st_ivas->renderer_type; -#endif /*-----------------------------------------------------------------* * Initialize the needed renderer struct and destroy the unnecessary renderer struct @@ -129,7 +121,6 @@ static ivas_error ivas_ism_bitrate_switching( ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->hDecoderConfig->output_config ); } -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ @@ -162,7 +153,6 @@ static ivas_error ivas_ism_bitrate_switching( } } } -#endif if ( st_ivas->ism_mode != last_ism_mode ) { @@ -186,7 +176,6 @@ static ivas_error ivas_ism_bitrate_switching( ivas_dirac_dec_close_binaural_data( &st_ivas->hDiracDecBin ); /* Open the TD Binaural renderer */ -#ifdef FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR if ( st_ivas->hHrtfTD == NULL || st_ivas->hBinRendererTd == NULL ) { if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) @@ -194,21 +183,13 @@ static ivas_error ivas_ism_bitrate_switching( return error; } } -#else - if ( ( error = ivas_td_binaural_open( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } else { /* close the ISM renderer and reinitialize */ if ( st_ivas->hIsmRendererData != NULL ) { -#ifdef JBM_TSM_ON_TCS free( st_ivas->hIsmRendererData->interpolator ); -#endif free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } @@ -262,7 +243,6 @@ static ivas_error ivas_ism_bitrate_switching( } /* Close the TD Binaural renderer */ -#ifdef FIX_462_HRTF_FILE_BR_SWITCH_MEM_ERR if ( st_ivas->hBinRendererTd->HrFiltSet_p->ModelParams.modelROM == TRUE ) { if ( st_ivas->hBinRendererTd != NULL ) @@ -275,26 +255,13 @@ static ivas_error ivas_ism_bitrate_switching( st_ivas->hHrtfTD = NULL; } } -#else - if ( st_ivas->hBinRendererTd != NULL ) - { - ivas_td_binaural_close( &st_ivas->hBinRendererTd ); - } - - if ( st_ivas->hHrtfTD != NULL ) - { - st_ivas->hHrtfTD = NULL; - } -#endif } else { /* Close the ISM renderer */ if ( st_ivas->hIsmRendererData != NULL ) { -#ifdef JBM_TSM_ON_TCS free( st_ivas->hIsmRendererData->interpolator ); -#endif free( st_ivas->hIsmRendererData ); st_ivas->hIsmRendererData = NULL; } @@ -327,7 +294,6 @@ static ivas_error ivas_ism_bitrate_switching( return error; } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * Reconfigure TC buffer *-----------------------------------------------------------------*/ @@ -375,7 +341,6 @@ static ivas_error ivas_ism_bitrate_switching( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } -#endif return error; } @@ -392,12 +357,9 @@ ivas_error ivas_ism_dec_config( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ , const ISM_MODE last_ism_mode /* i/o: last ISM mode */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed when the renderer granularity changes */ - int16_t *data -#endif -) + int16_t *data ) { int32_t ivas_total_brate; ivas_error error; @@ -437,11 +399,7 @@ ivas_error ivas_ism_dec_config( { if ( ( st_ivas->ism_mode != last_ism_mode ) || ( st_ivas->hDecoderConfig->ivas_total_brate != st_ivas->hDecoderConfig->last_ivas_total_brate ) ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -464,11 +422,7 @@ ivas_error ivas_ism_dec_config( /* ISM mode switching */ if ( st_ivas->ism_mode != last_ism_mode ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode, nSamplesRendered, data ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_bitrate_switching( st_ivas, nchan_transport_old, last_ism_mode ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_dtx_dec.c b/lib_dec/ivas_ism_dtx_dec.c index 054603a15ea3c27ae68f0828c0f800aec1e29b57..1c48050bee21382019bfebade5f3832a449e299a 100644 --- a/lib_dec/ivas_ism_dtx_dec.c +++ b/lib_dec/ivas_ism_dtx_dec.c @@ -95,11 +95,7 @@ ivas_error ivas_ism_dtx_dec( st_ivas->ism_mode = ism_mode_bstr; } -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode, NULL, NULL ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_ism_dec_config( st_ivas, last_ism_mode ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_dec/ivas_ism_param_dec.c b/lib_dec/ivas_ism_param_dec.c index 086e8a36a8688085318dc05fabe84d1d5d57484e..1e28d2ea340395eb3f21151802ad761239eb5df9 100644 --- a/lib_dec/ivas_ism_param_dec.c +++ b/lib_dec/ivas_ism_param_dec.c @@ -158,7 +158,6 @@ static void ivas_ism_get_proto_matrix( } -#ifdef JBM_TSM_ON_TCS static void ivas_param_ism_collect_slot( DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ float *Cldfb_RealBuffer_in, @@ -286,129 +285,7 @@ static void ivas_param_ism_compute_mixing_matrix( return; } -#else -static void ivas_param_ism_compute_mixing_matrix( - const int16_t nchan_ism, /* i : number of ISM channels */ - DIRAC_DEC_HANDLE hDirAC, /* i/o: decoder DirAC handle */ - ISM_DTX_DATA_DEC hISMDTX, /* i : ISM DTX handle */ - float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], - float direct_response[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN], - const int16_t nchan_transport, - const int16_t nchan_out_woLFE, - const int16_t slot_idx_start, - const int16_t slot_idx_stop, - float mixing_matrix[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX] ) -{ - int16_t slot_idx, band_idx, ch, bin_idx; - int16_t i, w, obj_indx; - float tmp, ref_power; - int16_t brange[2]; - float cx_diag[PARAM_ISM_MAX_DMX]; - float direct_power[MAX_NUM_OBJECTS]; - float cy_diag[PARAM_ISM_MAX_CHAN]; - float cy_diag_tmp[MAX_NUM_OBJECTS][PARAM_ISM_MAX_CHAN]; - float *dir_res_ptr; - float *proto_matrix; - float response_matrix[PARAM_ISM_MAX_CHAN * MAX_NUM_OBJECTS]; - int16_t num_wave; - - proto_matrix = hDirAC->hParamIsmRendering->proto_matrix; - - assert( ( nchan_ism == 3 ) || ( nchan_ism == 4 ) ); - assert( nchan_transport == 2 ); - - if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) - { - num_wave = nchan_ism; - } - else - { - num_wave = MAX_PARAM_ISM_WAVE; - } - - set_zero( response_matrix, PARAM_ISM_MAX_CHAN * MAX_NUM_OBJECTS ); - - /* loop over parameter bands to compute the mixing matrix */ - for ( band_idx = 0; band_idx < hDirAC->hParamIsm->nbands; band_idx++ ) - { - brange[0] = hDirAC->hParamIsm->band_grouping[band_idx]; - brange[1] = hDirAC->hParamIsm->band_grouping[band_idx + 1]; - - /* Compute covaraince matrix from direct response*/ - for ( w = 0; w < num_wave; w++ ) - { - set_zero( cy_diag_tmp[w], nchan_out_woLFE ); - - if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) - { - dir_res_ptr = direct_response[w]; - } - else - { - obj_indx = hDirAC->hParamIsm->obj_indices[band_idx][0][w]; - dir_res_ptr = direct_response[obj_indx]; - } - mvr2r( dir_res_ptr, response_matrix + w * nchan_out_woLFE, nchan_out_woLFE ); - /* we only need the diagonal of Cy*/ - matrix_product_diag( dir_res_ptr, nchan_out_woLFE, 1, 0, dir_res_ptr, 1, nchan_out_woLFE, 0, cy_diag_tmp[w] ); - } - - for ( bin_idx = brange[0]; bin_idx < brange[1]; bin_idx++ ) - { - /* compute input matrix for covariance rendering */ - set_f( cx_diag, 0.0f, nchan_transport ); - for ( ch = 0; ch < nchan_transport; ch++ ) - { - tmp = 0.0f; - for ( slot_idx = slot_idx_start; slot_idx < slot_idx_stop; slot_idx++ ) - { - tmp += ( Cldfb_RealBuffer_in[ch][slot_idx][bin_idx] * Cldfb_RealBuffer_in[ch][slot_idx][bin_idx] ); - tmp += ( Cldfb_ImagBuffer_in[ch][slot_idx][bin_idx] * Cldfb_ImagBuffer_in[ch][slot_idx][bin_idx] ); - } - - cx_diag[ch] = tmp; - } - - ref_power = 0.0f; - for ( slot_idx = slot_idx_start; slot_idx < slot_idx_stop; slot_idx++ ) - { - ref_power += ( Cldfb_RealBuffer_in[0][slot_idx][bin_idx] * Cldfb_RealBuffer_in[0][slot_idx][bin_idx] ) + ( Cldfb_ImagBuffer_in[0][slot_idx][bin_idx] * Cldfb_ImagBuffer_in[0][slot_idx][bin_idx] ); - ref_power += ( Cldfb_RealBuffer_in[1][slot_idx][bin_idx] * Cldfb_RealBuffer_in[1][slot_idx][bin_idx] ) + ( Cldfb_ImagBuffer_in[1][slot_idx][bin_idx] * Cldfb_ImagBuffer_in[1][slot_idx][bin_idx] ); - } - set_zero( cy_diag, nchan_out_woLFE ); - for ( w = 0; w < num_wave; w++ ) - { - if ( hDirAC->hParamIsm->flag_noisy_speech || hISMDTX.dtx_flag ) - { - direct_power[w] = ( 1.0f / nchan_ism ) * ref_power; - } - else - { - direct_power[w] = hDirAC->power_ratios[band_idx][0][w] * ref_power; - } - - if ( direct_power[w] != 0.f ) - { - for ( i = 0; i < nchan_out_woLFE; i++ ) - { - cy_diag[i] += direct_power[w] * cy_diag_tmp[w][i]; - } - } - direct_power[w] = sqrtf( direct_power[w] ); - } - /* Compute mixing matrix */ - computeMixingMatricesISM( nchan_transport, num_wave, nchan_out_woLFE, response_matrix, direct_power, cx_diag, cy_diag, proto_matrix, 1, - PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix[bin_idx] ); - } - } - return; -} -#endif - - -#ifdef JBM_TSM_ON_TCS static void ivas_param_ism_render_slot( DIRAC_DEC_HANDLE hDirAC, float *Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX], @@ -444,7 +321,6 @@ static void ivas_param_ism_render_slot( return; } -#endif static void ivas_param_ism_rendering( @@ -603,7 +479,6 @@ ivas_error ivas_param_ism_dec_open( *-----------------------------------------------------------------*/ hDirAC->slot_size = (int16_t) ( ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX ); -#ifdef JBM_TSM_ON_TCS hDirAC->hConfig = NULL; set_s( hDirAC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hDirAC->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); @@ -611,11 +486,6 @@ ivas_error ivas_param_ism_dec_open( hDirAC->subframes_rendered = 0; hDirAC->slots_rendered = 0; hDirAC->num_slots = DEFAULT_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME; -#else - hDirAC->subframe_nbslots = (int16_t) ( CLDFB_NO_COL_MAX * 5.f / 20.f + 0.5f ); - hDirAC->nb_subframes = CLDFB_NO_COL_MAX / hDirAC->subframe_nbslots; - assert( hDirAC->nb_subframes <= MAX_PARAM_SPATIAL_SUBFRAMES ); -#endif hDirAC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hDirAC->hParamIsm->nbands = MAX_PARAM_ISM_NBANDS; @@ -647,7 +517,6 @@ ivas_error ivas_param_ism_dec_open( if ( !( output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) { /* Initialize Param ISM Rendering handle */ -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { if ( ( error = ivas_param_ism_rendering_init( hDirAC->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, MAX_JBM_CLDFB_TIMESLOTS, output_config ) ) != IVAS_ERR_OK ) @@ -657,14 +526,11 @@ ivas_error ivas_param_ism_dec_open( } else { -#endif if ( ( error = ivas_param_ism_rendering_init( hDirAC->hParamIsmRendering, hOutSetup, st_ivas->nchan_transport, CLDFB_NO_COL_MAX, output_config ) ) != IVAS_ERR_OK ) { return error; } -#ifdef JBM_TSM_ON_TCS } -#endif } if ( !( output_config == AUDIO_CONFIG_EXTERNAL || output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM || output_config == AUDIO_CONFIG_MONO || output_config == AUDIO_CONFIG_STEREO ) ) @@ -680,20 +546,13 @@ ivas_error ivas_param_ism_dec_open( set_zero( hDirAC->azimuth_values, MAX_NUM_OBJECTS ); set_zero( hDirAC->elevation_values, MAX_NUM_OBJECTS ); -#ifdef JBM_TSM_ON_TCS hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; -#else - hDirAC->dirac_md_buffer_length = 0; -#endif hDirAC->dirac_bs_md_write_idx = 0; hDirAC->dirac_read_idx = 0; hDirAC->spar_to_dirac_write_idx = 0; if ( ( output_config == AUDIO_CONFIG_BINAURAL || output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { -#ifndef JBM_TSM_ON_TCS - hDirAC->dirac_md_buffer_length = MAX_PARAM_SPATIAL_SUBFRAMES; -#endif if ( ( error = ivas_dirac_allocate_parameters( hDirAC, 1 ) ) != IVAS_ERR_OK ) { return error; @@ -709,7 +568,6 @@ ivas_error ivas_param_ism_dec_open( st_ivas->hDirAC = hDirAC; -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { if ( st_ivas->renderer_type != RENDERER_MONO_DOWNMIX && st_ivas->renderer_type != RENDERER_DISABLE ) @@ -763,7 +621,6 @@ ivas_error ivas_param_ism_dec_open( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc = NULL; hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; } -#endif pop_wmops(); return error; @@ -818,7 +675,6 @@ void ivas_param_ism_dec_close( } } -#ifdef JBM_TSM_ON_TCS if ( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc != NULL ) { free( hDirAC->hParamIsmRendering->Cldfb_RealBuffer_tc ); @@ -829,7 +685,6 @@ void ivas_param_ism_dec_close( free( hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc ); hDirAC->hParamIsmRendering->Cldfb_ImagBuffer_tc = NULL; } -#endif if ( hDirAC->hParamIsmRendering != NULL ) { @@ -858,10 +713,8 @@ void ivas_param_ism_dec( int16_t ch, nchan_transport, nchan_out, nchan_out_woLFE, i; int16_t subframe_idx, slot_idx, index_slot, bin_idx; int32_t ivas_total_brate; -#ifdef JBM_TSM_ON_TCS float ref_power[CLDFB_NO_CHANNELS_MAX]; float cx_diag[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_DMX]; -#endif /* CLDFB Input Buffers */ float Cldfb_RealBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; float Cldfb_ImagBuffer_in[PARAM_ISM_MAX_DMX][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX]; @@ -903,14 +756,12 @@ void ivas_param_ism_dec( push_wmops( "ivas_param_ism_dec" ); -#ifdef JBM_TSM_ON_TCS /* set buffers to zero */ for ( bin_idx = 0; bin_idx < CLDFB_NO_CHANNELS_MAX; bin_idx++ ) { set_zero( cx_diag[bin_idx], PARAM_ISM_MAX_DMX ); } set_zero( ref_power, CLDFB_NO_CHANNELS_MAX ); -#endif /* Frame-level Processing */ /* De-quantization */ @@ -977,9 +828,7 @@ void ivas_param_ism_dec( { cldfbAnalysis_ts( &( output_f[ch][hDirAC->num_freq_bands * slot_idx] ), Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], hDirAC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); -#ifdef JBM_TSM_ON_TCS ivas_param_ism_collect_slot( hDirAC, Cldfb_RealBuffer_in[ch][slot_idx], Cldfb_ImagBuffer_in[ch][slot_idx], ch, ref_power, cx_diag ); -#endif } } @@ -990,41 +839,25 @@ void ivas_param_ism_dec( } /* Compute mixing matrix */ -#ifdef JBM_TSM_ON_TCS ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, direct_response, nchan_transport, nchan_out_woLFE, cx_diag, ref_power, mixing_matrix ); -#else - ivas_param_ism_compute_mixing_matrix( st_ivas->nchan_ism, hDirAC, st_ivas->hISMDTX, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, direct_response, nchan_transport, nchan_out_woLFE, 0, CLDFB_NO_COL_MAX, mixing_matrix ); -#endif /* subframe loop for synthesis*/ for ( subframe_idx = 0; subframe_idx < hDirAC->nb_subframes; subframe_idx++ ) { -#ifdef JBM_TSM_ON_TCS uint16_t slot_idx_start = subframe_idx * hDirAC->subframe_nbslots[subframe_idx]; -#else - uint16_t slot_idx_start = subframe_idx * hDirAC->subframe_nbslots; -#endif uint16_t idx_in; uint16_t idx_lfe; /* Set some memories to zero */ for ( ch = 0; ch < nchan_out_woLFE; ch++ ) { -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { set_f( Cldfb_RealBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); set_f( Cldfb_ImagBuffer[ch][slot_idx], 0.0f, hDirAC->num_freq_bands ); } } -#ifdef JBM_TSM_ON_TCS for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots[subframe_idx]; slot_idx++ ) -#else - for ( slot_idx = 0; slot_idx < hDirAC->subframe_nbslots; slot_idx++ ) -#endif { index_slot = slot_idx_start + slot_idx; @@ -1042,11 +875,7 @@ void ivas_param_ism_dec( { if ( ( hSetup.num_lfe > 0 ) && ( hSetup.index_lfe[idx_lfe] == ch ) ) { -#ifdef JBM_TSM_ON_TCS set_zero( &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots[subframe_idx] * hDirAC->num_freq_bands ); -#else - set_zero( &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->subframe_nbslots * hDirAC->num_freq_bands ); -#endif if ( idx_lfe < ( hSetup.num_lfe - 1 ) ) { idx_lfe++; @@ -1058,23 +887,14 @@ void ivas_param_ism_dec( float *ImagBuffer[16]; /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < hDirAC->subframe_nbslots[subframe_idx]; i++ ) -#else - for ( i = 0; i < hDirAC->subframe_nbslots; i++ ) -#endif { RealBuffer[i] = Cldfb_RealBuffer[idx_in][i]; ImagBuffer[i] = Cldfb_ImagBuffer[idx_in][i]; } -#ifdef JBM_TSM_ON_TCS cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), hDirAC->num_freq_bands * hDirAC->subframe_nbslots[subframe_idx], st_ivas->cldfbSynDec[ch] ); -#else - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hDirAC->num_freq_bands] ), - hDirAC->num_freq_bands * hDirAC->subframe_nbslots, st_ivas->cldfbSynDec[ch] ); -#endif idx_in++; } @@ -1105,7 +925,6 @@ void ivas_param_ism_dec( return; } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------------* * ivas_ism_dec_digest_tc() @@ -1534,7 +1353,6 @@ void ivas_param_ism_dec_render( return; } -#endif /*-------------------------------------------------------------------------* diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c index 031c6cf18f93607afcf974e3d342c4f9e155fa2e..c6ca4b3b7bc66f71ea415faadc294c09935a5ba2 100644 --- a/lib_dec/ivas_ism_renderer.c +++ b/lib_dec/ivas_ism_renderer.c @@ -58,9 +58,7 @@ ivas_error ivas_ism_renderer_open( { int16_t i; uint16_t interpolator_length; -#ifdef JBM_TSM_ON_TCS uint16_t init_interpolator_length; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -81,12 +79,9 @@ ivas_error ivas_ism_renderer_open( for ( i = 0; i < MAX_NUM_OBJECTS; i++ ) { set_f( st_ivas->hIsmRendererData->prev_gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); -#ifdef JBM_TSM_ON_TCS set_f( st_ivas->hIsmRendererData->gains[i], 0.0f, MAX_OUTPUT_CHANNELS ); -#endif } -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { init_interpolator_length = NS2SA( st_ivas->hDecoderConfig->output_Fs, MAX_JBM_CLDFB_TIMESLOTS * CLDFB_SLOT_NS ); @@ -102,13 +97,6 @@ ivas_error ivas_ism_renderer_open( { st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); } -#else - interpolator_length = (uint16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); - for ( i = 0; i < interpolator_length; i++ ) - { - st_ivas->hIsmRendererData->interpolator[i] = (float) i / ( (float) interpolator_length - 1 ); - } -#endif return error; } @@ -121,12 +109,8 @@ ivas_error ivas_ism_renderer_open( *-------------------------------------------------------------------------*/ void ivas_ism_render( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS - float *output_f[], /* i/o: core-coder transport channels/object output */ -#else - float output_f[][L_FRAME48k], /* i/o: core-coder transport channels/object output */ -#endif + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output_f[], /* i/o: core-coder transport channels/object output */ const int16_t output_frame /* i : output frame length per channel */ ) { @@ -229,7 +213,6 @@ void ivas_ism_render( return; } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------------* * ivas_ism_render_sf() * @@ -276,11 +259,7 @@ void ivas_ism_render_sf( for ( i = 0; i < num_objects; i++ ) { /* Head rotation: rotate the object positions depending the head's orientation */ -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 && !st_ivas->hIsmMetaData[i]->non_diegetic_flag ) -#else - if ( st_ivas->hHeadTrackData != NULL && st_ivas->hHeadTrackData->num_quaternions >= 0 ) -#endif { rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &azimuth, &elevation, Rmat, st_ivas->hIntSetup.is_planar_setup ); if ( st_ivas->hEFAPdata != NULL ) @@ -320,7 +299,6 @@ void ivas_ism_render_sf( return; } -#endif /*-------------------------------------------------------------------------* diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c index 04ae4904146b577b413d189be0648e46aca1ec04..fd0375e7bef1a85e736a9e937af9997ec235f12e 100644 --- a/lib_dec/ivas_jbm_dec.c +++ b/lib_dec/ivas_jbm_dec.c @@ -46,8 +46,6 @@ #include "wmc_auto.h" -#ifdef JBM_TSM_ON_TCS - /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ @@ -184,21 +182,13 @@ ivas_error ivas_jbm_dec_tc( set_s( nb_bits_metadata, 0, MAX_SCE ); /* read parameters from the bitstream */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->hQMetaData != NULL && st_ivas->ivas_format != SBA_FORMAT ) -#endif { st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; if ( st_ivas->ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, hodirac_flag, 0 ); -#else ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], hodirac_flag, 0 ); -#endif } else { @@ -208,23 +198,8 @@ ivas_error ivas_jbm_dec_tc( } } } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL ) - { - st = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[0]->hCoreCoder[0] : st_ivas->hCPE[0]->hCoreCoder[0]; -#ifndef SBA_MODE_CLEAN_UP - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], st_ivas->sba_mode, hodirac_flag, st_ivas->hSpar->dirac_to_spar_md_bands ); -#else - ivas_dirac_dec_read_BS( ivas_total_brate, st, st_ivas->hDirAC, st_ivas->hQMetaData, &nb_bits_metadata[0], hodirac_flag, st_ivas->hSpar->dirac_to_spar_md_bands ); -#endif - } -#endif if ( ( error = ivas_spar_dec( st_ivas, nb_bits_metadata ) ) != IVAS_ERR_OK ) { @@ -270,11 +245,7 @@ ivas_error ivas_jbm_dec_tc( { nchan_remapped = nchan_out; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { ivas_agc_dec_process( st_ivas->hSpar->hAgcDec, output, output, st_ivas->hSpar->hMdDec->spar_md_cfg.nchan_transport, output_frame ); @@ -305,19 +276,11 @@ ivas_error ivas_jbm_dec_tc( { nchan_remapped = ivas_sba_remapTCs( output, st_ivas, output_frame ); -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR && ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) ) -#else if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) -#endif { ivas_sba_mix_matrix_determiner( st_ivas->hSpar, output, st_ivas->bfi, nchan_remapped, output_frame ); } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else -#endif { ivas_spar_dec_agc_pca( st_ivas, output, output_frame ); } @@ -645,9 +608,7 @@ ivas_error ivas_jbm_dec_render( int16_t nchan_remapped; int32_t output_Fs; AUDIO_CONFIG output_config; -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING float pan_left, pan_right; -#endif int16_t nSamplesAskedLocal; ivas_error error; float *p_output[MAX_OUTPUT_CHANNELS]; @@ -707,7 +668,6 @@ ivas_error ivas_jbm_dec_render( { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, st_ivas->nchan_transport, p_output ); } -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { *nSamplesRendered = min( st_ivas->hTcBuffer->n_samples_available, nSamplesAskedLocal ); @@ -716,7 +676,6 @@ ivas_error ivas_jbm_dec_render( v_multc( st_ivas->hTcBuffer->tc[0], pan_right, output[1], *nSamplesRendered ); v_multc( st_ivas->hTcBuffer->tc[0], pan_left, output[0], *nSamplesRendered ); } -#endif else if ( st_ivas->renderer_type == RENDERER_PARAM_ISM || st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) { ivas_param_ism_dec_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, p_output ); @@ -738,7 +697,6 @@ ivas_error ivas_jbm_dec_render( /* Convert to CICPxx; used also for ISM->CICP19->binaural_room rendering */ ivas_ism_render_sf( st_ivas, p_output, *nSamplesRendered ); } -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING else if ( st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { pan_left = ( st_ivas->hDecoderConfig->non_diegetic_pan_gain + 1.f ) * 0.5f; @@ -746,7 +704,6 @@ ivas_error ivas_jbm_dec_render( v_multc( st_ivas->hTcBuffer->tc[0], pan_right, output[1], *nSamplesRendered ); v_multc( st_ivas->hTcBuffer->tc[0], pan_left, output[0], *nSamplesRendered ); } -#endif else if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) { /* Convert to Ambisonics; used also for ISM->HOA3->binaural rendering */ @@ -788,11 +745,7 @@ ivas_error ivas_jbm_dec_render( { ivas_dirac_dec_binaural_render( st_ivas, nSamplesAskedLocal, nSamplesRendered, nSamplesAvailableNext, nchan_remapped, p_output ); } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_DIRAC || st_ivas->ivas_format == MASA_FORMAT ) -#else else if ( st_ivas->ivas_format == MASA_FORMAT ) -#endif { if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { @@ -1318,12 +1271,7 @@ int16_t ivas_jbm_dec_get_num_tc_channels( } if ( st_ivas->ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - if ( ( st_ivas->sba_mode != SBA_MODE_SPAR && st_ivas->sba_planar && num_tc >= 3 ) || - ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && num_tc == 3 ) ) -#else if ( ( st_ivas->sba_planar && num_tc >= 3 ) || ( num_tc == 3 ) ) -#endif { num_tc++; } @@ -1811,9 +1759,7 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( case RENDERER_PARAM_ISM: case RENDERER_BINAURAL_MIXER_CONV: case RENDERER_BINAURAL_MIXER_CONV_ROOM: -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING case RENDERER_NON_DIEGETIC_DOWNMIX: -#endif buffer_mode = TC_BUFFER_MODE_RENDERER; break; case RENDERER_MC_PARAMMC: @@ -1843,11 +1789,7 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( } break; case RENDERER_SBA_LINEAR_DEC: -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) -#else if ( st_ivas->ivas_format == SBA_FORMAT && ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) ) -#endif { buffer_mode = TC_BUFFER_MODE_BUFFER; } @@ -1864,4 +1806,3 @@ TC_BUFFER_MODE ivas_jbm_dec_get_tc_buffer_mode( return buffer_mode; } -#endif diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c index 8d6cebe036d31c4b4182ef6e1f3b259feaad6f2c..45f56875ff24dfe627a6bc679cabe59cac766aaf 100644 --- a/lib_dec/ivas_masa_dec.c +++ b/lib_dec/ivas_masa_dec.c @@ -55,11 +55,6 @@ /*-----------------------------------------------------------------------* * Local function prototypes *-----------------------------------------------------------------------*/ -#ifndef HR_METADATA -static int16_t quantize_theta( float x, int16_t no_cb, float *xhat ); -static uint16_t index_theta_phi_16( float theta, float phi, SPHERICAL_GRID_DATA *Sph_Grid16 ); -static int16_t quantize_phi_masa( float phi, int16_t flag_delta, float *phi_hat, const int16_t n ); -#endif static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, SPHERICAL_GRID_DATA *Sph_Grid16 ); @@ -196,36 +191,24 @@ ivas_error ivas_masa_decode( /* Remove already read bits from the bit budget */ hQMetaData->metadata_max_bits -= *nb_bits_read; -#ifdef HR_METADATA if ( ivas_total_brate >= IVAS_384k ) { if ( ivas_total_brate >= IVAS_512k ) { - *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 16, 4 -#ifdef FIX_HBR_MASAMETA - , - hMasa->config.numCodingBands -#endif - ); + *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 16, 4, + hMasa->config.numCodingBands ); } else { - *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 11, 3 -#ifdef FIX_HBR_MASAMETA - , - hMasa->config.numCodingBands -#endif - ); + *nb_bits_read += ivas_qmetadata_dec_decode_hr_384_512( hQMetaData, st->bit_stream, &st->next_bit_pos, hMasa->data.sph_grid16, 11, 3, + hMasa->config.numCodingBands ); } } else { -#endif *nb_bits_read += ivas_qmetadata_dec_decode( hQMetaData, st->bit_stream, &st->next_bit_pos, 0 ); -#ifdef HR_METADATA } -#endif /* Get direction decoding quality. EC 1 and 2 are handled by the default value. */ if ( hQMetaData->ec_flag == 2 ) @@ -287,11 +270,7 @@ ivas_error ivas_masa_decode( } tmp_elem_mode = -1; -#ifndef SBA_MODE_CLEAN_UP - *nb_bits_read += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), st_ivas->nchan_transport, &tmp_elem_mode, ivas_format, SBA_MODE_NONE ); -#else *nb_bits_read += ivas_qmetadata_dec_sid_decode( hQMetaData, st->bit_stream, &( st->next_bit_pos ), st_ivas->nchan_transport, &tmp_elem_mode, ivas_format ); -#endif if ( st_ivas->nchan_transport == 2 ) { assert( st_ivas->nCPE > 0 ); @@ -312,11 +291,7 @@ ivas_error ivas_masa_decode( if ( st_ivas->hDirAC != NULL ) { ivas_qmetadata_to_dirac( hQMetaData, st_ivas->hDirAC, hMasa, ivas_total_brate, -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE_NONE, -#else ivas_format, -#endif 0, 0 ); } @@ -414,7 +389,6 @@ ivas_error ivas_masa_dec_open( st_ivas->hMasa = hMasa; -#ifdef JBM_TSM_ON_TCS /* allocate transport channels*/ if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL && st_ivas->renderer_type != RENDERER_DISABLE && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC && st_ivas->renderer_type != RENDERER_BINAURAL_PARAMETRIC_ROOM && st_ivas->renderer_type != RENDERER_STEREO_PARAMETRIC ) { @@ -433,7 +407,6 @@ ivas_error ivas_masa_dec_open( return error; } } -#endif /* JBM_TMS_ON_TCS*/ return error; } @@ -516,10 +489,8 @@ static ivas_error ivas_masa_dec_config( { int16_t i; MASA_DECODER_HANDLE hMasa; -#ifdef FIX_HBR_MASAMETA uint8_t maxBand; int16_t maxBin; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -529,7 +500,6 @@ static ivas_error ivas_masa_dec_config( ivas_masa_set_coding_config( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hDecoderConfig->ivas_total_brate, st_ivas->nchan_transport, ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ); -#ifdef HR_METADATA if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->hDecoderConfig->ivas_total_brate == IVAS_512k ) { hMasa->config.mergeRatiosOverSubframes = 0; @@ -540,7 +510,6 @@ static ivas_error ivas_masa_dec_config( generate_gridEq( hMasa->data.sph_grid16 ); } } -#endif st_ivas->hQMetaData->metadata_max_bits = hMasa->config.max_metadata_bits; st_ivas->hQMetaData->bandMap = hMasa->data.band_mapping; st_ivas->hQMetaData->nchan_transport = st_ivas->nchan_transport; @@ -570,7 +539,6 @@ static ivas_error ivas_masa_dec_config( ivas_set_qmetadata_maxbit_req( st_ivas->hQMetaData, st_ivas->ivas_format ); -#ifdef FIX_HBR_MASAMETA /* Find maximum band usable */ maxBin = (int16_t) ( st_ivas->hDecoderConfig->output_Fs * INV_CLDFB_BANDWIDTH ); maxBand = 0; @@ -589,17 +557,6 @@ static ivas_error ivas_masa_dec_config( { masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, maxBand, 0, NULL ); } -#else - if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) - { - /* need to apply the sampling rate correction also for the EXT output MASA meta buffer */ - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, hMasa->data.extOutMeta ); - } - else - { - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, st_ivas->hQMetaData, st_ivas->hDecoderConfig->output_Fs, NULL ); - } -#endif return error; } @@ -617,11 +574,7 @@ void ivas_masa_prerender( const int16_t output_frame /* i : output frame length per channel */ ) { -#ifdef FIX_490_MASA_2TC_LBR_DTX if ( st_ivas->ivas_format == MASA_FORMAT && st_ivas->nchan_transport == 2 && st_ivas->hDecoderConfig->ivas_total_brate < MASA_STEREO_MIN_BITRATE ) -#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_5k2 ) -#endif { if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_EXTERNAL ) { @@ -643,176 +596,6 @@ void ivas_masa_prerender( /*-------------------------------------------------------------------* * Local functions *-------------------------------------------------------------------*/ -#ifndef HR_METADATA -/* !r: index of quantized value */ -static int16_t quantize_theta( - float x, /* i : theta value to be quantized */ - int16_t no_cb, /* i : number of codewords */ - float *xhat /* o : quantized value */ -) -{ - int16_t imin; - float diff1, diff2; - - imin = (int16_t) ( x * MASA_INV_ANGLE_AT_EQUATOR_DEG + 0.5f ); - - if ( imin >= no_cb - 1 ) - { - imin = no_cb - 1; - diff1 = x - 90; - diff2 = x - MASA_ANGLE_AT_EQUATOR_DEG * ( imin - 1 ); - if ( fabsf( diff1 ) > fabsf( diff2 ) ) - { - imin--; - *xhat = imin * MASA_ANGLE_AT_EQUATOR_DEG; - } - else - { - *xhat = 90; - } - } - else - { - *xhat = imin * MASA_ANGLE_AT_EQUATOR_DEG; - } - - return imin; -} - - -/* !r: index azimuth */ -static int16_t quantize_phi_masa( - float phi, /* i : azimuth value */ - int16_t flag_delta, /* i : flag indicating if the azimuth codebook is translated or not */ - float *phi_hat, /* o : quantized azimuth */ - const int16_t n /* i : azimuth codebook size */ -) -{ - int16_t id_phi; - float dd; - float delta_phi; - - delta_phi = 360.0f / (float) n; - - if ( n == 1 ) - { - *phi_hat = 0; - - return 0; - } - - if ( flag_delta == 1 ) - { - dd = delta_phi / 2.0f; - } - else - { - dd = 0; - } - - id_phi = (int16_t) ( ( phi - dd + delta_phi / 2.0f ) / (float) delta_phi ); - - if ( id_phi == n ) - { - id_phi = 0; - } - - if ( id_phi == -1 ) - { - id_phi = n - 1; - } - - *phi_hat = id_phi * delta_phi + dd; - - return id_phi; -} - - -/* !r: output index for direction */ -static uint16_t index_theta_phi_16( - float theta, /* i : input elevation to be indexed */ - float phi, /* i : input azimuth to be indexed */ - SPHERICAL_GRID_DATA *gridData /* i : generated grid data */ -) -{ - float abs_theta; - int16_t sign_th, id_phi, id_th; - uint16_t idx_sph; - uint16_t cum_n; - float theta_hat, phi_hat; /* Can be removed */ - - phi = phi + 180; - - if ( theta < 0 ) - { - abs_theta = -theta; - sign_th = -1; - } - else - { - abs_theta = theta; - sign_th = 1; - } - - id_th = quantize_theta( abs_theta, gridData->no_theta, &theta_hat ); - if ( gridData->no_theta > 1 ) - { - if ( gridData->no_phi[id_th] > 1 ) - { - id_phi = quantize_phi_masa( phi, ( id_th % 2 == 1 ), &phi_hat, gridData->no_phi[id_th] ); - } - else - { - id_phi = 0; - phi_hat = 180; - } - } - else - { - id_phi = quantize_phi_masa( phi, ( id_th % 2 == 1 ), &phi_hat, gridData->no_phi[id_th] ); - } - - /* Starting from Equator, alternating positive and negative */ - if ( id_th == 0 ) - { - idx_sph = id_phi; - } - else - { - if ( id_th == gridData->no_theta - 1 ) - { - idx_sph = 65534 + ( sign_th < 0 ); - } - else - { - theta = MASA_ANGLE_AT_EQUATOR * (float) ( id_th + 0.5f ); - if ( id_th == 1 ) - { - cum_n = 2 * (uint16_t) ceilf( MASA_NTOT2_FAC * ( sinf( theta ) - MASA_ASIN_OFFSET ) ); - } - else - { - cum_n = 2 * (uint16_t) roundf( MASA_NTOT2_FAC * ( sinf( theta ) - MASA_ASIN_OFFSET ) ); - } - - cum_n += gridData->no_phi[0]; - - if ( sign_th > 0 ) - { - cum_n -= 2 * gridData->no_phi[id_th]; - } - else - { - cum_n -= gridData->no_phi[id_th]; - } - idx_sph = cum_n + id_phi; - } - } - - - return idx_sph; -} -#endif static void index_16bits( IVAS_QMETADATA_HANDLE hQMetaData, @@ -1299,7 +1082,6 @@ ivas_error ivas_masa_dec_reconfigure( ivas_masa_set_elements( ivas_total_brate, st_ivas->mc_mode, st_ivas->nchan_transport, st_ivas->hQMetaData, &tmp, &tmp, &tmp ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active == 1 ) { int16_t tc_nchan_to_allocate; @@ -1323,15 +1105,11 @@ ivas_error ivas_masa_dec_reconfigure( } } } -#endif return error; } -#ifdef JBM_TSM_ON_TCS -#endif - void ivas_spar_param_to_masa_param_mapping( Decoder_Struct *st_ivas, /* i/o: IVAS decoder struct */ float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : Input audio in CLDFB domain, real */ @@ -1355,11 +1133,9 @@ void ivas_spar_param_to_masa_param_mapping( float foaCovarianceMtx[FOA_CHANNELS][FOA_CHANNELS]; float Iy, Iz, Ix, E, azi, ele, I, ratio; float diffuseGainX, diffuseGainY, diffuseGainZ, diffuseGainSum; -#ifdef JBM_TSM_ON_TCS int16_t slot_idx, slot_idx_start, sf; SPAR_DEC_HANDLE hSpar; float slot_fac; -#endif /* Set values */ hDirAC = st_ivas->hDirAC; @@ -1367,12 +1143,8 @@ void ivas_spar_param_to_masa_param_mapping( hDiffuseDist = st_ivas->hDirAC->hDiffuseDist; nchan_transport = st_ivas->nchan_transport; band_grouping = hDirAC->band_grouping; -#ifdef JBM_TSM_ON_TCS hSpar = st_ivas->hSpar; dirac_write_idx = hDirAC->render_to_md_map[subframe]; -#else - dirac_write_idx = hDirAC->dirac_read_idx; /* Mixing matrices, from which MASA meta is determined, already have the delay compensation */ -#endif /* Init arrays */ for ( i = 0; i < FOA_CHANNELS; i++ ) @@ -1381,61 +1153,41 @@ void ivas_spar_param_to_masa_param_mapping( } /* Delay the SPAR mixing matrices to have them synced with the audio */ -#ifdef JBM_TSM_ON_TCS slot_idx_start = hSpar->slots_rendered; slot_fac = 1.0f / (float) hSpar->subframe_nbslots[subframe]; for ( slot_idx = 0; slot_idx < hSpar->subframe_nbslots[subframe]; slot_idx++ ) { sf = hSpar->render_to_md_map[slot_idx + slot_idx_start] / JBM_CLDFB_SLOTS_IN_SUBFRAME; -#endif if ( subframe < SPAR_META_DELAY_SUBFRAMES ) { -#ifdef JBM_TSM_ON_TCS mixer_mat_index = sf + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; -#else - mixer_mat_index = subframe + MAX_PARAM_SPATIAL_SUBFRAMES - SPAR_META_DELAY_SUBFRAMES + 1; -#endif for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) { for ( i = 0; i < FOA_CHANNELS; i++ ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { -#ifdef JBM_TSM_ON_TCS mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; -#else - mixer_mat_sf_bands_real[band][i][j] = st_ivas->hSpar->hMdDec->mixer_mat_prev[mixer_mat_index][i][j][band]; -#endif } } } } else { -#ifdef JBM_TSM_ON_TCS mixer_mat_index = sf - SPAR_META_DELAY_SUBFRAMES; -#else - mixer_mat_index = subframe - SPAR_META_DELAY_SUBFRAMES; -#endif for ( band = 0; band < SPAR_DIRAC_SPLIT_START_BAND; band++ ) { for ( i = 0; i < FOA_CHANNELS; i++ ) { for ( j = 0; j < FOA_CHANNELS; j++ ) { -#ifdef JBM_TSM_ON_TCS mixer_mat_sf_bands_real[band][i][j] = slot_fac * st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; -#else - mixer_mat_sf_bands_real[band][i][j] = st_ivas->hSpar->hMdDec->mixer_mat[i][j][band + mixer_mat_index * IVAS_MAX_NUM_BANDS]; -#endif } } } } -#ifdef JBM_TSM_ON_TCS } -#endif /* Map the mixing matrices from the frequency bands to frequency bins */ bin = 0; @@ -1464,11 +1216,7 @@ void ivas_spar_param_to_masa_param_mapping( set_zero( transportSignalEnergies[1], nBins ); set_zero( transportSignalCrossCorrelation, nBins ); -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) -#else - for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) -#endif { for ( bin = 0; bin < nBins; bin++ ) { @@ -1486,15 +1234,9 @@ void ivas_spar_param_to_masa_param_mapping( if ( hDiffuseDist != NULL ) { -#ifdef JBM_TSM_ON_TCS set_zero( hDiffuseDist->diffuseRatioX, CLDFB_NO_CHANNELS_MAX ); set_zero( hDiffuseDist->diffuseRatioY, CLDFB_NO_CHANNELS_MAX ); set_zero( hDiffuseDist->diffuseRatioZ, CLDFB_NO_CHANNELS_MAX ); -#else - set_zero( hDiffuseDist->diffuseRatioX[subframe], CLDFB_NO_CHANNELS_MAX ); - set_zero( hDiffuseDist->diffuseRatioY[subframe], CLDFB_NO_CHANNELS_MAX ); - set_zero( hDiffuseDist->diffuseRatioZ[subframe], CLDFB_NO_CHANNELS_MAX ); -#endif } for ( bin = 0; bin < nBins; bin++ ) @@ -1566,7 +1308,6 @@ void ivas_spar_param_to_masa_param_mapping( diffuseGainSum = diffuseGainY + diffuseGainX + diffuseGainZ; -#ifdef JBM_TSM_ON_TCS if ( diffuseGainSum == 0.0f ) { hDiffuseDist->diffuseRatioX[bin] = 1.0f / 3.0f; @@ -1579,20 +1320,6 @@ void ivas_spar_param_to_masa_param_mapping( hDiffuseDist->diffuseRatioY[bin] = diffuseGainY / ( diffuseGainSum + EPSILON ); hDiffuseDist->diffuseRatioZ[bin] = diffuseGainZ / ( diffuseGainSum + EPSILON ); } -#else - if ( diffuseGainSum == 0.0f ) - { - hDiffuseDist->diffuseRatioX[subframe][bin] = 1.0f / 3.0f; - hDiffuseDist->diffuseRatioY[subframe][bin] = 1.0f / 3.0f; - hDiffuseDist->diffuseRatioZ[subframe][bin] = 1.0f / 3.0f; - } - else - { - hDiffuseDist->diffuseRatioX[subframe][bin] = diffuseGainX / ( diffuseGainSum + EPSILON ); - hDiffuseDist->diffuseRatioY[subframe][bin] = diffuseGainY / ( diffuseGainSum + EPSILON ); - hDiffuseDist->diffuseRatioZ[subframe][bin] = diffuseGainZ / ( diffuseGainSum + EPSILON ); - } -#endif } } diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c index 4be35d188e885187d17629cb048449ebce5a3a64..2745481402f25ba335f53f86157335e1ecfff714 100644 --- a/lib_dec/ivas_mc_param_dec.c +++ b/lib_dec/ivas_mc_param_dec.c @@ -76,11 +76,7 @@ typedef struct parameter_band_mapping_struct static void ivas_param_mc_dec_init( PARAM_MC_DEC_HANDLE hParamMC, const int16_t nchan_in, const int16_t nchan_out ); -#ifdef JBM_TSM_ON_TCS static void param_mc_protoSignalComputation( float *RealBuffer, float *ImagBuffer, float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t num_freq_bands ); -#else -static void param_mc_protoSignalComputation( float RealBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], float ImagBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], float *proto_frame_f, const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, const int16_t slot_index, const int16_t num_freq_bands ); -#endif static void ivas_param_mc_dec_copy_diffuse_proto( PARAM_MC_DEC_HANDLE hParamMC, float Cldfb_buffer_real[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float Cldfb_buffer_imag[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nY, const int16_t slot_idx ); @@ -90,21 +86,11 @@ static int16_t ivas_param_mc_uniform_decoder( float *seq, const int16_t sz_seq, static void ivas_param_mc_dequantize_cov( PARAM_MC_DEC_HANDLE hDirAC, float *ild_q, float *icc_q, const int16_t param_band_index, const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nY, const int16_t nX, float *Cx_state, float *Cproto, float *Cy_state ); -#ifdef JBM_TSM_ON_TCS static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float *mixing_matrix[], float *mixing_matrix_res[], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); -#else -static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY ); - -static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const int16_t nY_intern, const int16_t nX, const int16_t nY_cov ); -#endif -#ifdef JBM_TSM_ON_TCS static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float *mixing_matrix[], float *mixing_matrix_res[], const uint16_t nX, const uint16_t nY ); -#else -static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], const uint16_t nX, const uint16_t nY ); -#endif static void ivas_param_mc_dec_compute_interpolator( const uint16_t bAttackPresent, const uint16_t attackPos, const uint16_t interp_length, float *interpolator ); @@ -238,13 +224,9 @@ ivas_error ivas_param_mc_dec_open( *-----------------------------------------------------------------*/ hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; -#ifdef JBM_TSM_ON_TCS set_s( hParamMC->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hParamMC->subframe_nbslots, PARAM_MC_MAX_NSLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); hParamMC->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; -#else - hParamMC->subframe_nbslots = CLDFB_NO_COL_MAX / PARAM_MC_NSUBFRAMES_DEC; -#endif hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; @@ -440,9 +422,7 @@ ivas_error ivas_param_mc_dec_open( return error; } -#ifdef JBM_TSM_ON_TCS ivas_param_mc_dec_compute_interpolator( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator ); -#endif /* Head rotation */ if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) && st_ivas->hDecoderConfig->Opt_Headrotation ) @@ -478,7 +458,6 @@ ivas_error ivas_param_mc_dec_open( ivas_param_mc_dec_init( hParamMC, nchan_transport, nchan_out_cov ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active && hParamMC->synthesis_conf != PARAM_MC_SYNTH_MONO_STEREO ) { if ( ( hParamMC->Cldfb_RealBuffer_tc = (float *) malloc( MAX_JBM_CLDFB_TIMESLOTS * nchan_transport * hParamMC->num_freq_bands * sizeof( float ) ) ) == NULL ) @@ -509,7 +488,6 @@ ivas_error ivas_param_mc_dec_open( hParamMC->subframes_rendered = 0; hParamMC->slots_rendered = 0; -#endif st_ivas->hParamMC = hParamMC; @@ -653,14 +631,10 @@ ivas_error ivas_param_mc_dec_reconfig( #endif } - /*-----------------------------------------------------------------* - * set input parameters - *-----------------------------------------------------------------*/ + /*-----------------------------------------------------------------* + * set input parameters + *-----------------------------------------------------------------*/ -#ifndef JBM_TSM_ON_TCS - hParamMC->slot_size = (int16_t) ( output_Fs / FRAMES_PER_SEC ) / CLDFB_NO_COL_MAX; - hParamMC->subframe_nbslots = CLDFB_NO_COL_MAX / PARAM_MC_NSUBFRAMES_DEC; -#endif hParamMC->num_freq_bands = (int16_t) ( output_Fs * INV_CLDFB_BANDWIDTH + 0.5f ); hParamMC->max_band_energy_compensation = hParamMC->num_freq_bands; @@ -971,9 +945,7 @@ ivas_error ivas_param_mc_dec_reconfig( return error; } -#ifdef JBM_TSM_ON_TCS ivas_param_mc_dec_compute_interpolator( 0, 0, DEFAULT_JBM_CLDFB_TIMESLOTS, hParamMC->h_output_synthesis_params.interpolator ); -#endif ivas_dirac_dec_output_synthesis_cov_init( &( hParamMC->h_output_synthesis_cov_state ), nchan_transport, nchan_out_cov, hParamMC->hMetadataPMC->num_parameter_bands, max_param_band_residual ); @@ -1185,7 +1157,6 @@ void ivas_param_mc_dec_close( hParamMC->hoa_encoder = NULL; } -#ifdef JBM_TSM_ON_TCS if ( hParamMC->Cldfb_RealBuffer_tc != NULL ) { free( hParamMC->Cldfb_RealBuffer_tc ); @@ -1196,7 +1167,6 @@ void ivas_param_mc_dec_close( free( hParamMC->Cldfb_ImagBuffer_tc ); hParamMC->Cldfb_ImagBuffer_tc = NULL; } -#endif free( *hParamMC_out ); *hParamMC_out = NULL; @@ -1315,9 +1285,6 @@ void ivas_param_mc_dec_read_BS( num_lfe_bands = 0; } -#ifndef JBM_TSM_ON_TCS - ivas_param_mc_dec_compute_interpolator( hMetadataPMC->bAttackPresent, hMetadataPMC->attackIndex, PARAM_MC_MAX_NSLOTS, hParamMC->h_output_synthesis_params.interpolator ); -#endif if ( hMetadataPMC->flag_use_adaptive_icc_map == 1 ) { @@ -1404,9 +1371,6 @@ void ivas_param_mc_dec_read_BS( /* for PLC, use the saved ILDs and ICCs from the past and set the transient flag and transient position to zero */ hMetadataPMC->bAttackPresent = 0; hMetadataPMC->attackIndex = 0; -#ifndef JBM_TSM_ON_TCS - ivas_param_mc_dec_compute_interpolator( hMetadataPMC->bAttackPresent, hMetadataPMC->attackIndex, PARAM_MC_MAX_NSLOTS, hParamMC->h_output_synthesis_params.interpolator ); -#endif } pop_wmops(); @@ -1415,7 +1379,6 @@ void ivas_param_mc_dec_read_BS( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------------- * ivas_param_mc_dec_digest_tc() * @@ -1845,7 +1808,6 @@ void ivas_param_mc_dec_render( return; } -#endif /*------------------------------------------------------------------------- @@ -1854,7 +1816,6 @@ void ivas_param_mc_dec_render( * Parametric MC decoding process *------------------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS void ivas_param_mc_dec( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ float *output_f[] /* i/o: synthesized core-coder transport channels/DirAC output */ @@ -1888,330 +1849,6 @@ void ivas_param_mc_dec( pop_wmops(); return; } -#else -void ivas_param_mc_dec( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output_f[][L_FRAME48k] /* i/o: synthesized core-coder transport channels/DirAC output */ -) -{ - PARAM_MC_DEC_HANDLE hParamMC; - int16_t i, ch; - int16_t subframe_idx; - int16_t nb_subframes; - int16_t slot_idx, param_band_idx, slot_idx_start; - int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb; - int16_t nchan_out_cov; - /*CLDFB*/ - float Cldfb_RealBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_in[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer[MAX_INTERN_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_RealBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float Cldfb_ImagBuffer_Binaural[BINAURAL_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX]; - float cx[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float cx_imag[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS]; - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS]; - float real_part, imag_part; - /*Decorrelator*/ - float onset_filter[MAX_CICP_CHANNELS * CLDFB_NO_CHANNELS_MAX]; - /* format converter */ - int16_t channel_active[MAX_OUTPUT_CHANNELS]; - uint16_t nband_synth, nbands_to_zero; - uint16_t nchan_out_init; - IVAS_OUTPUT_SETUP *hSynthesisOutputSetup; - - hParamMC = st_ivas->hParamMC; - assert( hParamMC ); - - push_wmops( "param_mc_dec" ); - - set_s( channel_active, 0, MAX_CICP_CHANNELS ); - nchan_transport = st_ivas->nchan_transport; - nchan_out_transport = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - nchan_out_init = nchan_out_transport; - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - nchan_out_cldfb = BINAURAL_CHANNELS; - set_s( channel_active, 1, nchan_out_cldfb ); - if ( st_ivas->hHeadTrackData ) - { - nchan_out_init = MAX_INTERN_CHANNELS; - } - nchan_out_cov = st_ivas->hTransSetup.nchan_out_woLFE + st_ivas->hTransSetup.num_lfe; - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) - { - nchan_out_cov = nchan_out_transport; - nchan_out_cldfb = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - nchan_out_cov = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - nchan_out_cldfb = nchan_out_cov; - set_s( channel_active, 1, nchan_out_cov ); - hSynthesisOutputSetup = &st_ivas->hOutSetup; - } - else - { - nchan_out_cov = nchan_out_transport; - nchan_out_cldfb = nchan_out_transport; - set_s( channel_active, 1, nchan_out_cov ); - hSynthesisOutputSetup = &st_ivas->hTransSetup; - } - - /* set everything to zero that will not be decoded */ - nband_synth = hParamMC->band_grouping[hParamMC->num_param_bands_synth]; - nbands_to_zero = hParamMC->num_freq_bands - nband_synth; - for ( ch = 0; ch < nchan_out_init; ch++ ) - { - for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots; slot_idx++ ) - { - set_zero( &( Cldfb_RealBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); - set_zero( &( Cldfb_ImagBuffer[ch][slot_idx][nband_synth] ), nbands_to_zero ); - } - } - - for ( param_band_idx = 0; param_band_idx < PARAM_MC_MAX_PARAMETER_BANDS; param_band_idx++ ) - { - set_zero( cx[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - set_zero( cx_imag[param_band_idx], PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS ); - } - - /* slot loop for gathering the input data */ - for ( slot_idx = 0; slot_idx < CLDFB_NO_COL_MAX; slot_idx++ ) - { - float RealBuffer[CLDFB_NO_CHANNELS_MAX]; - float ImagBuffer[CLDFB_NO_CHANNELS_MAX]; - - /* CLDFB Analysis*/ - for ( ch = 0; ch < nchan_transport; ch++ ) - { - cldfbAnalysis_ts( &( output_f[ch][hParamMC->num_freq_bands * slot_idx] ), RealBuffer, ImagBuffer, hParamMC->num_freq_bands, st_ivas->cldfbAnaDec[ch] ); - - mvr2r( RealBuffer, Cldfb_RealBuffer_in[ch][slot_idx], hParamMC->num_freq_bands ); - mvr2r( ImagBuffer, Cldfb_ImagBuffer_in[ch][slot_idx], hParamMC->num_freq_bands ); - } - - if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex ) - { - ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, cx, cx_imag, hParamMC, nchan_transport, slot_idx ); - } - } - - /* map from complex input covariance to real values */ - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ ) - { - /* Cx for transport channels */ - for ( i = 0; i < nchan_transport * nchan_transport; i++ ) - { - real_part = cx[param_band_idx][i]; - imag_part = cx_imag[param_band_idx][i]; - - /* (a-ib)(c+id) = ac + bd + i(ad-bc) */ - if ( param_band_idx < hParamMC->max_param_band_abs_cov ) - { - cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part ); - } - else - { - cx[param_band_idx][i] = real_part; - } - } - } - - /* we have to do it similar to the encoder in case of attacks (i.e. accumulate two bands) to ensure correct DMX of the target covariance*/ - if ( hParamMC->hMetadataPMC->bAttackPresent && ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_COV || hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) ) - { - for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 ) - { - v_add( cx[param_band_idx], cx[param_band_idx + 1], cx[param_band_idx], nchan_transport * nchan_transport ); - mvr2r( cx[param_band_idx], cx[param_band_idx + 1], nchan_transport * nchan_transport ); - } - } - - - if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_MONO_STEREO ) - { - ivas_param_mc_get_mono_stereo_mixing_matrices( hParamMC, cx, mixing_matrix, mixing_matrix_res, nchan_out_transport, nchan_transport, nchan_out_cov ); - } - else - { - /* generate mixing matrices */ - ivas_param_mc_get_mixing_matrices( hParamMC, hSynthesisOutputSetup, cx, mixing_matrix, mixing_matrix_res, nchan_out_transport, hParamMC->synthesis_conf, nchan_transport, nchan_out_cov ); - } - - /*** split here... ***/ - - /* subframe loop for synthesis*/ - nb_subframes = CLDFB_NO_COL_MAX / hParamMC->subframe_nbslots; - for ( subframe_idx = 0; subframe_idx < nb_subframes; subframe_idx++ ) - { - slot_idx_start = subframe_idx * hParamMC->subframe_nbslots; - for ( slot_idx = 0; slot_idx < hParamMC->subframe_nbslots; slot_idx++ ) - { - - if ( hParamMC->max_band_decorr > 0 ) - { - /*-----------------------------------------------------------------* - * protoype signal computation - *-----------------------------------------------------------------*/ - - param_mc_protoSignalComputation( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, - hParamMC->proto_frame_f, hParamMC->diff_proto_info, - slot_idx + slot_idx_start, hParamMC->num_freq_bands ); - - /*-----------------------------------------------------------------* - * frequency domain decorrelation - *-----------------------------------------------------------------*/ - - /* decorrelate prototype frame */ - ivas_dirac_dec_decorr_process( hParamMC->num_freq_bands, - hParamMC->num_outputs_diff, - hParamMC->diff_proto_info->num_protos_diff, - DIRAC_SYNTHESIS_COV_MC_LS, - nchan_transport, - hParamMC->proto_frame_f, - hParamMC->diff_proto_info->num_protos_diff, - hParamMC->diff_proto_info->proto_index_diff, - hParamMC->proto_frame_dec_f, - onset_filter, - hParamMC->h_freq_domain_decorr_ap_params, - hParamMC->h_freq_domain_decorr_ap_state ); - - /* copy decorrelated frame directly to output CLDFB buffer, acts also as intermediate */ - /* memory for the decorrelated signal */ - ivas_param_mc_dec_copy_diffuse_proto( hParamMC, Cldfb_RealBuffer, Cldfb_ImagBuffer, nchan_out_cov, slot_idx ); - } - - /*-----------------------------------------------------------------* - * output synthesis - *-----------------------------------------------------------------*/ - - ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot( Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, Cldfb_RealBuffer, Cldfb_ImagBuffer, - mixing_matrix, mixing_matrix_res, slot_idx, slot_idx + slot_idx_start, - nchan_transport, nchan_out_cov, hParamMC ); - - if ( ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) ) - { - if ( st_ivas->hHeadTrackData && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV ) - { - ivas_param_mc_mc2sba_cldfb( st_ivas->hTransSetup, hParamMC->hoa_encoder, slot_idx, Cldfb_RealBuffer, Cldfb_ImagBuffer, nband_synth, GAIN_LFE ); - } - else - { - /* remove LFE */ - uint16_t idx_out; - uint16_t idx_lfe; - IVAS_OUTPUT_SETUP hLsSetup; - - hLsSetup = st_ivas->hTransSetup; - - /* If LFE should be rendered, add it to other channels before removing */ - if ( st_ivas->hBinRenderer->render_lfe ) - { - for ( idx_lfe = 0; idx_lfe < hLsSetup.num_lfe; idx_lfe++ ) - { - /* Copy just the first band of LFE*/ - v_multc( Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); - v_multc( Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], ( GAIN_LFE / hLsSetup.nchan_out_woLFE ), Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], 1 ); - - for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) - { - if ( hLsSetup.index_lfe[idx_lfe] != ch ) - { - v_add( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_RealBuffer[ch][slot_idx], 1 ); - v_add( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[hLsSetup.index_lfe[idx_lfe]][slot_idx], Cldfb_ImagBuffer[ch][slot_idx], 1 ); - } - } - } - } - - idx_out = 0; - idx_lfe = 0; - - for ( ch = 0; ch < ( hLsSetup.nchan_out_woLFE + hLsSetup.num_lfe ); ch++ ) - { - if ( ( hLsSetup.num_lfe > 0 ) && ( hLsSetup.index_lfe[idx_lfe] == ch ) ) - { - if ( idx_lfe < ( hLsSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else if ( ch != idx_out ) - { - mvr2r( Cldfb_RealBuffer[ch][slot_idx], Cldfb_RealBuffer[idx_out][slot_idx], nband_synth ); - mvr2r( Cldfb_ImagBuffer[ch][slot_idx], Cldfb_ImagBuffer[idx_out][slot_idx], nband_synth ); - idx_out++; - } - else - { - idx_out++; - } - } - } - } - } - - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - ivas_binRenderer( st_ivas->hBinRenderer, st_ivas->hHeadTrackData, Cldfb_RealBuffer_Binaural, Cldfb_ImagBuffer_Binaural, Cldfb_RealBuffer, Cldfb_ImagBuffer ); - } - else if ( hParamMC->synthesis_conf == PARAM_MC_SYNTH_LS_CONV_CLDFB ) - { - /* format conversion*/ - ivas_lssetupconversion_process_param_mc( st_ivas, Cldfb_RealBuffer, Cldfb_ImagBuffer, channel_active ); - } - - /* CLDFB synthesis */ - for ( ch = 0; ch < nchan_out_cldfb; ch++ ) - { - float *RealBuffer[16]; - float *ImagBuffer[16]; - - if ( channel_active[ch] ) - { - /* open CLDFB buffer up to CLDFB_NO_CHANNELS_MAX bands for 48kHz */ - for ( i = 0; i < hParamMC->subframe_nbslots; i++ ) - { - if ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM ) - { - RealBuffer[i] = Cldfb_RealBuffer_Binaural[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer_Binaural[ch][i]; - } - else - { - RealBuffer[i] = Cldfb_RealBuffer[ch][i]; - ImagBuffer[i] = Cldfb_ImagBuffer[ch][i]; - } - } - cldfbSynthesis( RealBuffer, ImagBuffer, &( output_f[ch][slot_idx_start * hParamMC->num_freq_bands] ), - hParamMC->num_freq_bands * hParamMC->subframe_nbslots, st_ivas->cldfbSynDec[ch] ); - } - else - { - set_f( &( output_f[ch][slot_idx_start * hParamMC->num_freq_bands] ), 0.0f, hParamMC->num_freq_bands * hParamMC->subframe_nbslots ); - } - } - } - - if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ) - { - ivas_mc2sba( st_ivas->hIntSetup, output_f, hParamMC->num_freq_bands * PARAM_MC_MAX_NSLOTS, st_ivas->hOutSetup.ambisonics_order, 0.f ); - } - - /* update */ - hParamMC->hMetadataPMC->last_coded_bwidth = hParamMC->hMetadataPMC->coded_bwidth; - param_mc_update_mixing_matrices( hParamMC, mixing_matrix, mixing_matrix_res, nchan_transport, nchan_out_cov ); - pop_wmops(); - - return; -} -#endif /*------------------------------------------------------------------------- @@ -2286,19 +1923,11 @@ static void ivas_param_mc_dec_init( *------------------------------------------------------------------------*/ static void param_mc_protoSignalComputation( -#ifdef JBM_TSM_ON_TCS - float *RealBuffer, /* i : CLDFB samples of the transport channels (real part) */ - float *ImagBuffer, /* i : CLDFB samples of the transport channels (imaginary part) */ -#else - float RealBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (real part) */ - float ImagBuffer[PARAM_MC_MAX_TRANSPORT_CHANS][PARAM_MC_MAX_NSLOTS][CLDFB_NO_CHANNELS_MAX], /* i : CLDFB samples of the transport channels (imaginary part) */ -#endif + float *RealBuffer, /* i : CLDFB samples of the transport channels (real part) */ + float *ImagBuffer, /* i : CLDFB samples of the transport channels (imaginary part) */ float *proto_frame_f, /* o : interleaved complex prototype CLDFB samples */ const PARAM_MC_DIFF_PROTO_INFO *diff_proto_info, /* i : prototype generation information */ -#ifndef JBM_TSM_ON_TCS - const int16_t slot_index, /* i : current slot index */ -#endif - const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ + const int16_t num_freq_bands /* i : number of frequency bands for the prototypes */ ) { int16_t band; @@ -2319,13 +1948,8 @@ static void param_mc_protoSignalComputation( int16_t source_ch_idx = diff_proto_info->source_chan_idx[proto_ch_idx][source_ch_cnt]; p_proto_frame = &proto_frame_f[proto_ch_idx * num_freq_bands * 2]; -#ifdef JBM_TSM_ON_TCS p_real_buffer = &RealBuffer[source_ch_idx * num_freq_bands]; p_imag_buffer = &ImagBuffer[source_ch_idx * num_freq_bands]; -#else - p_real_buffer = &RealBuffer[source_ch_idx][slot_index][0]; - p_imag_buffer = &ImagBuffer[source_ch_idx][slot_index][0]; -#endif for ( band = 0; band < num_freq_bands; band++ ) { @@ -2504,11 +2128,7 @@ static void ivas_param_mc_dec_compute_interpolator( float *interpolator /* o : interpolator */ ) { -#ifdef JBM_TSM_ON_TCS int16_t idx; -#else - uint16_t idx; -#endif if ( bAttackPresent ) { @@ -2523,14 +2143,7 @@ static void ivas_param_mc_dec_compute_interpolator( } else { -#ifdef JBM_TSM_ON_TCS ivas_jbm_dec_get_adapted_linear_interpolator( DEFAULT_JBM_CLDFB_TIMESLOTS, interp_length, interpolator ); -#else - for ( idx = 1; idx <= interp_length; ++idx ) - { - interpolator[idx - 1] = (float) idx / (float) interp_length; - } -#endif } return; @@ -2590,17 +2203,12 @@ static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */ -#ifdef JBM_TSM_ON_TCS - float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ - float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : direct mixing matrices for all parameter bands */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* o : residual mixing matrices for all parameter bands */ -#endif - const int16_t nY_intern, /* i : number of channels in the transported format */ - const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ - const int16_t nX, /* i : number of transport channels */ - const int16_t nY_cov /* i : number of covariance synthesis output channels */ + float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ + float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ + const int16_t nY_intern, /* i : number of channels in the transported format */ + const PARAM_MC_SYNTHESIS_CONF synth_config, /* i : Parametric MC synthesis config */ + const int16_t nX, /* i : number of transport channels */ + const int16_t nY_cov /* i : number of covariance synthesis output channels */ ) { int16_t param_band_idx; @@ -2849,16 +2457,11 @@ static void ivas_param_mc_get_mixing_matrices( static void ivas_param_mc_get_mono_stereo_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */ float Cx_in[PARAM_MC_MAX_PARAMETER_BANDS][PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : transport channel covariance for all parameter bands */ -#ifdef JBM_TSM_ON_TCS - float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ - float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : direct mixing matrix */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* o : residual mixing matrix (set to zero) */ -#endif - const int16_t nY_intern, /* i : number of channels of the transport format */ - const int16_t nX, /* i : number of transport channels */ - const int16_t nY_cov ) /* i : number of output channels */ + float *mixing_matrix[], /* o : direct mixing matrices for all parameter bands */ + float *mixing_matrix_res[], /* o : residual mixing matrices for all parameter bands */ + const int16_t nY_intern, /* i : number of channels of the transport format */ + const int16_t nX, /* i : number of transport channels */ + const int16_t nY_cov ) /* i : number of output channels */ { int16_t param_band_idx; float Cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS]; @@ -2974,15 +2577,10 @@ static void ivas_param_mc_get_mono_stereo_mixing_matrices( static void param_mc_update_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, /* i/o: Parametric MC handle */ -#ifdef JBM_TSM_ON_TCS - float *mixing_matrix[], /* i : direct mixing matrices for the frame just processed */ - float *mixing_matrix_res[], /* i : residual mixing matrices for the frame just processed */ -#else - float mixing_matrix[PARAM_MC_MAX_PARAMETER_BANDS][MAX_CICP_CHANNELS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : direct mixing matrices for the frame just processed */ - float mixing_matrix_res[PARAM_MC_MAX_PARAMETER_BANDS_RES][MAX_CICP_CHANNELS * MAX_CICP_CHANNELS], /* i : residual mixing matrices for the frame just processed */ -#endif - const uint16_t nX, /* i : number of transport channels */ - const uint16_t nY ) /* i : number of synthesis channels */ + float *mixing_matrix[], /* i : direct mixing matrices for the frame just processed */ + float *mixing_matrix_res[], /* i : residual mixing matrices for the frame just processed */ + const uint16_t nX, /* i : number of transport channels */ + const uint16_t nY ) /* i : number of synthesis channels */ { uint16_t param_band_idx; diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c index 46c4343800b8474a557627ae809ed95d5562798b..a3a03f9ead016e5c573eed07425c3733a973dbd6 100755 --- a/lib_dec/ivas_mct_dec.c +++ b/lib_dec/ivas_mct_dec.c @@ -54,11 +54,7 @@ * Local function prototypes *-----------------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas, uint16_t *nSamplesRendered, int16_t *data ); -#else -static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas ); -#endif /*--------------------------------------------------------------------------* * ivas_mct_dec() @@ -625,11 +621,9 @@ void ivas_mct_dec_close( ivas_error ivas_mc_dec_config( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t idx /* i : LS config. index */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : samples flushed from last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ -#endif ) { AUDIO_CONFIG signaled_config; @@ -659,11 +653,7 @@ ivas_error ivas_mc_dec_config( { if ( st_ivas->hDecoderConfig->last_ivas_total_brate != st_ivas->hDecoderConfig->ivas_total_brate || st_ivas->transport_config != signaled_config || last_mc_mode != st_ivas->mc_mode ) { -#ifdef JBM_TSM_ON_TCS ivas_mc_dec_reconfig( st_ivas, nSamplesRendered, data ); -#else - ivas_mc_dec_reconfig( st_ivas ); -#endif } } @@ -682,11 +672,9 @@ ivas_error ivas_mc_dec_config( static ivas_error ivas_mc_dec_reconfig( Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS , uint16_t *nSamplesRendered, /* o : number of samples flushed from the last frame (JBM) */ int16_t *data /* o : flushed samples (JBM) */ -#endif ) { int16_t nchan_transport_old, nSCE_old, nCPE_old, sba_dirac_stereo_flag_old, nchan_hp20_old; @@ -696,14 +684,12 @@ static ivas_error ivas_mc_dec_reconfig( Decoder_State *st; ivas_error error; MC_MODE mc_mode, last_mc_mode; -#ifdef JBM_TSM_ON_TCS TC_BUFFER_MODE tc_buffer_mode_new; int16_t tc_nchan_tc_new; int16_t tc_nchan_allocate_new; int16_t tc_granularity_new; AUDIO_CONFIG intern_config_old; IVAS_OUTPUT_SETUP hIntSetupOld; -#endif error = IVAS_ERR_OK; @@ -734,12 +720,10 @@ static ivas_error ivas_mc_dec_reconfig( } st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#ifdef JBM_TSM_ON_TCS /* save old IntSetup, might be needed for JBM flushing...*/ intern_config_old = st_ivas->intern_config; hIntSetupOld = st_ivas->hIntSetup; tc_granularity_new = 1; -#endif /* renderer might have changed, reselect */ renderer_type_old = st_ivas->renderer_type; @@ -749,7 +733,6 @@ static ivas_error ivas_mc_dec_reconfig( /* side effect of the renderer selection can be a changed internal config */ ivas_output_init( &( st_ivas->hIntSetup ), st_ivas->intern_config ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDecoderConfig->voip_active ) { /* transfer subframe info from DirAC or ParamMC to central tc buffer */ @@ -788,7 +771,6 @@ static ivas_error ivas_mc_dec_reconfig( } } } -#endif if ( st_ivas->mc_mode == MC_MODE_MCT ) @@ -817,13 +799,11 @@ static ivas_error ivas_mc_dec_reconfig( ivas_masa_dec_close( &( st_ivas->hMasa ) ); ivas_qmetadata_close( &st_ivas->hQMetaData ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDirAC != NULL ) { ivas_dirac_dec_close( &st_ivas->hDirAC ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } -#endif /* init LS conversion if the renderer type asks for it */ if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL ) @@ -902,14 +882,12 @@ static ivas_error ivas_mc_dec_reconfig( ivas_masa_dec_close( &( st_ivas->hMasa ) ); ivas_qmetadata_close( &st_ivas->hQMetaData ); -#ifdef JBM_TSM_ON_TCS if ( st_ivas->hDirAC != NULL ) { ivas_dirac_dec_close( &st_ivas->hDirAC ); vbap_free_data( &( st_ivas->hVBAPdata ) ); } -#endif if ( last_mc_mode == MC_MODE_MCT ) { @@ -1140,9 +1118,7 @@ static ivas_error ivas_mc_dec_reconfig( { ivas_dirac_dec_close( &( st_ivas->hDirAC ) ); -#ifdef JBM_TSM_ON_TCS vbap_free_data( &( st_ivas->hVBAPdata ) ); -#endif } } @@ -1290,7 +1266,6 @@ static ivas_error ivas_mc_dec_reconfig( return error; } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * Reconfigure TC buffer *-----------------------------------------------------------------*/ @@ -1344,7 +1319,6 @@ static ivas_error ivas_mc_dec_reconfig( mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hParamMC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } } -#endif return error; } diff --git a/lib_dec/ivas_objectRenderer_internal.c b/lib_dec/ivas_objectRenderer_internal.c index ba14104ed95239e1cf2b831c48be80c715f70b88..df210f2f8a4e6e37b8c2f8a3a58499370c7e6c97 100644 --- a/lib_dec/ivas_objectRenderer_internal.c +++ b/lib_dec/ivas_objectRenderer_internal.c @@ -66,16 +66,11 @@ ivas_error ivas_td_binaural_open( *---------------------------------------------------------------------*/ ivas_error ivas_td_binaural_renderer( - Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ -#ifdef JBM_TSM_ON_TCS - float *output[], /* i/o: SCE channels / Binaural synthesis */ -#else - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ -#endif + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ const int16_t output_frame /* i : output frame length */ ) { -#ifdef FIX_356_ISM_METADATA_SYNC int16_t ism_md_subframe_update; if ( st_ivas->hDecoderConfig->Opt_delay_comp ) @@ -92,18 +87,9 @@ ivas_error ivas_td_binaural_renderer( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, ism_md_subframe_update, output, output_frame ); -#else - return ivas_td_binaural_renderer_unwrap( - st_ivas->hReverb, - st_ivas->transport_config, - st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, - st_ivas->hIsmMetaData, st_ivas->hDecoderConfig->Opt_Headrotation, ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Quaternions : NULL, - ( st_ivas->hHeadTrackData != NULL ) ? st_ivas->hHeadTrackData->Pos : NULL, output, output_frame ); -#endif } -#ifdef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * ivas_td_binaural_renderer_sf() * @@ -125,7 +111,6 @@ ivas_error ivas_td_binaural_renderer_sf( int16_t ch, slot_size, slots_to_render, output_frame; ivas_error error; -#ifdef FIX_356_ISM_METADATA_SYNC int16_t ism_md_subframe_update_jbm; int16_t c_indx, nS; @@ -139,7 +124,6 @@ ivas_error ivas_td_binaural_renderer_sf( ism_md_subframe_update_jbm = st_ivas->hTcBuffer->nb_subframes - 2; } -#endif for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { p_reverb_signal[ch] = reverb_signal[ch]; @@ -174,7 +158,6 @@ ivas_error ivas_td_binaural_renderer_sf( output_frame = st_ivas->hTcBuffer->subframe_nbslots[subframe_idx] * st_ivas->hTcBuffer->n_samples_granularity; /* Update object position(s) */ -#ifdef FIX_356_ISM_METADATA_SYNC c_indx = 0; for ( nS = 0; nS < st_ivas->nchan_transport; nS++ ) @@ -190,9 +173,6 @@ ivas_error ivas_td_binaural_renderer_sf( { TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, st_ivas->ivas_format, st_ivas->hIsmMetaData ); } -#else - TDREND_Update_object_positions( st_ivas->hBinRendererTd, st_ivas->nchan_transport, LFE_CHANNEL, st_ivas->ivas_format, st_ivas->hIsmMetaData, tc_local ); -#endif /* Update the listener's location/orientation */ TDREND_Update_listener_orientation( st_ivas->hBinRendererTd, st_ivas->hDecoderConfig->Opt_Headrotation, @@ -208,11 +188,7 @@ ivas_error ivas_td_binaural_renderer_sf( } /* Render subframe */ -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( error = TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0, ism_md_subframe_update_jbm ) ) != IVAS_ERR_OK ) -#else - if ( ( error = TDREND_GetMix( st_ivas->hBinRendererTd, output_f_local, output_frame, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -242,4 +218,3 @@ ivas_error ivas_td_binaural_renderer_sf( return IVAS_ERR_OK; } -#endif diff --git a/lib_dec/ivas_out_setup_conversion.c b/lib_dec/ivas_out_setup_conversion.c index 7d14ee5041ad42eb604bd594911bfa2232b7ef0a..153764c98a97457fc5c600c42e30e26d82b04991 100644 --- a/lib_dec/ivas_out_setup_conversion.c +++ b/lib_dec/ivas_out_setup_conversion.c @@ -498,12 +498,8 @@ void ivas_ls_setup_conversion( Decoder_Struct *st_ivas, /* i : IVAS decoder structure */ const int16_t input_chans, /* i : number of input channels to the renderer */ const int16_t output_frame, /* i : frame length */ -#ifdef JBM_TSM_ON_TCS - float *input[], /* i : LS input/output synthesis signal */ - float *output[] /* i/o: LS input/output synthesis signal */ -#else - float output[][L_FRAME48k] /* i/o: LS input/output synthesis signal */ -#endif + float *input[], /* i : LS input/output synthesis signal */ + float *output[] /* i/o: LS input/output synthesis signal */ ) { int16_t chInIdx, chOutIdx, idx; @@ -530,22 +526,14 @@ void ivas_ls_setup_conversion( { for ( idx = 0; idx < output_frame; idx++ ) { -#ifdef JBM_TSM_ON_TCS output_tmp[chOutIdx][idx] += input[chInIdx][idx]; -#else - output_tmp[chOutIdx][idx] += output[chInIdx][idx]; -#endif } } else { for ( idx = 0; idx < output_frame; idx++ ) { -#ifdef JBM_TSM_ON_TCS tmpVal = dmxCoeff * input[chInIdx][idx]; -#else - tmpVal = dmxCoeff * output[chInIdx][idx]; -#endif output_tmp[chOutIdx][idx] += tmpVal; } } @@ -1144,9 +1132,7 @@ void ivas_ls_setup_conversion_process_mdct_param_mc( void ivas_lssetupconversion_process_param_mc( Decoder_Struct *st_ivas, /* i/o: LS setup conversion renderer handle */ -#ifdef JBM_TSM_ON_TCS const int16_t num_timeslots, -#endif float Cldfb_RealBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ float Cldfb_ImagBuffer_InOut[MAX_CICP_CHANNELS][PARAM_MC_MAX_NSLOTS_IN_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i/o: LS signals */ int16_t channel_active[MAX_CICP_CHANNELS] /* i : bitmap indicating which output channels are active */ @@ -1173,12 +1159,8 @@ void ivas_lssetupconversion_process_param_mc( set_s( channel_active, 0, outChannels ); -/* Loop over each time slots and compute dmx for each time slot */ -#ifdef JBM_TSM_ON_TCS + /* Loop over each time slots and compute dmx for each time slot */ for ( slotIdx = 0; slotIdx < num_timeslots; slotIdx++ ) -#else - for ( slotIdx = 0; slotIdx < st_ivas->hParamMC->subframe_nbslots; slotIdx++ ) -#endif { /* copy buffers */ for ( chInIdx = 0; chInIdx < inChannels; chInIdx++ ) diff --git a/lib_dec/ivas_output_config.c b/lib_dec/ivas_output_config.c index 52891aaf8783761909311291609cf8fceb7b9c04..aec03b506b67e1127c05a49f25f5ef0c2caccdc1 100644 --- a/lib_dec/ivas_output_config.c +++ b/lib_dec/ivas_output_config.c @@ -316,13 +316,8 @@ void ivas_renderer_select( else if ( st_ivas->ivas_format == MASA_FORMAT || st_ivas->ivas_format == SBA_FORMAT ) { *renderer_type = RENDERER_DIRAC; -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT && ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM && output_config != AUDIO_CONFIG_MONO && output_config != AUDIO_CONFIG_STEREO ) ) -#else - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && - ( output_config != AUDIO_CONFIG_5_1 && output_config != AUDIO_CONFIG_5_1_2 && output_config != AUDIO_CONFIG_5_1_4 && output_config != AUDIO_CONFIG_7_1 && output_config != AUDIO_CONFIG_7_1_4 && output_config != AUDIO_CONFIG_LS_CUSTOM && output_config != AUDIO_CONFIG_MONO && output_config != AUDIO_CONFIG_STEREO ) ) -#endif { if ( output_config == AUDIO_CONFIG_HOA2 || output_config == AUDIO_CONFIG_FOA ) { diff --git a/lib_dec/ivas_qmetadata_dec.c b/lib_dec/ivas_qmetadata_dec.c index cfd748afde8b0959e535b91ced447c6f87a2c65c..d3ecf47b5288c32494d9d1a1943c51d903bc951c 100644 --- a/lib_dec/ivas_qmetadata_dec.c +++ b/lib_dec/ivas_qmetadata_dec.c @@ -49,19 +49,9 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness( uint16_t *bitstream, i static int16_t ivas_qmetadata_entropy_decode_df_ratio( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction, int16_t *dfRatio_bits ); -static int16_t ivas_qmetadata_entropy_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band -#ifdef HR_METADATA - , - const int16_t hrmasa_flag -#endif -); +static int16_t ivas_qmetadata_entropy_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t hrmasa_flag ); -static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const int16_t nbands, const int16_t start_band -#ifdef HR_METADATA - , - const int16_t hrmasa_flag -#endif -); +static int16_t ivas_qmetadata_raw_decode_dir( IVAS_QDIRECTION *q_direction, uint16_t *bitstream, int16_t *index, const int16_t nbands, const int16_t start_band, const int16_t hrmasa_flag ); static uint16_t ivas_qmetadata_DecodeQuasiUniform( const uint16_t *bitstream, int16_t *index, const uint16_t alphabet_size ); @@ -87,21 +77,11 @@ static int16_t read_truncGR_azimuth( uint16_t *bitstream, IVAS_QDIRECTION *q_dir static ivas_error read_huf( int16_t *num_bits_read, const uint16_t *bitstream, uint16_t *out, const int16_t start_pos, const int16_t len, const int16_t *huff_code, const int16_t max_len ); -static int16_t read_coherence_data( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir -#ifdef HR_METADATA - , - const int16_t hrmasa_flag -#endif -); +static int16_t read_coherence_data( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir, const int16_t hrmasa_flag ); static int16_t read_surround_coherence( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData ); -static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, int16_t idx_d, const int16_t no_frames -#ifdef HR_METADATA - , - const int16_t hrmasa_flag -#endif -); +static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, int16_t idx_d, const int16_t no_frames, const int16_t hrmasa_flag ); static void decode_combined_index( uint64_t comb_index, const int16_t *no_cv_vec, uint16_t *index, const int16_t len ); @@ -111,7 +91,6 @@ static int16_t read_GR_min_removed_data( uint16_t *bitstream, int16_t *p_bit_pos static int16_t decode_fixed_rate_composed_index_coherence( uint16_t *bitstream, int16_t *p_bit_pos, const int16_t no_bands, int16_t *no_cv_vec, uint16_t *decoded_index, const int16_t no_symb ); -#ifdef HR_METADATA static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr_512( uint16_t *bitstream, int16_t *index, IVAS_QDIRECTION *q_direction ); @@ -121,7 +100,6 @@ static int16_t ivas_qmetadata_raw_decode_dir_512( IVAS_QDIRECTION *q_direction, static int16_t read_surround_coherence_hr( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData ); static int16_t read_coherence_data_hr_512( uint16_t *bitstream, int16_t *p_bit_pos, IVAS_QMETADATA *hQMetaData, const int16_t idx_dir, const int16_t nbits_coh ); -#endif /*-----------------------------------------------------------------------* @@ -462,12 +440,8 @@ int16_t ivas_qmetadata_dec_decode( if ( all_coherence_zero == 0 ) { - bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d -#ifdef HR_METADATA - , - 0 -#endif - ); + bits_coherence = read_coherence_data( bitstream, index, hQMetaData, d, + 0 ); } else { @@ -515,21 +489,13 @@ int16_t ivas_qmetadata_dec_decode( if ( raw_flag[0] == 0 ) { - bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band -#ifdef HR_METADATA - , - 0 -#endif - ); + bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, nbands, start_band, + 0 ); } else { - bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band -#ifdef HR_METADATA - , - 0 -#endif - ); + bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, nbands, start_band, + 0 ); } } /* Decode quantized directions band-wise */ @@ -549,12 +515,8 @@ int16_t ivas_qmetadata_dec_decode( { if ( raw_flag[b] == 0 ) { - bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b -#ifdef HR_METADATA - , - 0 -#endif - ); + bits_dir += ivas_qmetadata_entropy_decode_dir( q_direction, bitstream, index, diffuseness_index_max_ec_frame, b + 1, b, + 0 ); } else { @@ -598,12 +560,8 @@ int16_t ivas_qmetadata_dec_decode( { if ( raw_flag[b] ) { - bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b -#ifdef HR_METADATA - , - 0 -#endif - ); + bits_dir += ivas_qmetadata_raw_decode_dir( q_direction, bitstream, index, b + 1, b, + 0 ); } } } @@ -637,12 +595,8 @@ int16_t ivas_qmetadata_dec_decode( { if ( nblocks > 1 ) { - decode_spread_coherence( hQMetaData, d, nblocks -#ifdef HR_METADATA - , - 0 -#endif - ); + decode_spread_coherence( hQMetaData, d, nblocks, + 0 ); } } else @@ -783,7 +737,6 @@ int16_t ivas_qmetadata_dec_decode( } -#ifdef HR_METADATA /*-----------------------------------------------------------------------* * ivas_qmetadata_dec_decode_hr_384_512() * @@ -797,37 +750,23 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( int16_t *index, /* i/o: bitstream position */ const SPHERICAL_GRID_DATA *sph_grid16, /* i : spherical grid for deindexing */ const int16_t bits_sph_idx, - const int16_t bits_sp_coh -#ifdef FIX_HBR_MASAMETA - , - uint8_t ncoding_bands_config -#endif -) + const int16_t bits_sp_coh, + uint8_t ncoding_bands_config ) { int16_t d, b, m; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA int16_t bits_diff_sum; -#endif -#else - int16_t bits_diff_sum; #endif int16_t nbands, start_band; IVAS_QDIRECTION *q_direction; int16_t start_index_0; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA int16_t bits_no_dirs_coh, bits_sur_coherence; -#endif -#else - int16_t bits_no_dirs_coh, bits_sur_coherence; #endif uint16_t all_coherence_zero; int16_t p[MASA_MAXIMUM_CODING_SUBBANDS], dif_p[MASA_MAXIMUM_CODING_SUBBANDS]; -#ifdef FIX_HBR_MASAMETA int16_t codedBands, sf_nbands0, sf_nbands1; sf_nbands1 = 1; -#endif #ifdef DEBUG_MODE_QMETADATA static FILE *pF = NULL; @@ -852,7 +791,6 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( #endif start_index_0 = *index; -#ifdef FIX_HBR_MASAMETA /* read number of higher inactive/not encoded bands */ if ( bitstream[( *index )--] ) { @@ -902,26 +840,17 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->q_direction[0].cfg.nbands = codedBands; -#endif /*Coherence flag decoding*/ -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh = 0; -#endif -#else - bits_no_dirs_coh = 0; #endif all_coherence_zero = 1; if ( hQMetaData->coherence_flag ) { /* read if coherence is zero */ all_coherence_zero = bitstream[( *index )--]; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += 1; -#endif -#else - bits_no_dirs_coh += 1; #endif } @@ -936,38 +865,27 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( { /* Read which bands have 2 directions */ hQMetaData->q_direction[1].cfg.nbands = hQMetaData->numTwoDirBands; -#ifdef FIX_HBR_MASAMETA sf_nbands1 = hQMetaData->q_direction[1].cfg.nbands; if ( hQMetaData->q_direction[1].cfg.nbands > codedBands ) { hQMetaData->q_direction[1].cfg.nbands = codedBands; } -#endif set_c( (int8_t *) hQMetaData->twoDirBands, 0, hQMetaData->q_direction[0].cfg.nbands ); d = *index; dif_p[0] = ivas_qmetadata_DecodeExtendedGR( bitstream, index, MASA_MAXIMUM_CODING_SUBBANDS, 0 ); p[0] = dif_p[0]; hQMetaData->twoDirBands[p[0]] = 1; -#ifdef FIX_HBR_MASAMETA for ( b = 1; b < hQMetaData->q_direction[1].cfg.nbands; b++ ) -#else - for ( b = 1; b < hQMetaData->numTwoDirBands; b++ ) -#endif { dif_p[b] = ivas_qmetadata_DecodeExtendedGR( bitstream, index, MASA_MAXIMUM_CODING_SUBBANDS, 0 ); p[b] = p[b - 1] + dif_p[b] + 1; hQMetaData->twoDirBands[p[b]] = 1; } -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += ( d - *index ); -#endif -#else - bits_no_dirs_coh += ( d - *index ); #endif } -#ifdef FIX_HBR_MASAMETA if ( bits_sph_idx == 16 && hQMetaData->no_directions == 2 ) { sf_nbands1 = hQMetaData->q_direction[1].cfg.nbands; @@ -976,24 +894,15 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->q_direction[1].cfg.nbands = codedBands; } } -#endif -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_diff_sum = -#endif -#else - bits_diff_sum = #endif ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[0] ) ); if ( hQMetaData->no_directions == 2 ) { -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_diff_sum += -#endif -#else - bits_diff_sum += #endif ivas_qmetadata_entropy_decode_diffuseness_hr_512( bitstream, index, &( hQMetaData->q_direction[1] ) ); } @@ -1044,23 +953,15 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( if ( all_coherence_zero == 0 ) { -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_sur_coherence = -#endif -#else - bits_sur_coherence = #endif read_surround_coherence_hr( bitstream, index, hQMetaData ); } else { -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_sur_coherence = 0; -#endif -#else - bits_sur_coherence = 0; #endif /*Surround coherence*/ for ( b = 0; b < hQMetaData->q_direction[0].cfg.nbands; b++ ) @@ -1071,13 +972,9 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( } } } -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += bits_sur_coherence; #endif -#else - bits_no_dirs_coh += bits_sur_coherence; -#endif for ( d = 0; d < hQMetaData->no_directions; d++ ) { @@ -1237,19 +1134,15 @@ int16_t ivas_qmetadata_dec_decode_hr_384_512( hQMetaData->dir_comp_ratio = 1.0f; } -#ifdef FIX_HBR_MASAMETA hQMetaData->q_direction[0].cfg.nbands = sf_nbands0; if ( hQMetaData->no_directions == 2 ) { hQMetaData->q_direction[1].cfg.nbands = sf_nbands1; } -#endif return ( start_index_0 - *index ); } -#endif - /*-----------------------------------------------------------------------* * ivas_qmetadata_dec_sid_decode() @@ -1265,10 +1158,6 @@ int16_t ivas_qmetadata_dec_sid_decode( const int16_t nchan_transport, /* i : number of transport channels */ int16_t *element_mode, /* o : element mode */ const int16_t ivas_format /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ) { int16_t b, m, i; @@ -1299,21 +1188,8 @@ int16_t ivas_qmetadata_dec_sid_decode( if ( ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif - /* 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*/ -#ifndef SBA_MODE_CLEAN_UP - } - else - { - /* keep 13.2 and 16.4 sid bitrate as 4.4 kbps for now*/ - /* 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; - } -#endif + /* 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 { @@ -1339,11 +1215,7 @@ int16_t ivas_qmetadata_dec_sid_decode( /* Fix configuration for SID */ q_direction = &hQMetaData->q_direction[0]; /* only 1 direction */ -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { nbands = DIRAC_DTX_BANDS; /* only 2 bands transmitted */ } @@ -1356,11 +1228,7 @@ int16_t ivas_qmetadata_dec_sid_decode( start_band = 0; /* start from band 0 */ /* Read 2D signaling*/ -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode != SBA_MODE_SPAR ) -#else if ( ivas_format != SBA_FORMAT ) -#endif { q_direction->not_in_2D = bitstream[( *index )--]; } @@ -1445,18 +1313,7 @@ int16_t ivas_qmetadata_dec_sid_decode( } } /* TODO: temporary hack to keep BE */ -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_format == SBA_FORMAT ) - { - if ( sba_mode != SBA_MODE_SPAR ) - { - metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - 1; /* -1 for spar/dirac indicator*/ - } - } - else -#else if ( ivas_format != SBA_FORMAT ) -#endif { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } @@ -1637,7 +1494,6 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * ivas_qmetadata_entropy_decode_diffuseness_hr() * @@ -1764,7 +1620,6 @@ static int16_t ivas_qmetadata_entropy_decode_diffuseness_hr_512( return ( index_start - *index ); } -#endif /*-------------------------------------------------------------------* @@ -1898,11 +1753,8 @@ static int16_t ivas_qmetadata_entropy_decode_dir( int16_t *index, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, - const int16_t start_band -#ifdef HR_METADATA - , + const int16_t start_band, const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t b, m; @@ -1930,18 +1782,14 @@ static int16_t ivas_qmetadata_entropy_decode_dir( /*Raw coding for high diffuseness*/ for ( b = start_band; b < nbands; b++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif diff_idx_min = min( diff_idx_min, diff_idx ); if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) @@ -1953,11 +1801,7 @@ static int16_t ivas_qmetadata_entropy_decode_dir( elev_alph[b] = no_theta_masa[bits_direction_masa[diff_idx] - 3] * 2 - 1; } -#ifdef HR_METADATA if ( q_direction->band_data[b].energy_ratio_index_mod[0] > diffuseness_index_max_ec_frame ) -#else - if ( diff_idx > diffuseness_index_max_ec_frame ) -#endif { bands_entropic[b] = 0; @@ -2010,18 +1854,14 @@ static int16_t ivas_qmetadata_entropy_decode_dir( if ( bands_entropic[b] ) { int16_t tmp_index; -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { @@ -2071,18 +1911,14 @@ static int16_t ivas_qmetadata_entropy_decode_dir( { if ( bands_entropic[b] ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif for ( m = 0; m < nblocks; m++ ) { @@ -2141,18 +1977,14 @@ static int16_t ivas_qmetadata_entropy_decode_dir( { if ( bands_entropic[b] ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif for ( m = 0; m < nblocks; m++ ) { @@ -2273,7 +2105,6 @@ static int16_t ivas_qmetadata_entropy_decode_dir( } -#ifdef HR_METADATA /*------------------------------------------------------------------------- * ivas_qmetadata_raw_decode_dir() * @@ -2324,7 +2155,6 @@ static int16_t ivas_qmetadata_raw_decode_dir_512( return ( index_start - *index ); } -#endif /*------------------------------------------------------------------------- * ivas_qmetadata_raw_decode_dir() @@ -2337,11 +2167,8 @@ static int16_t ivas_qmetadata_raw_decode_dir( uint16_t *bitstream, /* i : bitstream */ int16_t *index, const int16_t nbands, - const int16_t start_band -#ifdef HR_METADATA - , + const int16_t start_band, const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t b, m, azith_alph; @@ -2360,18 +2187,14 @@ static int16_t ivas_qmetadata_raw_decode_dir( } else { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx = 0; } else { -#endif diff_idx = q_direction->band_data[b].energy_ratio_index_mod[0]; -#ifdef HR_METADATA } -#endif for ( m = 0; m < nblocks; m++ ) { @@ -3413,10 +3236,8 @@ static void decode_spread_coherence( IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: quantized metadata structure */ int16_t idx_d, /* i : direction index */ const int16_t no_frames /* i : number of time subframes */ -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t i, j; @@ -3426,9 +3247,7 @@ static void decode_spread_coherence( int16_t MASA_grouping[MASA_MAXIMUM_CODING_SUBBANDS]; IVAS_QDIRECTION *q_direction; int16_t coding_subbands, coding_subbands_0, d, two_dir_band[MASA_MAXIMUM_CODING_SUBBANDS]; -#ifdef HR_METADATA int16_t min_index; -#endif coding_subbands_0 = hQMetaData->q_direction[0].cfg.nbands; coding_subbands = hQMetaData->q_direction[idx_d].cfg.nbands; @@ -3485,7 +3304,6 @@ static void decode_spread_coherence( { var_azi = var( q_direction->band_data[i].azimuth, no_frames ); -#ifdef HR_METADATA if ( hrmasa_flag ) { minimum_s( (int16_t *) ( q_direction->band_data[i].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); @@ -3504,16 +3322,6 @@ static void decode_spread_coherence( { idx_sub_cb = MASA_NO_CV_COH * ( min_index + DIRAC_DIFFUSE_LEVELS ); /* NO_CV_COH = 8 */ } -#else - if ( var_azi < MASA_DELTA_AZI_DCT0 ) - { - idx_sub_cb = MASA_NO_CV_COH * q_direction->band_data[i].energy_ratio_index[0]; - } - else - { - idx_sub_cb = MASA_NO_CV_COH * ( q_direction->band_data[i].energy_ratio_index[0] + DIRAC_DIFFUSE_LEVELS ); /* NO_CV_COH = 8 */ - } -#endif dct_coh[i][0] = coherence_cb0_masa[idx_sub_cb + q_direction->coherence_band_data[i].spread_coherence_dct0_index]; @@ -3774,7 +3582,6 @@ static int16_t decode_fixed_rate_composed_index_coherence( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * read_coherence_data_hr_512() * @@ -3852,7 +3659,6 @@ static int16_t read_coherence_data_hr_512( nbits = nbits - *p_bit_pos; return nbits; } -#endif /*------------------------------------------------------------------- * @@ -3867,10 +3673,8 @@ static int16_t read_coherence_data( int16_t *p_bit_pos, /* i : position in the bitstream */ IVAS_QMETADATA *hQMetaData, /* i/o: quantized metadata structure */ const int16_t idx_dir /* i : direction index */ -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t j; @@ -3888,9 +3692,7 @@ static int16_t read_coherence_data( int16_t decoded_idx[MASA_MAXIMUM_CODING_SUBBANDS]; uint16_t byteBuffer; int16_t idx_ER; -#ifdef HR_METADATA int16_t min_index; -#endif coding_subbands = hQMetaData->q_direction[idx_dir].cfg.nbands; @@ -3902,7 +3704,6 @@ static int16_t read_coherence_data( { for ( j = 0; j < coding_subbands; j++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + coding_subbands / MASA_FACTOR_CV_COH; @@ -3910,11 +3711,8 @@ static int16_t read_coherence_data( else { -#endif idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH; -#ifdef HR_METADATA } -#endif no_cv_vec[j] = idx_ER + 1; } @@ -3938,11 +3736,7 @@ static int16_t read_coherence_data( { if ( no_cv_vec[j] > 1 ) { -#ifdef HR_METADATA q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_idx[j] * ( 255.0f / (float) ( 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> ( hrmasa_flag ) ) + coding_subbands / MASA_FACTOR_CV_COH ) ) ); -#else - q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_idx[j] * ( 255.0f / (float) ( 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH ) ) ); -#endif } else { @@ -3959,11 +3753,7 @@ static int16_t read_coherence_data( { if ( no_cv_vec[j] > 1 ) { -#ifdef HR_METADATA q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_index[j] * ( 255.0f / (float) ( 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> ( hrmasa_flag ) ) + coding_subbands / MASA_FACTOR_CV_COH ) ) ); -#else - q_direction->coherence_band_data[j].spread_coherence[0] = (uint8_t) roundf( decoded_index[j] * ( 255.0f / (float) ( 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + coding_subbands / MASA_FACTOR_CV_COH ) ) ); -#endif } else { @@ -3976,7 +3766,6 @@ static int16_t read_coherence_data( { for ( j = 0; j < coding_subbands; j++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); @@ -3984,11 +3773,8 @@ static int16_t read_coherence_data( } else { -#endif no_cv_vec[j] = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; /* spread coherence DCT0*/ -#ifdef HR_METADATA } -#endif } if ( sum_s( no_cv_vec, coding_subbands ) > MASA_COH_LIMIT_2IDX ) @@ -4274,7 +4060,6 @@ static int16_t read_surround_coherence( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * read_surround_coherence_hr() * @@ -4434,7 +4219,6 @@ static int16_t read_surround_coherence_hr( return bits_sur_coherence; } -#endif /*-------------------------------------------------------------------* * decode_combined_index() diff --git a/lib_dec/ivas_sba_dec.c b/lib_dec/ivas_sba_dec.c index 478749ddc09ad76efd5c1417bcda8a0ff86ff0f9..6b8576a95f3c8c9cf76cb8acfa942a8307c6c183 100755 --- a/lib_dec/ivas_sba_dec.c +++ b/lib_dec/ivas_sba_dec.c @@ -59,11 +59,7 @@ void ivas_sba_set_cna_cng_flag( { int16_t n, cpe_id; -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->nchan_transport == 1 ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->nchan_transport == 1 ) -#endif { /* skip as done in init function */ /* st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag = 0; */ @@ -139,7 +135,6 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->sba_order ); -#ifdef JBM_TSM_ON_TCS /* save old */ if ( st_ivas->hDirAC == NULL && st_ivas->hSpar != NULL ) { @@ -157,7 +152,6 @@ ivas_error ivas_sba_dec_reconfigure( st_ivas->hTcBuffer->subframes_rendered = st_ivas->hDirAC->subframes_rendered; mvs2s( st_ivas->hDirAC->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); } -#endif /*-----------------------------------------------------------------* * Allocate, initialize, and configure SBA handles @@ -200,14 +194,12 @@ ivas_error ivas_sba_dec_reconfigure( hSpar = st_ivas->hSpar; st_ivas->sba_dirac_stereo_flag = ivas_get_sba_dirac_stereo_flag( st_ivas ); -#ifdef JBM_TSM_ON_TCS /* synchronize subframe info */ st_ivas->hSpar->num_slots = st_ivas->hTcBuffer->num_slots; st_ivas->hSpar->nb_subframes = st_ivas->hTcBuffer->nb_subframes; st_ivas->hSpar->slots_rendered = st_ivas->hTcBuffer->slots_rendered; st_ivas->hSpar->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hSpar->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#endif if ( st_ivas->nchan_transport == 1 ) { @@ -288,29 +280,19 @@ ivas_error ivas_sba_dec_reconfigure( return error; } -#ifdef JBM_TSM_ON_TCS /* synchronize subframe info */ st_ivas->hDirAC->num_slots = st_ivas->hTcBuffer->num_slots; st_ivas->hDirAC->nb_subframes = st_ivas->hTcBuffer->nb_subframes; st_ivas->hDirAC->slots_rendered = st_ivas->hTcBuffer->slots_rendered; st_ivas->hDirAC->subframes_rendered = st_ivas->hTcBuffer->subframes_rendered; mvs2s( st_ivas->hTcBuffer->subframe_nbslots, st_ivas->hDirAC->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS ); -#endif } if ( ( error = ivas_dirac_sba_config( st_ivas->hQMetaData, -#ifndef SBA_MODE_CLEAN_UP - &st_ivas->nchan_transport, - &st_ivas->nSCE, - &st_ivas->nCPE, -#endif &st_ivas->element_mode_init, ivas_total_brate, st_ivas->sba_analysis_order, -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode, -#endif ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ) ? IVAS_MAX_NUM_BANDS : ( IVAS_MAX_NUM_BANDS - SPAR_DIRAC_SPLIT_START_BAND ) ) ) != IVAS_ERR_OK ) @@ -327,9 +309,6 @@ ivas_error ivas_sba_dec_reconfigure( if ( st_ivas->hDirAC != NULL ) { -#ifndef SBA_MODE_CLEAN_UP - mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); -#endif st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; } @@ -372,7 +351,6 @@ ivas_error ivas_sba_dec_reconfigure( return error; } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * JBM TC buffer *-----------------------------------------------------------------*/ @@ -396,11 +374,7 @@ ivas_error ivas_sba_dec_reconfigure( { tc_nchan_to_allocate = 2 * BINAURAL_CHANNELS; } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { tc_nchan_to_allocate = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); @@ -421,12 +395,10 @@ ivas_error ivas_sba_dec_reconfigure( } } } -#endif return error; } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_sba_dec_digest_tc() * @@ -446,20 +418,12 @@ ivas_error ivas_sba_dec_digest_tc( error = IVAS_ERR_OK; /* set the md map */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hDirAC && !( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC && st_ivas->sba_mode == SBA_MODE_DIRAC ) ) -#else if ( st_ivas->hDirAC ) -#endif { ivas_dirac_dec_set_md_map( st_ivas, nCldfbSlots ); } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { ivas_spar_dec_digest_tc( st_ivas, st_ivas->nchan_transport, nCldfbSlots, nSamplesForRendering ); } @@ -482,14 +446,10 @@ ivas_error ivas_sba_dec_digest_tc( while ( nSamplesLeftForTD ) { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( st_ivas->hDiracDecBin->hTdDecorr ) { -#endif ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_tc, decorr_signal, nSamplesToDecorr ); -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif for ( ch_idx = 0; ch_idx < BINAURAL_CHANNELS; ch_idx++ ) { decorr_signal[ch_idx] += nSamplesToDecorr; @@ -500,11 +460,7 @@ ivas_error ivas_sba_dec_digest_tc( } /* if we have a late CNG generation, do it here */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->nchan_transport == 1 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->ivas_format == SBA_FORMAT ) -#endif { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[1], nCldfbSlots, st->cna_dirac_flag && st->flag_cna ); @@ -597,4 +553,3 @@ void ivas_sba_dec_render( return; } -#endif diff --git a/lib_dec/ivas_sba_dirac_stereo_dec.c b/lib_dec/ivas_sba_dirac_stereo_dec.c index 13f1401f8e589be0b01f9d165b238261a56bd043..aca7ce78f96c8d5451707271caac593edb25f851 100644 --- a/lib_dec/ivas_sba_dirac_stereo_dec.c +++ b/lib_dec/ivas_sba_dirac_stereo_dec.c @@ -63,11 +63,7 @@ int16_t ivas_get_sba_dirac_stereo_flag( if ( st_ivas->ivas_format == SBA_FORMAT || ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA ) ) { -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#endif { if ( output_config == AUDIO_CONFIG_STEREO || ( output_config == AUDIO_CONFIG_MONO && st_ivas->nchan_transport == 1 ) ) { @@ -697,10 +693,8 @@ void ivas_sba_dirac_stereo_smooth_parameters( ivas_spar_md_dec_state_t *hMdDec, /* i/o: SPAR MD handle for upmixing */ const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs /* i : Fs for delay calculation */ -#ifdef FIX_STEREO_474 , const int16_t num_md_sub_frames /* i : number of subframes in mixing matrix */ -#endif ) { int16_t i, j, k, i_sf; @@ -740,9 +734,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( float xfade_start_ns; int16_t xfade_delay_subframes; int16_t i_hist; -#ifdef FIX_STEREO_474 int16_t md_sf; -#endif xfade_start_ns = cross_fade_start_offset / (float) output_Fs * 1000000000.f - IVAS_FB_ENC_DELAY_NS; xfade_delay_subframes = (int16_t) ( xfade_start_ns / ( FRAME_SIZE_NS / MAX_PARAM_SPATIAL_SUBFRAMES ) ); @@ -754,9 +746,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( for ( i_sf = k * 2; i_sf < ( k + 1 ) * 2; i_sf++ ) { -#ifdef FIX_STEREO_474 md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? i_sf : 0; -#endif if ( hStereoDft->first_frame ) { @@ -802,11 +792,7 @@ void ivas_sba_dirac_stereo_smooth_parameters( { for ( b = 0; b < hStereoDft->nbands; b++ ) { -#ifdef FIX_STEREO_474 hMdDec->mixer_mat_prev[4][i][j][b] = hMdDec->mixer_mat[i][j][b + md_sf * IVAS_MAX_NUM_BANDS]; -#else - hMdDec->mixer_mat_prev[4][i][j][b] = hMdDec->mixer_mat[i][j][b + i_sf * IVAS_MAX_NUM_BANDS]; -#endif } } } @@ -864,12 +850,7 @@ void ivas_sba_dirac_stereo_dec( memOffset = NS2SA( output_frame * FRAMES_PER_SEC, IVAS_DEC_DELAY_NS - DELAY_BWE_TOTAL_NS ); ivas_sba_dirac_stereo_config( hStereoDft->hConfig ); -#ifdef SBA_MODE_CLEAN_UP hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT, ( st_ivas->ivas_format == SBA_FORMAT && !mcmasa ) ); -#else - hStereoDft->nbands = ivas_sba_dirac_stereo_band_config( hStereoDft->band_limits, st_ivas->hDecoderConfig->output_Fs, hStereoDft->NFFT, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); - -#endif stereo_dft_dec_update( hStereoDft, output_frame, 1 /*st_ivas->sba_dirac_stereo_flag*/ ); if ( st_ivas->nchan_transport > 1 ) { @@ -891,22 +872,11 @@ void ivas_sba_dirac_stereo_dec( } /* mapping of DirAC parameters (azimuth, elevation, diffuseness) to DFT Stereo parameters (side gain, prediction gain) */ -#ifdef SBA_MODE_CLEAN_UP map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], st_ivas->ivas_format == MC_FORMAT, ( st_ivas->ivas_format != SBA_FORMAT || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame, ( st_ivas->ivas_format != SBA_FORMAT || mcmasa ) ); -#else - map_params_dirac_to_stereo( hStereoDft, st_ivas->hQMetaData, tmp_synth, DFT[0], - st_ivas->ivas_format == MC_FORMAT, - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ? hSCE->hCoreCoder[0]->L_frame : output_frame, - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ) ); -#endif -#ifdef SBA_MODE_CLEAN_UP if ( st_ivas->ivas_format == SBA_FORMAT && !mcmasa ) -#else - if ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) -#endif { set_f( hStereoDft->res_pred_gain, 1.f, 3 * STEREO_DFT_BAND_MAX ); } @@ -915,12 +885,8 @@ void ivas_sba_dirac_stereo_dec( stereo_dft_dec( hStereoDft, hCPE->hCoreCoder[0], DFT, NULL, NULL, 1 /*st_ivas->sba_dirac_stereo_flag*/, sba_mono_flag, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hMdDec : NULL, ( st_ivas->hSpar != NULL && !mcmasa ) ? st_ivas->hSpar->hFbMixer->cross_fade_start_offset : 0, - st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport -#ifdef FIX_STEREO_474 - , - ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) -#endif - ); + st_ivas->hDecoderConfig->output_Fs, st_ivas->nchan_transport, + ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, st_ivas->hDecoderConfig->ivas_total_brate ) ); /* DFT synthesis */ stereo_dft_dec_synthesize( hCPE, DFT, 0, output[0], output_frame ); @@ -952,13 +918,8 @@ void ivas_sba_dirac_stereo_dec( /* upmix ACELP BWE */ ivas_sba_dirac_stereo_compute_hb_gain( hStereoDft, hb_gain ); -#ifdef SBA_MODE_CLEAN_UP ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, ( st_ivas->ivas_format != SBA_FORMAT || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft ); -#else - ivas_sba_dirac_stereo_upmix_hb( hb_synth_stereo, hSCE->save_hb_synth, hb_gain, output_frame, - ( st_ivas->sba_mode != SBA_MODE_SPAR || mcmasa ), sba_mono_flag, hSCE->hCoreCoder[0]->bwidth, hStereoDft ); -#endif /* add HB to ACELP core */ v_add( output[0], hb_synth_stereo[0], output[0], output_frame ); @@ -967,12 +928,7 @@ void ivas_sba_dirac_stereo_dec( v_add( output[1], hb_synth_stereo[1], output[1], output_frame ); /* apply TD Stereo Filling as is done in ICBWE */ -#ifdef SBA_MODE_CLEAN_UP ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, ( st_ivas->ivas_format == SBA_FORMAT && !mcmasa ) ); -#else - ivas_sba_dirac_stereo_apply_td_stefi( hStereoDft, output, output_frame, ( st_ivas->sba_mode == SBA_MODE_SPAR && !mcmasa ) ); - -#endif } } diff --git a/lib_dec/ivas_sba_rendering_internal.c b/lib_dec/ivas_sba_rendering_internal.c index dd4af01ccf68b1fa14298f6f54e60e8f1491c2f8..17d231a6d3bcd8ad6ee6898664762720c93a5819 100644 --- a/lib_dec/ivas_sba_rendering_internal.c +++ b/lib_dec/ivas_sba_rendering_internal.c @@ -65,10 +65,8 @@ void ivas_sba2mc_cldfb( float ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: cldfb imag part */ const int16_t nb_channels_out, /* i : nb of output channels */ const int16_t nb_bands, /* i : nb of CLDFB bands to process */ -#ifdef JBM_TSM_ON_TCS - const int16_t nb_timeslots, /* i : number of time slots to process */ -#endif - const float *hoa_dec_mtx /* i : HOA decoding mtx */ + const int16_t nb_timeslots, /* i : number of time slots to process */ + const float *hoa_dec_mtx /* i : HOA decoding mtx */ ) { int16_t iBlock, iBand, n, m; @@ -93,11 +91,7 @@ void ivas_sba2mc_cldfb( p_realOut = realOut[n]; p_imagOut = imagOut[n]; -#ifdef JBM_TSM_ON_TCS for ( iBlock = 0; iBlock < nb_timeslots; iBlock++ ) -#else - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) -#endif { p_real = RealBuffer[m][iBlock]; p_imag = ImagBuffer[m][iBlock]; @@ -117,11 +111,7 @@ void ivas_sba2mc_cldfb( p_realOut = realOut[n]; p_imagOut = imagOut[n]; -#ifdef JBM_TSM_ON_TCS for ( iBlock = 0; iBlock < nb_timeslots; iBlock++ ) -#else - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) -#endif { p_real = RealBuffer[n][iBlock]; p_imag = ImagBuffer[n][iBlock]; @@ -147,15 +137,11 @@ void ivas_sba2mc_cldfb( void ivas_mc2sba( IVAS_OUTPUT_SETUP hIntSetup, /* i : Format of decoder output */ -#ifdef JBM_TSM_ON_TCS - float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ - float *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ -#else - float buffer_td[][L_FRAME48k], /* i/o: MC signals (on input) and the HOA3 (on output) */ -#endif - const int16_t output_frame, /* i : output frame length per channel */ - const int16_t sba_order, /* i : Ambisonic (SBA) order */ - const float gain_lfe /* i : gain for LFE, 0 = ignore LFE */ + float *in_buffer_td[], /* i : MC signals (on input) and the HOA3 (on output) */ + float *buffer_td[], /* i/o: MC signals (on input) and the HOA3 (on output) */ + const int16_t output_frame, /* i : output frame length per channel */ + const int16_t sba_order, /* i : Ambisonic (SBA) order */ + const float gain_lfe /* i : gain for LFE, 0 = ignore LFE */ ) { int16_t i, j, k; @@ -186,11 +172,7 @@ void ivas_mc2sba( /* Add LFE to omni W with gain*/ for ( k = 0; k < output_frame; k++ ) { -#ifdef JBM_TSM_ON_TCS buffer_tmp[0][k] += gain_lfe * in_buffer_td[i][k]; -#else - buffer_tmp[0][k] += gain_lfe * buffer_td[i][k]; -#endif } } @@ -216,11 +198,7 @@ void ivas_mc2sba( { for ( k = 0; k < output_frame; k++ ) { -#ifdef JBM_TSM_ON_TCS buffer_tmp[j][k] += gains[j] * in_buffer_td[i][k]; -#else - buffer_tmp[j][k] += gains[j] * buffer_td[i][k]; -#endif } } } @@ -254,21 +232,10 @@ int16_t ivas_sba_remapTCs( #endif nchan_remapped = st_ivas->nchan_transport; -#ifdef SBA_MODE_CLEAN_UP if ( nchan_remapped == 3 ) -#else - if ( ( st_ivas->sba_mode != SBA_MODE_SPAR && st_ivas->sba_planar && nchan_remapped >= 3 ) || - ( ( st_ivas->sba_mode == SBA_MODE_SPAR ) && nchan_remapped == 3 ) ) -#endif { nchan_remapped++; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) - { - assert( ( ( st_ivas->nchan_transport == 3 ) || ( st_ivas->nchan_transport == 5 ) || ( st_ivas->nchan_transport == 7 ) ) && "Number of channels must be odd for SBA planar!" ); - } -#endif if ( nchan_remapped == 4 ) { @@ -295,12 +262,6 @@ int16_t ivas_sba_remapTCs( } } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode != SBA_MODE_SPAR ) - { - ivas_sba_zero_vert_comp( sba_data, st_ivas->sba_analysis_order, st_ivas->sba_planar, output_frame ); - } -#endif return ( nchan_remapped ); } @@ -312,11 +273,7 @@ int16_t ivas_sba_remapTCs( *-------------------------------------------------------------------------*/ void ivas_ism2sba( -#ifdef JBM_TSM_ON_TCS - float *buffer_td[], /* i/o: TD signal buffers */ -#else - float buffer_td[][L_FRAME48k], /* i/o: TD signal buffers */ -#endif + float *buffer_td[], /* i/o: TD signal buffers */ ISM_RENDERER_HANDLE hIsmRendererData, /* i/o: renderer data */ const ISM_METADATA_HANDLE hIsmMetaData[], /* i : object metadata */ const int16_t nchan_ism, /* i : number of objects */ @@ -372,7 +329,6 @@ void ivas_ism2sba( return; } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------------* * ivas_ism2sba() * @@ -424,7 +380,6 @@ void ivas_ism2sba_sf( return; } -#endif /*-------------------------------------------------------------------* * ivas_sba_upmixer_renderer() @@ -439,35 +394,18 @@ void ivas_sba_upmixer_renderer( ) { int16_t nchan_internal; -#ifndef JBM_TSM_ON_TCS - int16_t i; - float temp; -#endif push_wmops( "ivas_sba_upmixer_renderer" ); nchan_internal = ivas_sba_get_nchan_metadata( st_ivas->sba_analysis_order, st_ivas->hDecoderConfig->ivas_total_brate ); -#ifndef JBM_TSM_ON_TCS - if ( st_ivas->nchan_transport >= 3 ) - { - /*convert WYZX downmix to WYXZ*/ - for ( i = 0; i < output_frame; i++ ) - { - temp = output[2][i]; - output[2][i] = output[3][i]; - output[3][i] = temp; - } - } -#endif /* Upmixer + Renderer */ ivas_spar_dec_upmixer( st_ivas, output, nchan_internal, output_frame ); if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_DEC ) { -#ifdef JBM_TSM_ON_TCS float *output_f[MAX_OUTPUT_CHANNELS]; int16_t ch; @@ -477,9 +415,6 @@ void ivas_sba_upmixer_renderer( } ivas_sba_linear_renderer( output_f, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); -#else - ivas_sba_linear_renderer( output, output_frame, st_ivas->hIntSetup.nchan_out_woLFE, st_ivas->hDecoderConfig->output_config, st_ivas->hOutSetup, st_ivas->hoa_dec_mtx ); -#endif } pop_wmops(); @@ -494,11 +429,7 @@ void ivas_sba_upmixer_renderer( *-------------------------------------------------------------------*/ static void ivas_sba_mtx_mult( -#ifdef JBM_TSM_ON_TCS - float *output_f[], /* i/o: synthesized core-corder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-corder transport channels/DirAC output */ -#endif + float *output_f[], /* i/o: synthesized core-corder transport channels/DirAC output */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : Number of ambisonic channels */ const IVAS_OUTPUT_SETUP output_setup, /* i : Output configuration */ @@ -558,11 +489,7 @@ static void ivas_sba_mtx_mult( *-------------------------------------------------------------------*/ ivas_error ivas_sba_linear_renderer( -#ifdef JBM_TSM_ON_TCS - float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ -#else - float output_f[][L_FRAME48k], /* i/o: synthesized core-coder transport channels/DirAC output */ -#endif + float *output_f[], /* i/o: synthesized core-coder transport channels/DirAC output */ const int16_t output_frame, /* i : output frame length per channel */ const int16_t nchan_in, /* i : number of input ambisonics channels */ const AUDIO_CONFIG output_config, /* i : output audio configuration */ diff --git a/lib_dec/ivas_sce_dec.c b/lib_dec/ivas_sce_dec.c index f405f50c04ac0e8fe294fe9a4aee07155d345df2..2ee76d24c529050f90bd8987a6762c462832e76f 100755 --- a/lib_dec/ivas_sce_dec.c +++ b/lib_dec/ivas_sce_dec.c @@ -149,13 +149,8 @@ ivas_error ivas_sce_dec( st->codec_mode = MODE1; /* set "bits_frame_nominal" */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( st_ivas->hQMetaData != NULL ) && - ( st_ivas->sba_mode != SBA_MODE_SPAR ) ) -#else if ( ( st_ivas->hQMetaData != NULL ) && ( st_ivas->ivas_format != SBA_FORMAT ) ) -#endif { if ( st_ivas->mc_mode == MC_MODE_MCMASA && ivas_total_brate >= MCMASA_SEPARATE_BRATE ) { @@ -166,11 +161,7 @@ ivas_error ivas_sce_dec( st->bits_frame_nominal = st_ivas->hQMetaData->bits_frame_nominal; } } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { st->bits_frame_nominal = (int16_t) ( st_ivas->hSpar->core_nominal_brate / FRAMES_PER_SEC ); } diff --git a/lib_dec/ivas_spar_decoder.c b/lib_dec/ivas_spar_decoder.c old mode 100755 new mode 100644 index f3fd5ed04cd67273b17fcfebfaf3113563bb189e..d7b3aba54fbdd892e72f4cd41b34846f24e48386 --- a/lib_dec/ivas_spar_decoder.c +++ b/lib_dec/ivas_spar_decoder.c @@ -101,21 +101,17 @@ ivas_error ivas_spar_dec_open( } /* TD decorr. */ -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( ( st_ivas->ivas_format == SBA_FORMAT ) && ( ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_STEREO ) || ( st_ivas->hDecoderConfig->ivas_total_brate >= IVAS_256k && st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_FOA ) ) ) { hSpar->hTdDecorr = NULL; } else { -#endif if ( ( error = ivas_td_decorr_dec_open( &hSpar->hTdDecorr, output_Fs, num_decor_chs + 1, 1 ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif /* MD handle */ if ( ( error = ivas_spar_md_dec_open( &hSpar->hMdDec, st_ivas->hDecoderConfig, num_channels_internal, sba_order_internal, st_ivas->sid_format ) ) != IVAS_ERR_OK ) @@ -134,13 +130,8 @@ ivas_error ivas_spar_dec_open( /* set FB config. */ active_w_mixing = -1; -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, num_channels_internal, num_channels_internal, active_w_mixing, output_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -209,7 +200,6 @@ ivas_error ivas_spar_dec_open( ivas_output_init( &( st_ivas->hTransSetup ), st_ivas->transport_config ); -#ifdef JBM_TSM_ON_TCS set_s( hSpar->subframe_nbslots, 0, MAX_JBM_SUBFRAMES_5MS ); set_s( hSpar->subframe_nbslots, JBM_CLDFB_SLOTS_IN_SUBFRAME, DEFAULT_JBM_SUBFRAMES_5MS ); hSpar->nb_subframes = DEFAULT_JBM_SUBFRAMES_5MS; @@ -252,7 +242,6 @@ ivas_error ivas_spar_dec_open( return error; } } -#endif st_ivas->hSpar = hSpar; @@ -333,7 +322,6 @@ ivas_error ivas_spar_dec( bit_stream_orig = st0->bit_stream; next_bit_pos_orig = st0->next_bit_pos; -#ifdef SBA_MODE_CLEAN_UP /* read DirAC bitstream */ if ( st_ivas->hQMetaData != NULL ) { @@ -341,7 +329,6 @@ ivas_error ivas_spar_dec( ivas_get_hodirac_flag( hDecoderConfig->ivas_total_brate, st_ivas->sba_analysis_order ), st_ivas->hSpar->dirac_to_spar_md_bands ); } -#endif last_bit_pos = (int16_t) ( ( hDecoderConfig->ivas_total_brate / FRAMES_PER_SEC ) - 1 ); if ( !st0->bfi && hDecoderConfig->ivas_total_brate == IVAS_SID_5k2 ) @@ -764,15 +751,11 @@ static void ivas_spar_dec_MD( if ( hSpar->hMdDec->table_idx != table_idx ) { hSpar->hMdDec->table_idx = table_idx; -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( hSpar->hTdDecorr ) { -#endif hSpar->hTdDecorr->ducking_flag = ivas_spar_br_table_consts[table_idx].td_ducking; -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif ivas_spar_md_dec_init( hSpar->hMdDec, hDecoderConfig, num_channels, sba_order ); } } @@ -1098,7 +1081,6 @@ static void ivas_spar_calc_smooth_facs( } -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_spar_dec_agc_pca() * @@ -1271,10 +1253,8 @@ void ivas_spar_dec_digest_tc( { int16_t nSamplesToDecorr = min( nSamplesLeftForTD, default_frame ); -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( hSpar->hTdDecorr ) { -#endif ivas_td_decorr_process( hSpar->hTdDecorr, p_tc, pPcm_tmp, nSamplesToDecorr ); if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) { @@ -1294,9 +1274,7 @@ void ivas_spar_dec_digest_tc( mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - ch], p_tc[nchan_internal - 1 - ch], nSamplesToDecorr ); } } -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif for ( ch = 0; ch < nchan_internal; ch++ ) { p_tc[ch] += nSamplesToDecorr; @@ -1359,10 +1337,8 @@ void ivas_spar_dec_upmixer( if ( hSpar->hMdDec->td_decorr_flag ) { -#ifdef FIX_163_SBA_TD_DECORR_OPT if ( hSpar->hTdDecorr ) { -#endif ivas_td_decorr_process( hSpar->hTdDecorr, st_ivas->hTcBuffer->tc, pPcm_tmp, output_frame ); if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) { @@ -1382,9 +1358,7 @@ void ivas_spar_dec_upmixer( mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], st_ivas->hTcBuffer->tc[nchan_internal - 1 - i], output_frame ); } } -#ifdef FIX_163_SBA_TD_DECORR_OPT } -#endif } ivas_spar_dec_set_render_params( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); @@ -1422,10 +1396,8 @@ void ivas_spar_dec_upmixer( return; } -#endif -#ifdef JBM_TSM_ON_TCS /*-------------------------------------------------------------------* * ivas_spar_dec_upmixer_sf() * @@ -1437,15 +1409,6 @@ void ivas_spar_dec_upmixer_sf( float *output[], /* o : output audio channels */ const int16_t nchan_internal /* i : number of internal channels */ ) -#else -void ivas_spar_dec_upmixer( - - Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ - float output[][L_FRAME48k], /* i/o: input/output audio channels */ - const int16_t nchan_internal, /* i : number of internal channels */ - const int16_t output_frame /* i : output frame length */ -) -#endif { int16_t cldfb_band, num_cldfb_bands, numch_in, numch_out; float *cldfb_in_ts_re[MAX_OUTPUT_CHANNELS][CLDFB_NO_COL_MAX]; @@ -1453,37 +1416,21 @@ void ivas_spar_dec_upmixer( int16_t i, b, ts, out_ch, in_ch; int16_t num_spar_bands, spar_band, nchan_transport; int16_t num_in_ingest, split_band; -#ifdef JBM_TSM_ON_TCS int16_t slot_size, slot_idx_start; float *p_tc[MAX_OUTPUT_CHANNELS]; int16_t md_idx; -#endif float Pcm_tmp[MAX_OUTPUT_CHANNELS][L_FRAME48k]; int16_t numch_out_dirac; -#ifndef JBM_TSM_ON_TCS - float *pPcm_tmp[MAX_OUTPUT_CHANNELS]; - int16_t num_bands_out; -#endif float mixer_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH][IVAS_MAX_NUM_BANDS]; int16_t b_skip_mat[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH]; DECODER_CONFIG_HANDLE hDecoderConfig; SPAR_DEC_HANDLE hSpar; int16_t num_md_sub_frames; -#ifndef JBM_TSM_ON_TCS - int16_t md_sf_idx; -#endif -#ifdef JBM_TSM_ON_TCS push_wmops( "ivas_spar_dec_upmixer_sf" ); -#else - push_wmops( "ivas_spar_dec_upmixer" ); -#endif hSpar = st_ivas->hSpar; hDecoderConfig = st_ivas->hDecoderConfig; -#ifndef JBM_TSM_ON_TCS - num_bands_out = hSpar->hFbMixer->pFb->filterbank_num_bands; -#endif nchan_transport = hSpar->hMdDec->spar_md_cfg.nchan_transport; num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; @@ -1492,14 +1439,12 @@ void ivas_spar_dec_upmixer( num_md_sub_frames = ivas_get_spar_dec_md_num_subframes( st_ivas->sba_order, hDecoderConfig->ivas_total_brate ); -#ifdef JBM_TSM_ON_TCS slot_size = NS2SA( st_ivas->hDecoderConfig->output_Fs, CLDFB_SLOT_NS ); slot_idx_start = hSpar->slots_rendered; for ( i = 0; i < nchan_internal; i++ ) { p_tc[i] = st_ivas->hTcBuffer->tc[i] + slot_idx_start * slot_size; } -#endif #ifdef DEBUG_SPAR_BYPASS_EVS_CODEC /* by-pass core-coder */ @@ -1538,19 +1483,6 @@ void ivas_spar_dec_upmixer( } #endif -#ifndef JBM_TSM_ON_TCS - /*---------------------------------------------------------------------* - * AGC - *---------------------------------------------------------------------*/ - - ivas_agc_dec_process( hSpar->hAgcDec, output, output, nchan_transport, output_frame ); - - -#ifdef DEBUG_SBA_AUDIO_DUMP - /* Dump audio signal after ivas_agc_dec_process */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, st_ivas->nchan_transport, spar_foa_dec_wav[1], "ivas_agc_dec_process()" ); -#endif -#endif /*---------------------------------------------------------------------* * TD Decorr and pcm ingest *---------------------------------------------------------------------*/ @@ -1564,12 +1496,6 @@ void ivas_spar_dec_upmixer( num_in_ingest = nchan_transport; } -#ifndef JBM_TSM_ON_TCS - for ( i = 0; i < nchan_internal; i++ ) - { - pPcm_tmp[i] = Pcm_tmp[i]; - } -#endif /*---------------------------------------------------------------------* * PCA decoder *---------------------------------------------------------------------*/ @@ -1577,46 +1503,7 @@ void ivas_spar_dec_upmixer( hSpar->pca_ingest_channels = num_in_ingest; #endif -#ifndef JBM_TSM_ON_TCS /* will already happen in the TC decoding */ - if ( hSpar->hPCA != NULL ) - { - ivas_pca_dec( hSpar->hPCA, output_frame, num_in_ingest, hDecoderConfig->ivas_total_brate, hDecoderConfig->last_ivas_total_brate, st_ivas->bfi, output ); -#ifdef DEBUG_SBA_AUDIO_DUMP - /* Dump audio signal after ivas_pca_dec */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, num_in_ingest, spar_foa_dec_wav[2], "ivas_pca_dec()" ); -#endif - } -#endif - -#ifndef JBM_TSM_ON_TCS - /*---------------------------------------------------------------------* - * TD decorrelation - *---------------------------------------------------------------------*/ - - if ( hSpar->hMdDec->td_decorr_flag ) - { - ivas_td_decorr_process( hSpar->hTdDecorr, output, pPcm_tmp, output_frame ); - if ( hSpar->hTdDecorr->num_apd_outputs >= ( nchan_internal - nchan_transport ) ) - { - for ( i = 0; i < nchan_internal - nchan_transport; i++ ) - { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); - } - } - else - { - for ( i = 0; i < nchan_internal - nchan_transport; i++ ) - { - set_zero( output[nchan_internal - 1 - i], output_frame ); - } - for ( i = 0; i < hSpar->hTdDecorr->num_apd_outputs; i++ ) - { - mvr2r( pPcm_tmp[hSpar->hTdDecorr->num_apd_outputs - 1 - i], output[nchan_internal - 1 - i], output_frame ); - } - } - } -#endif hSpar->hFbMixer->fb_cfg->num_in_chans = num_in_ingest; @@ -1649,14 +1536,6 @@ void ivas_spar_dec_upmixer( } } -#ifndef JBM_TSM_ON_TCS - /*---------------------------------------------------------------------* - * Gen umx mat - *---------------------------------------------------------------------*/ - - ivas_spar_dec_gen_umx_mat( hSpar->hMdDec, nchan_transport, num_bands_out, st_ivas->bfi, - num_md_sub_frames ); -#endif /*---------------------------------------------------------------------* * CLDFB Processing and Synthesis @@ -1673,272 +1552,191 @@ void ivas_spar_dec_upmixer( #ifdef DEBUG_SBA_AUDIO_DUMP /* Dump audio signal after ivas_agc_dec_process */ -#ifdef JBM_TSM_ON_TCS ivas_spar_dump_signal_wav( output_frame, p_tc, NULL, numch_in, spar_foa_dec_wav[4], "ivas_spar_upmixer()" ); -#else - ivas_spar_dump_signal_wav( output_frame, NULL, output, numch_in, spar_foa_dec_wav[4], "ivas_spar_upmixer()" ); -#endif #endif -#ifndef JBM_TSM_ON_TCS - for ( int16_t i_sf = 0; i_sf < MAX_PARAM_SPATIAL_SUBFRAMES; i_sf++ ) + /* CLDFB analysis of incoming frame */ + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { -#endif - /* CLDFB analysis of incoming frame */ - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { -#ifdef JBM_TSM_ON_TCS - for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) -#endif - { - cldfbAnalysis_ts( -#ifdef JBM_TSM_ON_TCS - &p_tc[in_ch][ts * num_cldfb_bands], -#else - &output[in_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], -#endif - cldfb_in_ts_re[in_ch][ts], - cldfb_in_ts_im[in_ch][ts], - num_cldfb_bands, - st_ivas->cldfbAnaDec[in_ch] ); - } + cldfbAnalysis_ts( + &p_tc[in_ch][ts * num_cldfb_bands], + cldfb_in_ts_re[in_ch][ts], + cldfb_in_ts_im[in_ch][ts], + num_cldfb_bands, + st_ivas->cldfbAnaDec[in_ch] ); } + } - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) - { - ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf ); - } + if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) + { + ivas_spar_calc_smooth_facs( cldfb_in_ts_re[0], cldfb_in_ts_im[0], num_spar_bands, &hSpar->hFbMixer->pFb->fb_bin_to_band, hSpar->hMdDec->smooth_fac, hSpar->hMdDec->smooth_buf ); + } -#ifdef JBM_TSM_ON_TCS - for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) -#endif + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) + { + md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; + ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); + if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) { -#ifdef JBM_TSM_ON_TCS - md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; - ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); -#else - /* determine SPAR parameters for this time slots */ - ivas_spar_get_parameters( hSpar, hDecoderConfig, ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES, numch_out, numch_in, num_spar_bands, mixer_mat ); -#endif - if ( ( hDecoderConfig->ivas_total_brate < IVAS_24k4 ) && ( ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA2 ) || ( hDecoderConfig->output_config == AUDIO_CONFIG_HOA3 ) ) ) + for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) { - for ( spar_band = 0; spar_band < num_spar_bands; spar_band++ ) + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - mixer_mat[out_ch][in_ch][spar_band] = ( 1 - hSpar->hMdDec->smooth_fac[spar_band] ) * mixer_mat[out_ch][in_ch][spar_band] + hSpar->hMdDec->smooth_fac[spar_band] * hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band]; - hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band] = mixer_mat[out_ch][in_ch][spar_band]; - } + mixer_mat[out_ch][in_ch][spar_band] = ( 1 - hSpar->hMdDec->smooth_fac[spar_band] ) * mixer_mat[out_ch][in_ch][spar_band] + hSpar->hMdDec->smooth_fac[spar_band] * hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band]; + hSpar->hMdDec->mixer_mat_prev2[out_ch][in_ch][spar_band] = mixer_mat[out_ch][in_ch][spar_band]; } } } + } + + for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) + { + float out_re[IVAS_SPAR_MAX_CH]; + float out_im[IVAS_SPAR_MAX_CH]; + float cldfb_par; + ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; - for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) { - float out_re[IVAS_SPAR_MAX_CH]; - float out_im[IVAS_SPAR_MAX_CH]; - float cldfb_par; - ivas_fb_bin_to_band_data_t *bin2band = &hSpar->hFbMixer->pFb->fb_bin_to_band; + out_re[out_ch] = 0.0f; + out_im[out_ch] = 0.0f; - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - out_re[out_ch] = 0.0f; - out_im[out_ch] = 0.0f; - - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + if ( b_skip_mat[out_ch][in_ch] == 0 ) { - if ( b_skip_mat[out_ch][in_ch] == 0 ) + if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ { - if ( cldfb_band < CLDFB_PAR_WEIGHT_START_BAND ) /* tuning parameter, depends on how much SPAR Filters overlap for the CLDFB bands */ - { - spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; - cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; - } - else + spar_band = bin2band->p_cldfb_map_to_spar_band[cldfb_band]; + cldfb_par = mixer_mat[out_ch][in_ch][spar_band]; + } + else + { + cldfb_par = 0.0f; + for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) { - cldfb_par = 0.0f; - for ( spar_band = bin2band->p_spar_start_bands[cldfb_band]; spar_band < num_spar_bands; spar_band++ ) - { - /* accumulate contributions from all SPAR bands */ - cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; - } + /* accumulate contributions from all SPAR bands */ + cldfb_par += mixer_mat[out_ch][in_ch][spar_band] * bin2band->pp_cldfb_weights_per_spar_band[cldfb_band][spar_band]; } - - out_re[out_ch] += cldfb_in_ts_re[in_ch][ts][cldfb_band] * cldfb_par; - out_im[out_ch] += cldfb_in_ts_im[in_ch][ts][cldfb_band] * cldfb_par; } + + out_re[out_ch] += cldfb_in_ts_re[in_ch][ts][cldfb_band] * cldfb_par; + out_im[out_ch] += cldfb_in_ts_im[in_ch][ts][cldfb_band] * cldfb_par; } } + } - /*update CLDFB data with the parameter-modified data*/ - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) - { - cldfb_in_ts_re[out_ch][ts][cldfb_band] = out_re[out_ch]; - cldfb_in_ts_im[out_ch][ts][cldfb_band] = out_im[out_ch]; - } + /*update CLDFB data with the parameter-modified data*/ + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + cldfb_in_ts_re[out_ch][ts][cldfb_band] = out_re[out_ch]; + cldfb_in_ts_im[out_ch][ts][cldfb_band] = out_im[out_ch]; } + } -#ifdef JBM_TSM_ON_TCS - if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) + if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) + { + /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ + int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; + split_band = SPAR_DIRAC_SPLIT_START_BAND; + md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? md_sf : 0; + if ( split_band < IVAS_MAX_NUM_BANDS ) { - /* we have crossed an unadapted parameter sf border, update previous mixing matrices */ - int16_t md_sf = md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME; - split_band = SPAR_DIRAC_SPLIT_START_BAND; - md_sf = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? md_sf : 0; - if ( split_band < IVAS_MAX_NUM_BANDS ) - { - mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); + mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + { + for ( in_ch = 0; in_ch < numch_in; in_ch++ ) { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) + for ( b = 0; b < num_spar_bands; b++ ) { - for ( b = 0; b < num_spar_bands; b++ ) - { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; - } + hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf * IVAS_MAX_NUM_BANDS]; } } - hSpar->i_subframe++; - hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); } + hSpar->i_subframe++; + hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); } -#endif } + } - if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) - { -#ifdef JBM_TSM_ON_TCS - ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); -#else - ivas_dirac_dec( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im, i_sf ); -#endif - } + if ( hDecoderConfig->output_config != AUDIO_CONFIG_FOA && hDecoderConfig->output_config != AUDIO_CONFIG_STEREO && hDecoderConfig->output_config != AUDIO_CONFIG_MONO ) + { + ivas_dirac_dec_render_sf( st_ivas, output, nchan_internal, cldfb_in_ts_re, cldfb_in_ts_im ); + } - if ( st_ivas->hDirAC != NULL ) - { - int16_t outchannels, idx_in, idx_lfe, ch; - idx_in = 0; - idx_lfe = 0; + if ( st_ivas->hDirAC != NULL ) + { + int16_t outchannels, idx_in, idx_lfe, ch; + idx_in = 0; + idx_lfe = 0; - outchannels = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; - for ( ch = 0; ch < outchannels; ch++ ) + outchannels = st_ivas->hOutSetup.nchan_out_woLFE + st_ivas->hOutSetup.num_lfe; + for ( ch = 0; ch < outchannels; ch++ ) + { + if ( ( st_ivas->hOutSetup.num_lfe > 0 ) && ( st_ivas->hOutSetup.index_lfe[idx_lfe] == ch ) ) { - if ( ( st_ivas->hOutSetup.num_lfe > 0 ) && ( st_ivas->hOutSetup.index_lfe[idx_lfe] == ch ) ) + set_zero( output[ch], hSpar->subframe_nbslots[hSpar->subframes_rendered] * num_cldfb_bands ); + if ( idx_lfe < ( st_ivas->hDirAC->hOutSetup.num_lfe - 1 ) ) { -#ifdef JBM_TSM_ON_TCS - set_zero( output[ch], hSpar->subframe_nbslots[hSpar->subframes_rendered] * num_cldfb_bands ); -#else - set_zero( &( output[ch][i_sf * MAX_PARAM_SPATIAL_SUBFRAMES * num_cldfb_bands] ), MAX_PARAM_SPATIAL_SUBFRAMES * num_cldfb_bands ); -#endif - if ( idx_lfe < ( st_ivas->hDirAC->hOutSetup.num_lfe - 1 ) ) - { - idx_lfe++; - } - } - else - { - if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) - { -#ifdef JBM_TSM_ON_TCS - for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) -#endif - { - cldfbSynthesis( - &cldfb_in_ts_re[idx_in][ts], - &cldfb_in_ts_im[idx_in][ts], -#ifdef JBM_TSM_ON_TCS - &output[ch][ts * num_cldfb_bands], -#else - &output[ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], -#endif - num_cldfb_bands, - st_ivas->cldfbSynDec[idx_in] ); - } - } - idx_in++; + idx_lfe++; } } -#ifdef DEBUG_SBA_AUDIO_DUMP - hSpar->numOutChannels = outchannels; -#endif - } - else - { - /* CLDFB to time synthesis (overwrite mixer output) */ - for ( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) + else { -#ifdef JBM_TSM_ON_TCS - for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < MAX_PARAM_SPATIAL_SUBFRAMES; ts++ ) -#endif + if ( hDecoderConfig->output_config == AUDIO_CONFIG_FOA || !( st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hOutSetup.output_config == AUDIO_CONFIG_BINAURAL_ROOM ) ) { - cldfbSynthesis( - &cldfb_in_ts_re[out_ch][ts], - &cldfb_in_ts_im[out_ch][ts], -#ifdef JBM_TSM_ON_TCS - &output[out_ch][ts * num_cldfb_bands], -#else - &output[out_ch][( ts + i_sf * MAX_PARAM_SPATIAL_SUBFRAMES ) * num_cldfb_bands], -#endif - num_cldfb_bands, - st_ivas->cldfbSynDec[out_ch] ); + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) + { + cldfbSynthesis( + &cldfb_in_ts_re[idx_in][ts], + &cldfb_in_ts_im[idx_in][ts], + &output[ch][ts * num_cldfb_bands], + num_cldfb_bands, + st_ivas->cldfbSynDec[idx_in] ); + } } + idx_in++; } -#ifdef DEBUG_SBA_AUDIO_DUMP - hSpar->numOutChannels = numch_out_dirac; -#endif } #ifdef DEBUG_SBA_AUDIO_DUMP - /* Dump audio signal after cldfbSynthesis */ - ivas_spar_dump_signal_wav( output_frame, NULL, output, hSpar->numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); + hSpar->numOutChannels = outchannels; #endif - - -#ifndef JBM_TSM_ON_TCS - md_sf_idx = ( num_md_sub_frames == MAX_PARAM_SPATIAL_SUBFRAMES ) ? i_sf : 0; - split_band = SPAR_DIRAC_SPLIT_START_BAND; - if ( split_band < IVAS_MAX_NUM_BANDS ) + } + else + { + /* CLDFB to time synthesis (overwrite mixer output) */ + for ( out_ch = 0; out_ch < numch_out_dirac; out_ch++ ) { - hSpar->i_subframe++; - hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_SPAR_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) + for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( b = 0; b < num_spar_bands; b++ ) - { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + md_sf_idx * IVAS_MAX_NUM_BANDS]; - } - } + cldfbSynthesis( + &cldfb_in_ts_re[out_ch][ts], + &cldfb_in_ts_im[out_ch][ts], + &output[out_ch][ts * num_cldfb_bands], + num_cldfb_bands, + st_ivas->cldfbSynDec[out_ch] ); } } +#ifdef DEBUG_SBA_AUDIO_DUMP + hSpar->numOutChannels = numch_out_dirac; #endif -#ifndef JBM_TSM_ON_TCS } +#ifdef DEBUG_SBA_AUDIO_DUMP + /* Dump audio signal after cldfbSynthesis */ + ivas_spar_dump_signal_wav( output_frame, NULL, output, hSpar->numOutChannels, spar_foa_dec_wav[3], "cldfbSynthesis()" ); #endif -#ifdef JBM_TSM_ON_TCS + hSpar->slots_rendered += hSpar->subframe_nbslots[hSpar->subframes_rendered]; hSpar->subframes_rendered++; -#endif pop_wmops(); diff --git a/lib_dec/ivas_spar_md_dec.c b/lib_dec/ivas_spar_md_dec.c old mode 100755 new mode 100644 index 03f014ecfdc005f2b708eb474f5a2748e3c932a5..9ef40b928eb6dfd9179724e97318c459dc4ef5fc --- a/lib_dec/ivas_spar_md_dec.c +++ b/lib_dec/ivas_spar_md_dec.c @@ -486,13 +486,9 @@ ivas_error ivas_spar_md_dec_init( ivas_sba_get_spar_hoa_ch_ind( num_channels, hDecoderConfig->ivas_total_brate, hMdDec->HOA_md_ind ); hMdDec->spar_md.num_bands = ( hMdDec->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : min( IVAS_MAX_NUM_BANDS, SPAR_DIRAC_SPLIT_START_BAND ); - ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, hMdDec->spar_md.num_bands -#ifdef ARITH_HUFF_CODER_CHANGES - , + ivas_spar_set_bitrate_config( &hMdDec->spar_md_cfg, hMdDec->table_idx, hMdDec->spar_md.num_bands, hMdDec->spar_hoa_dirac2spar_md_flag, - 0, 0, 0 -#endif - ); + 0, 0, 0 ); nchan_transport = hMdDec->spar_md_cfg.nchan_transport; @@ -3034,11 +3030,7 @@ void ivas_spar_to_dirac( qmf_band_start = band_grouping[band]; qmf_band_end = band_grouping[band + 1]; -#ifdef JBM_TSM_ON_TCS for ( block = 0; block < MAX_PARAM_SPATIAL_SUBFRAMES; block++ ) -#else - for ( block = 0; block < hDirAC->nb_subframes; block++ ) -#endif { int16_t ts_start, ts_end, ts; diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index cd565f3eae6f541f11504f3887c48735156761ea..ba8f573364026477612a08411093bb1cc819fca5 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -435,11 +435,9 @@ typedef struct param_ism_rendering float *proto_matrix; float *interpolator; float mixing_matrix_lin_old[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; -#ifdef JBM_TSM_ON_TCS float mixing_matrix_lin[CLDFB_NO_CHANNELS_MAX][PARAM_ISM_MAX_CHAN * PARAM_ISM_MAX_DMX]; float *Cldfb_RealBuffer_tc; float *Cldfb_ImagBuffer_tc; -#endif } PARAM_ISM_RENDERING_DATA, *PARAM_ISM_RENDERING_HANDLE; @@ -576,10 +574,8 @@ typedef struct dirac_output_synthesis_cov_state_structure float *cy_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_old[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res_old[CLDFB_NO_CHANNELS_MAX]; -#ifdef JBM_TSM_ON_TCS float *mixing_matrix[CLDFB_NO_CHANNELS_MAX]; float *mixing_matrix_res[CLDFB_NO_CHANNELS_MAX]; -#endif } DIRAC_OUTPUT_SYNTHESIS_COV_STATE; @@ -620,15 +616,9 @@ typedef struct /* Diffuse sound directional distribution data structure */ typedef struct ivas_diffuse_distribution_data_structure { -#ifdef JBM_TSM_ON_TCS float diffuseRatioX[CLDFB_NO_CHANNELS_MAX]; float diffuseRatioY[CLDFB_NO_CHANNELS_MAX]; float diffuseRatioZ[CLDFB_NO_CHANNELS_MAX]; -#else - float diffuseRatioX[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float diffuseRatioY[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; - float diffuseRatioZ[MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX]; -#endif } DIFFUSE_DISTRIBUTION_DATA, *DIFFUSE_DISTRIBUTION_HANDLE; @@ -640,15 +630,11 @@ typedef struct ivas_dirac_dec_data_structure IVAS_OUTPUT_SETUP hOutSetup; int16_t slot_size; -#ifdef JBM_TSM_ON_TCS int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t subframes_rendered; int16_t slots_rendered; int16_t num_slots; int16_t render_to_md_map[MAX_JBM_SUBFRAMES_5MS * JBM_CLDFB_SLOTS_IN_SUBFRAME]; -#else - int16_t subframe_nbslots; -#endif int16_t nb_subframes; int16_t num_freq_bands; @@ -732,9 +718,6 @@ typedef struct ivas_dirac_dec_data_structure float power_ratios[MAX_PARAM_ISM_NBANDS][MAX_PARAM_ISM_NBLOCKS][MAX_PARAM_ISM_WAVE]; PARAM_ISM_RENDERING_HANDLE hParamIsmRendering; IVAS_FB_MIXER_HANDLE hFbMdft; -#ifndef SBA_MODE_CLEAN_UP - int16_t dirac_to_spar_md_bands[DIRAC_MAX_NBANDS]; -#endif const int16_t *sba_map_tc; } DIRAC_DEC_DATA, *DIRAC_DEC_HANDLE; @@ -759,7 +742,6 @@ typedef struct ivas_param_mc_dec_data_structure { int16_t slot_size; -#ifdef JBM_TSM_ON_TCS float *Cldfb_RealBuffer_tc; float *Cldfb_ImagBuffer_tc; int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; @@ -767,9 +749,6 @@ typedef struct ivas_param_mc_dec_data_structure int16_t subframes_rendered; int16_t slots_rendered; int16_t num_slots; -#else - int16_t subframe_nbslots; -#endif int16_t num_freq_bands; int16_t num_param_bands_synth; @@ -915,14 +894,12 @@ typedef struct ivas_spar_dec_lib_t int16_t numOutChannels; int16_t pca_ingest_channels; #endif -#ifdef JBM_TSM_ON_TCS int16_t subframe_nbslots[MAX_JBM_SUBFRAMES_5MS]; int16_t render_to_md_map[MAX_JBM_CLDFB_TIMESLOTS]; int16_t nb_subframes; int16_t subframes_rendered; int16_t slots_rendered; int16_t num_slots; -#endif } SPAR_DEC_DATA, *SPAR_DEC_HANDLE; @@ -1092,12 +1069,8 @@ typedef struct vbap_data_structure typedef struct renderer_struct { float prev_gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; -#ifdef JBM_TSM_ON_TCS float *interpolator; float gains[MAX_CICP_CHANNELS - 1][MAX_OUTPUT_CHANNELS]; -#else - float interpolator[L_FRAME48k]; -#endif } ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE; @@ -1201,38 +1174,29 @@ typedef struct ivas_masa_decoder_struct typedef struct decoder_config_structure { - int32_t ivas_total_brate; /* IVAS total bitrate in bps */ - int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ - int32_t output_Fs; /* output signal sampling frequency in Hz */ - int16_t nchan_out; /* number of output audio channels */ - AUDIO_CONFIG output_config; /* output audio configuration */ - int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ - int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ - int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ - int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ -#ifdef FIX_439_OTR_PARAMS + int32_t ivas_total_brate; /* IVAS total bitrate in bps */ + int32_t last_ivas_total_brate; /* last IVAS total bitrate in bps */ + int32_t output_Fs; /* output signal sampling frequency in Hz */ + int16_t nchan_out; /* number of output audio channels */ + AUDIO_CONFIG output_config; /* output audio configuration */ + int16_t Opt_LsCustom; /* indicates whether loudspeaker custom setup is used */ + int16_t Opt_HRTF_binary; /* indicates whether HRTF binary file is used */ + int16_t Opt_Headrotation; /* indicates whether head-rotation is used */ + int16_t Opt_RendConfigCustom; /* indicates whether Renderer configuration custom setup is used */ HEAD_ORIENT_TRK_T orientation_tracking; /* indicates orientation tracking type */ -#else - int16_t orientation_tracking; /* indicates orientation tracking type */ -#endif - int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ - float non_diegetic_pan_gain; /* non diegetic panning gain*/ - int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ + int16_t Opt_non_diegetic_pan; /* indicates diegetic or not */ + float non_diegetic_pan_gain; /* non diegetic panning gain*/ + int16_t Opt_AMR_WB; /* flag indicating AMR-WB IO mode */ /* temp. development parameters */ #ifdef DEBUGGING int16_t force_rend; /* forced TD/CLDFB binaural renderer (for ISM and MC) */ #endif -#ifdef JBM_TSM_ON_TCS int16_t voip_active; -#endif -#ifdef FIX_356_ISM_METADATA_SYNC int16_t Opt_delay_comp; /* flag indicating delay compensation active */ -#endif } DECODER_CONFIG, *DECODER_CONFIG_HANDLE; -#ifdef JBM_TSM_ON_TCS typedef struct decoder_tc_buffer_structure { float *tc_buffer; /* the buffer itself */ @@ -1254,7 +1218,6 @@ typedef struct decoder_tc_buffer_structure int16_t n_samples_discard; /* number of samples to discard from the beginning of the output */ } DECODER_TC_BUFFER, *DECODER_TC_BUFFER_HANDLE; -#endif /*----------------------------------------------------------------------------------* @@ -1314,9 +1277,6 @@ typedef struct Decoder_Struct ISM_MODE ism_mode; /* ISM format mode */ int16_t nchan_ism; /* number of ISM channels */ -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE sba_mode; /* SBA format mode */ -#endif MC_MODE mc_mode; /* MC format mode */ int16_t sba_order; /* Ambisonic (SBA) order */ int16_t sba_planar; /* Ambisonic (SBA) planar flag */ @@ -1346,10 +1306,8 @@ typedef struct Decoder_Struct RENDER_CONFIG_DATA *hRenderConfig; /* Renderer config pointer */ int32_t binaural_latency_ns; /* Binauralization latency in ns */ -#ifdef JBM_TSM_ON_TCS /* JBM module */ DECODER_TC_BUFFER_HANDLE hTcBuffer; /* JBM structure */ -#endif #ifdef DEBUGGING int32_t noClipping; /* number of clipped samples */ diff --git a/lib_dec/ivas_stereo_dft_dec.c b/lib_dec/ivas_stereo_dft_dec.c index 5c2d0b37e6f7ee598768e8fffcad6eb08e2dbc7d..08caff6233a43875a1cf12946b56666636a7a7c6 100644 --- a/lib_dec/ivas_stereo_dft_dec.c +++ b/lib_dec/ivas_stereo_dft_dec.c @@ -1131,10 +1131,8 @@ void stereo_dft_dec( const int16_t cross_fade_start_offset, /* i : SPAR mixer delay compensation */ const int32_t output_Fs, /* i : Fs for delay calculation */ const int16_t nchan_transport /* i : number of transpor channels */ -#ifdef FIX_STEREO_474 , const int16_t num_md_sub_frames /* i: number of MD subframes */ -#endif ) { int16_t i, k, b, N_div, stop; @@ -1212,12 +1210,8 @@ void stereo_dft_dec( ivas_sba_dirac_stereo_smooth_parameters( hStereoDft, hMdDec, cross_fade_start_offset, - output_Fs -#ifdef FIX_STEREO_474 - , - num_md_sub_frames -#endif - ); + output_Fs, + num_md_sub_frames ); } else { @@ -1738,11 +1732,7 @@ void stereo_dft_dec( if ( st0->bfi && !prev_bfi ) { -#ifdef FIX_499_DFT_STEREO_PLC idx_k0 = ( hStereoDft->past_DMX_pos + STEREO_DFT_PAST_MAX - 1 ) % STEREO_DFT_PAST_MAX; -#else - idx_k0 = ( hStereoDft->past_DMX_pos + 1 ) % STEREO_DFT_PAST_MAX; -#endif idx_k1 = ( idx_k0 + 1 ) % STEREO_DFT_PAST_MAX; /*dmx energy memory*/ hStereoDft->past_dmx_nrg = stereo_dft_dmx_swb_nrg( hStereoDft->DFT_past_DMX[idx_k0], hStereoDft->DFT_past_DMX[idx_k1], min( hStereoDft->NFFT, STEREO_DFT32MS_N_32k ) ); diff --git a/lib_dec/jbm_jb4sb.h b/lib_dec/jbm_jb4sb.h index 7954358595a32c3dceff516f4a04a87c73b09648..00f5ccbb4078ab61d69873fb1cd6c3e25f5128a6 100644 --- a/lib_dec/jbm_jb4sb.h +++ b/lib_dec/jbm_jb4sb.h @@ -78,13 +78,11 @@ struct JB4_DATAUNIT int16_t nextCoderType; }; -#ifdef JBM_TSM_ON_TCS typedef enum { JBM_RENDERER_NONE, JBM_RENDERER_IVAS, } JBM_RENDERER_TYPE; -#endif typedef struct JB4_DATAUNIT *JB4_DATAUNIT_HANDLE; diff --git a/lib_dec/jbm_pcmdsp_apa.c b/lib_dec/jbm_pcmdsp_apa.c index 9742a01183753e39f0de9897f9821ad58ad7bbb4..1242004fc89ac7e41c349e85c29bfe3d237144f0 100644 --- a/lib_dec/jbm_pcmdsp_apa.c +++ b/lib_dec/jbm_pcmdsp_apa.c @@ -66,12 +66,8 @@ struct apa_state_t { /* output buffer */ -#ifdef JBM_TSM_ON_TCS bool evs_compat_mode; float *buf_out; -#else - int16_t *buf_out; -#endif uint16_t buf_out_capacity; uint16_t l_buf_out; @@ -91,13 +87,11 @@ struct apa_state_t /* total number of processed input samples since apa_reset() */ uint32_t l_in_total; -#ifdef JBM_TSM_ON_TCS /* time resolution in samples of the IVAS renderer*/ uint16_t l_ts; /* samples already available in the renderer buffer */ uint16_t l_r_buf; -#endif /* sum of inserted/removed samples since last apa_set_scale() */ int32_t diffSinceSetScale; @@ -136,7 +130,6 @@ static float apa_corrEnergy2dB( float energy, uint16_t corr_len ); static float apa_getQualityIncreaseForLowEnergy( float energydB ); -#ifdef JBM_TSM_ON_TCS static bool logarithmic_search( const apa_state_t *ps, const float *signal, int16_t s_start, uint16_t inlen, uint16_t offset, uint16_t fixed_pos, uint16_t corr_len, uint16_t wss, uint16_t css, int16_t *synchpos ); static bool find_synch( apa_state_t *ps, const float *in, uint16_t l_in, int16_t s_start, uint16_t s_len, int16_t fixed_pos, uint16_t corr_len, uint16_t offset, float *energy, float *quality, int16_t *synch_pos ); @@ -146,17 +139,6 @@ static bool copy_frm( apa_state_t *ps, const float frm_in[], float frm_out[], ui static bool shrink_frm( apa_state_t *ps, const float frm_in[], uint16_t maxScaling, float frm_out[], uint16_t *l_frm_out ); static bool extend_frm( apa_state_t *ps, const float frm_in[], float frm_out[], uint16_t *l_frm_out ); -#else -static bool logarithmic_search( const apa_state_t *ps, const int16_t *signal, int16_t s_start, uint16_t inlen, uint16_t offset, uint16_t fixed_pos, uint16_t corr_len, uint16_t wss, uint16_t css, int16_t *synchpos ); - -static bool find_synch( apa_state_t *ps, const int16_t *in, uint16_t l_in, int16_t s_start, uint16_t s_len, int16_t fixed_pos, uint16_t corr_len, uint16_t offset, float *energy, float *quality, int16_t *synch_pos ); - -static bool copy_frm( apa_state_t *ps, const int16_t frm_in[], int16_t frm_out[], uint16_t *l_frm_out ); - -static bool shrink_frm( apa_state_t *ps, const int16_t frm_in[], uint16_t maxScaling, int16_t frm_out[], uint16_t *l_frm_out ); - -static bool extend_frm( apa_state_t *ps, const int16_t frm_in[], int16_t frm_out[], uint16_t *l_frm_out ); -#endif /*---------------------------------------------------------------------* * Public functions @@ -188,9 +170,7 @@ ivas_error apa_init( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for JBM\n" ) ); } -#ifdef JBM_TSM_ON_TCS ps->evs_compat_mode = false; -#endif apa_reset( ps ); *pps = ps; @@ -224,14 +204,11 @@ void apa_reset( ps->bad_frame_count = 0; ps->good_frame_count = 0; -#ifdef JBM_TSM_ON_TCS ps->l_ts = 1; ps->l_r_buf = 0; -#endif return; } -#ifdef JBM_TSM_ON_TCS uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, @@ -275,7 +252,6 @@ uint8_t apa_reconfigure( return 0; } -#endif /* Sets the audio configuration. */ bool apa_set_rate( @@ -379,7 +355,6 @@ bool apa_set_scale( return 0; } -#ifdef JBM_TSM_ON_TCS bool apa_set_renderer_granularity( apa_state_t *ps, uint16_t l_ts ) @@ -426,7 +401,6 @@ bool apa_set_evs_compat_mode( return 0; } -#endif /* ******************************************************************************** @@ -579,28 +553,16 @@ bool apa_exit( ******************************************************************************** */ uint8_t apa_exec( - apa_state_t *ps, /* i/o: state struct */ -#ifdef JBM_TSM_ON_TCS - const float a_in[], /* i : input samples */ -#else - const int16_t a_in[], /* i : input samples */ -#endif + apa_state_t *ps, /* i/o: state struct */ + const float a_in[], /* i : input samples */ uint16_t l_in, /* i : number of input samples */ uint16_t maxScaling, /* i : allowed number of inserted/removed samples */ -#ifdef JBM_TSM_ON_TCS - float a_out[], /* o : output samples */ -#else - int16_t a_out[], /* o : output samples */ -#endif - uint16_t *l_out /* o : number of output samples */ + float a_out[], /* o : output samples */ + uint16_t *l_out /* o : number of output samples */ ) { uint16_t i; -#ifdef JBM_TSM_ON_TCS float frm_in[APA_BUF]; /* TODO(mcjbm): this buffer could be smaller - always allocates space for 16 channels */ -#else - int16_t frm_in[APA_BUF]; /* TODO(mcjbm): this buffer could be smaller - always allocates space for 16 channels */ -#endif uint16_t l_frm_out; int16_t l_rem; int32_t dl_scaled, dl_copied, l_frm_out_target; @@ -662,13 +624,8 @@ uint8_t apa_exec( } else { -#ifdef JBM_TSM_ON_TCS float *buf_out_ptr = &( ps->buf_out[ps->l_buf_out - ps->l_frm] ); float *frm_in_ptr = &( frm_in[ps->l_frm] ); -#else - int16_t *buf_out_ptr = &( ps->buf_out[ps->l_buf_out - ps->l_frm] ); - int16_t *frm_in_ptr = &( frm_in[ps->l_frm] ); -#endif /* fill input frame */ /* 1st input frame: previous output samples */ @@ -723,13 +680,8 @@ uint8_t apa_exec( /* discard old samples; always keep at least most recent l_frm samples */ if ( ( ps->l_buf_out + l_frm_out ) > ps->buf_out_capacity ) { -#ifdef JBM_TSM_ON_TCS float *buf_out_ptr1 = ps->buf_out; float *buf_out_ptr2; -#else - int16_t *buf_out_ptr1 = ps->buf_out; - int16_t *buf_out_ptr2; -#endif l_rem = ( ps->l_frm - l_frm_out ); if ( l_rem < 0 ) @@ -749,11 +701,7 @@ uint8_t apa_exec( return 5; } { -#ifdef JBM_TSM_ON_TCS float *buf_out_ptr = &( ps->buf_out[ps->l_buf_out] ); -#else - int16_t *buf_out_ptr = &( ps->buf_out[ps->l_buf_out] ); -#endif for ( i = 0; i < l_frm_out; i++ ) { buf_out_ptr[i] = a_out[i]; @@ -811,11 +759,7 @@ uint8_t apa_exec( */ static void get_scaling_quality( const apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t s_len, uint16_t offset, uint16_t corr_len, @@ -968,11 +912,7 @@ static float apa_getQualityIncreaseForLowEnergy( */ static bool logarithmic_search( const apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif int16_t s_start, uint16_t inlen, uint16_t offset, @@ -1085,11 +1025,7 @@ static bool logarithmic_search( */ static bool find_synch( apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float *in, -#else - const int16_t *in, -#endif uint16_t l_in, int16_t s_start, uint16_t s_len, @@ -1144,13 +1080,8 @@ static bool find_synch( */ static bool copy_frm( apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float frm_in[], float frm_out[], -#else - const int16_t frm_in[], - int16_t frm_out[], -#endif uint16_t *l_frm_out ) { uint16_t i; @@ -1197,17 +1128,9 @@ static bool copy_frm( */ static bool shrink_frm( apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float frm_in[], -#else - const int16_t frm_in[], -#endif uint16_t maxScaling, -#ifdef JBM_TSM_ON_TCS float frm_out[], -#else - int16_t frm_out[], -#endif uint16_t *l_frm_out ) { bool findSynchResult = 0; @@ -1238,7 +1161,6 @@ static bool shrink_frm( /* maximum scaling */ energy = -65; quality = 5; -#ifdef JBM_TSM_ON_TCS if ( ps->evs_compat_mode == false ) { @@ -1257,9 +1179,7 @@ static bool shrink_frm( xtract -= ps->l_ts; } } - else -#endif - if ( maxScaling != 0U && s_end > maxScaling + 1 ) + else if ( maxScaling != 0U && s_end > maxScaling + 1 ) { xtract = maxScaling; } @@ -1315,18 +1235,14 @@ static bool shrink_frm( { return 1; } -#ifdef JBM_TSM_ON_TCS if ( ps->evs_compat_mode == true ) { overlapAddEvs( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); } else { -#endif overlapAdd( frm_in, frm_in + xtract, frm_out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); -#ifdef JBM_TSM_ON_TCS } -#endif } else { @@ -1373,13 +1289,8 @@ static bool shrink_frm( */ static bool extend_frm( apa_state_t *ps, -#ifdef JBM_TSM_ON_TCS const float frm_in[], float frm_out[], -#else - const int16_t frm_in[], - int16_t frm_out[], -#endif uint16_t *l_frm_out ) { bool findSynchResult = 0; @@ -1393,13 +1304,8 @@ static bool extend_frm( int16_t s_start = 0; float energy, quality = 0.0f; uint16_t l_frm, l_seg; -#ifdef JBM_TSM_ON_TCS const float *fadeOut, *fadeIn; float *out; -#else - const int16_t *fadeOut, *fadeIn; - int16_t *out; -#endif l_frm = ps->l_frm; @@ -1490,7 +1396,6 @@ static bool extend_frm( energy = -65; quality = 5; xtract[n] = s_start + ps->num_channels; -#ifdef JBM_TSM_ON_TCS if ( ps->evs_compat_mode == false ) { /* take renderer buffer samples into accout */ @@ -1498,7 +1403,6 @@ static bool extend_frm( /* snap to next renderer time slot border to resynchronize */ xtract[n] -= ( ( N - 1 ) * l_seg - xtract[n] + ps->l_r_buf ) % ps->l_ts; } -#endif } else { @@ -1555,29 +1459,20 @@ static bool extend_frm( fadeOut = frm_in + l_frm + xtract[n - 1] + l_seg; fadeIn = frm_in + l_frm + xtract[n]; out = frm_out + ( n - 2 ) * l_seg; -#ifdef JBM_TSM_ON_TCS if ( ps->evs_compat_mode == true ) { overlapAddEvs( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); } else { -#endif overlapAdd( fadeOut, fadeIn, out, l_seg, ps->num_channels, ps->win + ps->l_halfwin, ps->win ); -#ifdef JBM_TSM_ON_TCS } -#endif } else { /* just copy down 1st half of current segment (= 2nd half of previous segment) */ -#ifdef JBM_TSM_ON_TCS float *frm_out_ptr; const float *frm_in_ptr; -#else - int16_t *frm_out_ptr; - const int16_t *frm_in_ptr; -#endif frm_out_ptr = &( frm_out[( n - 2 ) * l_seg] ); frm_in_ptr = &( frm_in[l_frm + xtract[n]] ); for ( i = 0; i < l_seg; i++ ) diff --git a/lib_dec/jbm_pcmdsp_apa.h b/lib_dec/jbm_pcmdsp_apa.h index a5e7cb7d61ab0810bf36913fd761bc39946a8a00..74e6b59c6b6c06940d47a3a105ab91bcb792aac5 100644 --- a/lib_dec/jbm_pcmdsp_apa.h +++ b/lib_dec/jbm_pcmdsp_apa.h @@ -114,7 +114,6 @@ bool apa_set_rate( apa_state_t *ps, const int32_t output_Fs ); * @return 0 on success, 1 on failure */ bool apa_set_scale( apa_state_t *s, uint16_t scale ); -#ifdef JBM_TSM_ON_TCS bool apa_set_renderer_granularity( apa_state_t *ps, uint16_t l_ts ); bool apa_set_renderer_residual_samples( apa_state_t *ps, uint16_t l_r_buf ); @@ -122,7 +121,6 @@ bool apa_set_renderer_residual_samples( apa_state_t *ps, uint16_t l_r_buf ); bool apa_set_evs_compat_mode( apa_state_t *ps, bool mode ); uint8_t apa_reconfigure( apa_state_t *ps, uint16_t num_channels, uint16_t l_ts ); -#endif bool apa_set_complexity_options( apa_state_t *s, uint16_t wss, uint16_t css ); @@ -130,10 +128,6 @@ bool apa_set_quality( apa_state_t *s, float quality, uint16_t qualityred, uint16 bool apa_exit( apa_state_t **s ); -#ifdef JBM_TSM_ON_TCS uint8_t apa_exec( apa_state_t *s, const float a_in[], uint16_t l_in, uint16_t maxScaling, float a_out[], uint16_t *l_out ); -#else -uint8_t apa_exec( apa_state_t *s, const int16_t a_in[], uint16_t l_in, uint16_t maxScaling, int16_t a_out[], uint16_t *l_out ); -#endif #endif /* JBM_PCMDSP_APA_H */ diff --git a/lib_dec/jbm_pcmdsp_fifo.c b/lib_dec/jbm_pcmdsp_fifo.c index 108b069402b473d58ae07320601c881e52cad8c4..a3e893646442922769dcbccb395f3dd9d21f8c4f 100644 --- a/lib_dec/jbm_pcmdsp_fifo.c +++ b/lib_dec/jbm_pcmdsp_fifo.c @@ -175,7 +175,6 @@ int16_t pcmdsp_fifo_write( return 0; } -#ifdef JBM_TSM_ON_TCS #ifdef DEBUGGING /* Writes the given audio data to the FIFO. */ int16_t pcmdsp_fifo_write_zero( @@ -218,7 +217,6 @@ int16_t pcmdsp_fifo_write_zero( return 0; } #endif -#endif /* Reads the given number of audio samples from the FIFO. */ int16_t pcmdsp_fifo_read( diff --git a/lib_dec/jbm_pcmdsp_fifo.h b/lib_dec/jbm_pcmdsp_fifo.h index d16bd2b8d25439384c73cebf450fabc16c247f53..b601cc2e0e0001aba14c562a3b36f3447e124e27 100644 --- a/lib_dec/jbm_pcmdsp_fifo.h +++ b/lib_dec/jbm_pcmdsp_fifo.h @@ -74,11 +74,9 @@ ivas_error pcmdsp_fifo_init( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, int16_t pcmdsp_fifo_write( PCMDSP_FIFO_HANDLE h, const uint8_t *samples, uint16_t nSamplesPerChannel ); -#ifdef JBM_TSM_ON_TCS #ifdef DEBUGGING int16_t pcmdsp_fifo_write_zero( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel ); #endif -#endif int16_t pcmdsp_fifo_read( PCMDSP_FIFO_HANDLE h, uint16_t nSamplesPerChannel, uint8_t *samples ); diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.c b/lib_dec/jbm_pcmdsp_similarityestimation.c index e83d1f7c3769ff944fd751760a0b61bc1b301f70..c67e71d5919c5dac58f0286a1b320188cb91511a 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.c +++ b/lib_dec/jbm_pcmdsp_similarityestimation.c @@ -52,11 +52,7 @@ /* Calculates cross correlation coefficient for template segment. */ float cross_correlation_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len ) @@ -67,11 +63,7 @@ float cross_correlation_self( c_c = 0.0f; for ( j = 0; j < corr_len; j++ ) { -#ifdef JBM_TSM_ON_TCS c_c += ( signal[j + x] * signal[j + y] ); -#else - c_c += ( (float) signal[j + x] * (float) signal[j + y] ); -#endif } return c_c; @@ -79,11 +71,7 @@ float cross_correlation_self( /* Calculates cross correlation coefficient for template segment. */ float cross_correlation_subsampled_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -95,11 +83,7 @@ float cross_correlation_subsampled_self( c_c = 0.0f; for ( j = 0; j < corr_len; j += subsampling ) { -#ifdef JBM_TSM_ON_TCS c_c += ( signal[j + x] * signal[j + y] ); -#else - c_c += ( (float) signal[j + x] * (float) signal[j + y] ); -#endif } return c_c; @@ -108,11 +92,7 @@ float cross_correlation_subsampled_self( /* Calculates normalized cross correlation coefficient for template segment. */ float normalized_cross_correlation_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -122,11 +102,7 @@ float normalized_cross_correlation_self( float c_c; float energy_xy, energy_x, energy_y; uint16_t j; -#ifdef JBM_TSM_ON_TCS const float *signal_a, *signal_b; -#else - const int16_t *signal_a, *signal_b; -#endif c_c = 0.0f; energy_x = 0.0f; @@ -135,21 +111,11 @@ float normalized_cross_correlation_self( signal_b = &signal[y]; for ( j = 0; j < corr_len; j += subsampling ) { -#ifdef JBM_TSM_ON_TCS c_c += ( signal_a[j] * signal_b[j] ); energy_x += ( signal_a[j] ) * ( signal_a[j] ); energy_y += ( signal_b[j] ) * ( signal_b[j] ); -#else - c_c += ( (float) signal_a[j] * (float) signal_b[j] ); - energy_x += ( (float) signal_a[j] ) * ( (float) signal_a[j] ); - energy_y += ( (float) signal_b[j] ) * ( (float) signal_b[j] ); -#endif } -#ifdef JBM_TSM_ON_TCS energy_xy = sqrtf( energy_x * energy_y ); -#else - energy_xy = (float) sqrt( (float) energy_x * (float) energy_y ); -#endif if ( energy_xy < 1.0f ) { energy_xy = 1.0f; /* conceal silent frames */ @@ -164,11 +130,7 @@ float normalized_cross_correlation_self( /* Splits the signal into segments and checks if all of them have very low energy. */ bool isSilence( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint32_t len, uint32_t segments ) { @@ -183,11 +145,7 @@ bool isSilence( if ( ( i != 0U && i % samplesPerSegment == 0U ) || i + 1 == len ) { /* check energy of current segment */ -#ifdef JBM_TSM_ON_TCS energy = 10 * log10f( energy / (float) samplesPerSegment ); -#else - energy = 10 * (float) log10( energy / samplesPerSegment ); -#endif if ( energy > -65 ) { return false; diff --git a/lib_dec/jbm_pcmdsp_similarityestimation.h b/lib_dec/jbm_pcmdsp_similarityestimation.h index 44b4fd246a4d9881550107196c374923284a15c7..c944bc1f7be47a64780ec0f1eb8cc0e5527e0659 100644 --- a/lib_dec/jbm_pcmdsp_similarityestimation.h +++ b/lib_dec/jbm_pcmdsp_similarityestimation.h @@ -68,11 +68,7 @@ ******************************************************************************** */ float cross_correlation_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len ); @@ -103,11 +99,7 @@ float cross_correlation_self( ******************************************************************************** */ float cross_correlation_subsampled_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -150,11 +142,7 @@ float cross_correlation_subsampled_self( ******************************************************************************** */ float normalized_cross_correlation_self( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint16_t x, uint16_t y, uint16_t corr_len, @@ -163,11 +151,7 @@ float normalized_cross_correlation_self( /* Splits the signal into segments and checks if all of them have very low energy. */ bool isSilence( -#ifdef JBM_TSM_ON_TCS const float *signal, -#else - const int16_t *signal, -#endif uint32_t len, uint32_t segments ); diff --git a/lib_dec/jbm_pcmdsp_window.c b/lib_dec/jbm_pcmdsp_window.c index a31d368c9119d1d35361c9657998fba14d24dff5..15f692fb8a1900a5bf15b44a1a3f78d5ef36ebf4 100644 --- a/lib_dec/jbm_pcmdsp_window.c +++ b/lib_dec/jbm_pcmdsp_window.c @@ -80,15 +80,9 @@ void hannWindow( *-----------------------------------------------------------------------*/ void overlapAdd( -#ifdef JBM_TSM_ON_TCS const float *fadeOut, const float *fadeIn, float *out, -#else - const int16_t *fadeOut, - const int16_t *fadeIn, - int16_t *out, -#endif uint16_t n, uint16_t nChannels, const float *fadeOutWin, @@ -96,11 +90,7 @@ void overlapAdd( { float fdOutVal, fdInVal; int16_t i, j, hannIter; -#ifdef JBM_TSM_ON_TCS float combinedVal; -#else - int32_t combinedVal; -#endif for ( j = 0; j < nChannels; j++ ) { @@ -111,28 +101,8 @@ void overlapAdd( fdOutVal = fadeOut[i] * fadeOutWin[hannIter]; fdInVal = fadeIn[i] * fadeInWin[hannIter]; /* round combinedVal value (taking care of sign) */ -#ifdef JBM_TSM_ON_TCS combinedVal = fdInVal + fdOutVal; out[i] = combinedVal; -#else - combinedVal = (int32_t) ( ( fdInVal + fdOutVal ) + 0.5 ); - if ( fdInVal + fdOutVal < 0.0 ) - { - combinedVal = (int32_t) ( ( fdInVal + fdOutVal ) - 0.5 ); - } - - /* saturate value */ - if ( combinedVal > MAX16B ) - { - combinedVal = MAX16B; - } - else if ( combinedVal < MIN16B ) - { - combinedVal = MIN16B; - } - - out[i] = (int16_t) combinedVal; -#endif hannIter++; } } diff --git a/lib_dec/jbm_pcmdsp_window.h b/lib_dec/jbm_pcmdsp_window.h index 8c1823867a8fa5d614b1d73c64a0ff6cb4c06cca..b11decf11df74c99f9b411a2ad240938f94958f4 100644 --- a/lib_dec/jbm_pcmdsp_window.h +++ b/lib_dec/jbm_pcmdsp_window.h @@ -61,10 +61,6 @@ void hannWindow( uint16_t n, float *w ); * @param[in] nChannels number of channels * @param[in] fadeOutWin window for fade out * @param[in] fadeInWin window for fade in */ -#ifdef JBM_TSM_ON_TCS void overlapAdd( const float *fadeOut, const float *fadeIn, float *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); void overlapAddEvs( const float *fadeOut, const float *fadeIn, float *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); -#else -void overlapAdd( const int16_t *fadeOut, const int16_t *fadeIn, int16_t *out, uint16_t n, uint16_t nChannels, const float *fadeOutWin, const float *fadeInWin ); -#endif #endif /* JBM_PCMDSP_WINDOW_H */ diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c index fd33c411010fd697521351795c506ff4eb4415db..673c030abf98d68519da86e7a5511e0891968dea 100644 --- a/lib_dec/lib_dec.c +++ b/lib_dec/lib_dec.c @@ -55,11 +55,7 @@ struct IVAS_DEC_VOIP JB4_HANDLE hJBM; PCMDSP_APA_HANDLE hTimeScaler; uint16_t lastDecodedWasActive; -#ifdef JBM_TSM_ON_TCS - float *apaExecBuffer; /* Buffer for APA scaling */ -#else - int16_t *apaExecBuffer; /* Buffer for APA scaling */ -#endif + float *apaExecBuffer; /* Buffer for APA scaling */ JB4_DATAUNIT_HANDLE hCurrentDataUnit; /* Points to the currently processed data unit */ uint16_t *bs_conversion_buf; /* Buffer for bitstream conversion from packed to serial */ #ifdef VARIABLE_SPEED_DECODING @@ -67,14 +63,10 @@ struct IVAS_DEC_VOIP uint16_t speedFac; bool needNewFrame; #endif -#ifdef JBM_TSM_ON_TCS JBM_RENDERER_TYPE rendererType; PCMDSP_FIFO_HANDLE hFifoOut; uint8_t nTransportChannelsOld; uint16_t nSamplesAvailableNext; -#else - PCMDSP_FIFO_HANDLE hFifoAfterTimeScaler; -#endif #ifdef SUPPORT_JBM_TRACEFILE IVAS_JBM_TRACE_DATA JbmTraceData; #endif @@ -109,18 +101,9 @@ static void IVAS_DEC_Close_VoIP( IVAS_DEC_VOIP *hVoIP ); #ifdef SUPPORT_JBM_TRACEFILE static void store_JbmData( IVAS_DEC_VOIP *hVoIP, JB4_DATAUNIT_HANDLE dataUnit, const uint32_t systemTimestamp_ms, const uint16_t extBufferedSamples, const int32_t output_Fs ); #endif -#ifdef JBM_TSM_ON_TCS static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, float *floatBuf, int16_t *pcmBuf ); -#else -static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, int16_t *pcmBuf ); -#endif static ivas_error input_format_API_to_internal( IVAS_DEC_INPUT_FORMAT input_format, int16_t *bitstream_format_internal, int16_t *sdp_hf_only, const bool is_voip_enabled ); -#ifdef FIX_439_OTR_PARAMS static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig ); -#else -static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig, const int16_t orientation_tracking ); -#endif -#ifdef JBM_TSM_ON_TCS static int16_t IVAS_DEC_VoIP_GetRenderGranularity( Decoder_Struct *st_ivas ); static JBM_RENDERER_TYPE IVAS_DEC_VoIP_GetRendererConfig( IVAS_DEC_HANDLE hIvasDec ); static ivas_error IVAS_DEC_VoIP_reconfigure( IVAS_DEC_HANDLE hIvasDec, const uint16_t nTransportChannels, const uint16_t l_ts ); @@ -129,7 +112,6 @@ static ivas_error IVAS_DEC_GetTcSamples( IVAS_DEC_HANDLE hIvasDec, float *pcmBuf static ivas_error IVAS_DEC_RendererFeedTcSamples( IVAS_DEC_HANDLE hIvasDec, const int16_t nSamplesForRendering, int16_t *nSamplesResidual, float *pcmBuf ); static ivas_error IVAS_DEC_GetRenderedSamples( IVAS_DEC_HANDLE hIvasDec, const uint16_t nSamplesForRendering, uint16_t *nSamplesRendered, uint16_t *nSamplesAvailableNext, int16_t *pcmBuf ); static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, int16_t *nSamplesBuffered ); -#endif /*---------------------------------------------------------------------* * IVAS_DEC_Open() @@ -141,10 +123,6 @@ static ivas_error IVAS_DEC_GetBufferedNumberOfSamples( IVAS_DEC_HANDLE hIvasDec, ivas_error IVAS_DEC_Open( IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ const IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */ -#ifndef FIX_439_OTR_PARAMS - , - const int16_t orientation_tracking /* i : orientation tracking type */ -#endif ) { IVAS_DEC_HANDLE hIvasDec; @@ -198,11 +176,7 @@ ivas_error IVAS_DEC_Open( st_ivas = hIvasDec->st_ivas; /* initialize Decoder Config. handle */ -#ifdef FIX_439_OTR_PARAMS init_decoder_config( hIvasDec->st_ivas->hDecoderConfig ); -#else - init_decoder_config( hIvasDec->st_ivas->hDecoderConfig, orientation_tracking ); -#endif /* initialize pointers to handles to NULL */ ivas_initialize_handles_dec( st_ivas ); @@ -231,9 +205,6 @@ ivas_error IVAS_DEC_Open( st_ivas->writeFECoffset = 0; st_ivas->ism_mode = ISM_MODE_NONE; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = SBA_MODE_NONE; -#endif st_ivas->mc_mode = MC_MODE_NONE; st_ivas->sba_order = 0; @@ -255,10 +226,6 @@ ivas_error IVAS_DEC_Open( static void init_decoder_config( DECODER_CONFIG_HANDLE hDecoderConfig /* i/o: configuration structure */ -#ifndef FIX_439_OTR_PARAMS - , - const int16_t orientation_tracking -#endif ) { hDecoderConfig->Opt_AMR_WB = 0; @@ -268,21 +235,13 @@ static void init_decoder_config( hDecoderConfig->Opt_HRTF_binary = 0; hDecoderConfig->Opt_Headrotation = 0; hDecoderConfig->Opt_RendConfigCustom = 0; -#ifdef FIX_439_OTR_PARAMS hDecoderConfig->orientation_tracking = HEAD_ORIENT_TRK_NONE; -#else - hDecoderConfig->orientation_tracking = orientation_tracking; -#endif hDecoderConfig->Opt_non_diegetic_pan = 0; hDecoderConfig->non_diegetic_pan_gain = 0; -#ifdef JBM_TSM_ON_TCS hDecoderConfig->voip_active = 0; -#endif -#ifdef FIX_356_ISM_METADATA_SYNC hDecoderConfig->Opt_delay_comp = 0; -#endif return; } @@ -439,23 +398,17 @@ static IVAS_DEC_BS_FORMAT mapIvasFormat( *---------------------------------------------------------------------*/ ivas_error IVAS_DEC_Configure( - IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ - const uint32_t sampleRate, /* i : output sampling frequency */ - const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ - const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ - const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ - const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ -#ifdef FIX_439_OTR_PARAMS + IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ + const uint32_t sampleRate, /* i : output sampling frequency */ + const IVAS_DEC_AUDIO_CONFIG outputFormat, /* i : output format */ + const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ + const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ + const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ const HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ -#endif - const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ - const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ -#ifdef FIX_356_ISM_METADATA_SYNC - const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ - const int16_t delayCompensationEnabled /* i : enable delay compensation */ -#else - const float non_diegetic_pan_gain /* i : non diegetic panning gain */ -#endif + const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ + const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ + const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ + const int16_t delayCompensationEnabled /* i : enable delay compensation */ ) { Decoder_Struct *st_ivas; @@ -504,16 +457,12 @@ ivas_error IVAS_DEC_Configure( hDecoderConfig->Opt_LsCustom = customLsOutputEnabled; hDecoderConfig->Opt_Headrotation = enableHeadRotation; -#ifdef FIX_439_OTR_PARAMS hDecoderConfig->orientation_tracking = orientation_tracking; -#endif hDecoderConfig->Opt_HRTF_binary = hrtfReaderEnabled; hDecoderConfig->Opt_RendConfigCustom = renderConfigEnabled; hDecoderConfig->Opt_non_diegetic_pan = Opt_non_diegetic_pan; hDecoderConfig->non_diegetic_pan_gain = non_diegetic_pan_gain; -#ifdef FIX_356_ISM_METADATA_SYNC hDecoderConfig->Opt_delay_comp = delayCompensationEnabled; -#endif /* Set decoder parameters to initial values */ if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK ) @@ -553,10 +502,6 @@ ivas_error IVAS_DEC_EnableVoIP( error = IVAS_ERR_OK; -#ifndef JBM_TSM_ON_TCS - /* initialize time scaler and FIFO after time scaler */ - uint16_t wss, css; -#endif if ( hIvasDec == NULL || hIvasDec->st_ivas == NULL ) { @@ -566,17 +511,11 @@ ivas_error IVAS_DEC_EnableVoIP( hDecoderConfig = hIvasDec->st_ivas->hDecoderConfig; hIvasDec->Opt_VOIP = 1; -#ifdef JBM_TSM_ON_TCS hDecoderConfig->voip_active = 1; -#endif -#ifdef JBM_TSM_ON_TCS if ( hDecoderConfig->output_config != AUDIO_CONFIG_EXTERNAL ) { -#endif hDecoderConfig->nchan_out = audioCfg2channels( hDecoderConfig->output_config ); - -#ifdef JBM_TSM_ON_TCS } #ifdef VARIABLE_SPEED_DECODING else @@ -584,11 +523,7 @@ ivas_error IVAS_DEC_EnableVoIP( hDecoderConfig->nchan_out = 1; } #endif -#endif -#ifndef JBM_TSM_ON_TCS - assert( hDecoderConfig->nchan_out > 0 && "EXT output not yet supported in VoIP mode" ); -#endif if ( ( error = input_format_API_to_internal( inputFormat, &hIvasDec->bitstreamformat, &hIvasDec->sdp_hf_only, true ) ) != IVAS_ERR_OK ) { @@ -607,27 +542,14 @@ ivas_error IVAS_DEC_EnableVoIP( hIvasDec->hVoIP->speedFac = speedFac; hIvasDec->hVoIP->needNewFrame = false; #endif -#ifdef JBM_TSM_ON_TCS hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs / FRAMES_PER_SEC ); hIvasDec->hVoIP->nSamplesAvailableNext = 0; hIvasDec->hVoIP->rendererType = JBM_RENDERER_NONE; hIvasDec->hVoIP->hFifoOut = NULL; -#else - hIvasDec->hVoIP->nSamplesFrame = (uint16_t) ( hDecoderConfig->output_Fs * hDecoderConfig->nchan_out / FRAMES_PER_SEC ); -#endif -#ifdef JBM_TSM_ON_TCS /* postpone init of the buffers until we know the real number of TCs*/ hIvasDec->hVoIP->apaExecBuffer = NULL; hIvasDec->hVoIP->nTransportChannelsOld = 0; -#else - - hIvasDec->hVoIP->apaExecBuffer = malloc( sizeof( int16_t ) * APA_BUF_PER_CHANNEL * hDecoderConfig->nchan_out ); - if ( hIvasDec->hVoIP->apaExecBuffer == NULL ) - { - return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate VoIP handle" ); - } -#endif #define WMC_TOOL_SKIP /* Bitstream conversion is not counted towards complexity and memory usage */ @@ -656,34 +578,7 @@ ivas_error IVAS_DEC_EnableVoIP( #ifdef VARIABLE_SPEED_DECODING } #endif -#ifndef JBM_TSM_ON_TCS - if ( hDecoderConfig->output_Fs == 8000 ) - { - wss = 1; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 16000 ) - { - wss = 2; - css = 1; - } - else if ( hDecoderConfig->output_Fs == 32000 ) - { - wss = 4; - css = 2; - } - else if ( hDecoderConfig->output_Fs == 48000 ) - { - wss = 6; - css = 3; - } - else - { - return IVAS_ERR_INIT_ERROR; - } -#endif -#ifdef JBM_TSM_ON_TCS /* postpone init of time scaler and output FIFO until we know the real number of TCs */ hIvasDec->hVoIP->hTimeScaler = NULL; #ifdef VARIABLE_SPEED_DECODING @@ -691,36 +586,6 @@ ivas_error IVAS_DEC_EnableVoIP( { hIvasDec->hVoIP->needNewFrame = true; } -#endif -#else -#ifdef VARIABLE_SPEED_DECODING - { - float startQuality = hIvasDec->hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ? -2.0f : 1.0f; - if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, - hDecoderConfig->nchan_out ) != IVAS_ERR_OK || - apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || - apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || - apa_set_quality( hIvasDec->hVoIP->hTimeScaler, startQuality, 4, 4 ) != 0 || - pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != 0 || - pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != 0 ) - { - return IVAS_ERR_INIT_ERROR; - } - /* we instantly need a new frame */ - hIvasDec->hVoIP->needNewFrame = true; - } -#else - if ( apa_init( &hIvasDec->hVoIP->hTimeScaler, - hDecoderConfig->nchan_out ) != IVAS_ERR_OK || - apa_set_rate( hIvasDec->hVoIP->hTimeScaler, hDecoderConfig->output_Fs ) != 0 || - apa_set_complexity_options( hIvasDec->hVoIP->hTimeScaler, wss, css ) != 0 || - apa_set_quality( hIvasDec->hVoIP->hTimeScaler, 1, 4, 4 ) != 0 || - pcmdsp_fifo_create( &hIvasDec->hVoIP->hFifoAfterTimeScaler ) != IVAS_ERR_OK || - pcmdsp_fifo_init( hIvasDec->hVoIP->hFifoAfterTimeScaler, (uint16_t) ( hDecoderConfig->output_Fs * 4 / FRAMES_PER_SEC ) /* 4 frames */, hDecoderConfig->nchan_out, sizeof( int16_t ) ) != IVAS_ERR_OK ) - { - return IVAS_ERR_INIT_ERROR; - } -#endif #endif return error; @@ -849,11 +714,7 @@ ivas_error IVAS_DEC_GetSamples( if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = evs_dec_main( st_ivas, *nOutSamples, NULL, pcmBuf ) ) != IVAS_ERR_OK ) -#else - if ( ( error = evs_dec_main( st_ivas, *nOutSamples, pcmBuf ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -878,7 +739,6 @@ ivas_error IVAS_DEC_GetSamples( } -#ifdef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * IVAS_DEC_Setup( ) * @@ -902,7 +762,6 @@ static ivas_error IVAS_DEC_Setup( if ( hIvasDec->mode == IVAS_DEC_MODE_EVS ) { -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING if ( hIvasDec->st_ivas->renderer_type == RENDERER_NON_DIEGETIC_DOWNMIX ) { *nTransportChannels = MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; @@ -910,12 +769,9 @@ static ivas_error IVAS_DEC_Setup( } else { -#endif *nTransportChannels = 1; *nOutChannels = 1; -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING } -#endif } else { @@ -1096,7 +952,6 @@ ivas_error IVAS_DEC_GetBufferedNumberOfSamples( return error; } -#endif /*---------------------------------------------------------------------* @@ -1631,13 +1486,11 @@ ivas_error IVAS_DEC_GetDelay( nSamples[2] = (int16_t) roundf( (float) st_ivas->binaural_latency_ns * hDecoderConfig->output_Fs / 1000000000.f ); nSamples[0] = nSamples[1] + nSamples[2]; -#ifdef FIX_MASA_DELAY_PRINTOUT if ( st_ivas->ivas_format == MASA_FORMAT ) { /* note: in MASA, all delay is compensated at the decoder by default, so subtract the encoder delay for print-out */ nSamples[1] -= NS2SA( hDecoderConfig->output_Fs, IVAS_ENC_DELAY_NS ); } -#endif *timeScale = hDecoderConfig->output_Fs; @@ -1865,10 +1718,8 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ const uint32_t systemTimestamp_ms /* i : current system timestamp */ -#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) , uint16_t *sampleAvailableNext /* o : samples available for the next call */ -#endif #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, @@ -1888,12 +1739,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples( int16_t timeScalingDone; int16_t result; ivas_error error; -#ifdef JBM_TSM_ON_TCS int16_t nSamplesRendered; uint16_t nSamplesTcsScaled; uint8_t nTransportChannels; uint8_t nOutChannels; -#endif error = IVAS_ERR_OK; @@ -1902,32 +1751,22 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hVoIP = hIvasDec->hVoIP; timeScalingDone = 0; -#ifdef JBM_TSM_ON_TCS nOutChannels = (uint8_t) st_ivas->hDecoderConfig->nchan_out; nTransportChannels = 0; nSamplesTcsScaled = hVoIP->nSamplesFrame; nSamplesRendered = 0; -#endif #ifdef VARIABLE_SPEED_DECODING scale = hVoIP->speedFac; maxScaling = hVoIP->speedFac; #endif -#ifdef JBM_TSM_ON_TCS if ( ( hVoIP->hFifoOut != NULL && nSamplesPerChannel > hVoIP->hFifoOut->capacity ) || nSamplesPerChannel == 0 ) -#else - if ( nSamplesPerChannel > hVoIP->hFifoAfterTimeScaler->capacity || nSamplesPerChannel == 0 ) -#endif { return IVAS_ERR_WRONG_PARAMS; } /* make sure that the FIFO after decoder/scaler contains at least one sound card frame (i.e. 20ms) */ -#ifdef JBM_TSM_ON_TCS while ( ( hVoIP->hFifoOut != NULL && pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoOut ) < nSamplesPerChannel ) || ( hVoIP->hFifoOut == NULL && nSamplesRendered < nSamplesPerChannel ) ) -#else - while ( pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) < nSamplesPerChannel ) -#endif { #ifdef DEBUGGING #ifdef VARIABLE_SPEED_DECODING @@ -1940,7 +1779,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( #endif #endif -#ifdef JBM_TSM_ON_TCS if ( hVoIP->nSamplesAvailableNext == 0 ) { if ( hVoIP->hFifoOut ) @@ -1962,9 +1800,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } extBufferedSamples = nSamplesRendered + nSamplesBuffered; } -#else - extBufferedSamples = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); -#endif extBufferedTime_ms = extBufferedSamples * 1000 / hDecoderConfig->output_Fs; dataUnit = NULL; @@ -2033,7 +1868,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( if ( !hIvasDec->hasBeenFedFirstGoodFrame ) { /* codec mode to use not known yet - simply output silence */ -#ifdef JBM_TSM_ON_TCS nSamplesTcsScaled = hVoIP->nSamplesFrame; if ( hVoIP->hFifoOut != NULL ) { @@ -2051,14 +1885,10 @@ ivas_error IVAS_DEC_VoIP_GetSamples( set_s( pcmBuf, 0, nSamplesPerChannel * nOutChannels ); } nSamplesRendered = nSamplesTcsScaled; -#else - set_s( hVoIP->apaExecBuffer, 0, hVoIP->nSamplesFrame ); /* TODO(mcjbm): Could be optimized: just write directly to output buffer */ -#endif } else { -#ifdef JBM_TSM_ON_TCS uint16_t l_ts = 1; uint16_t nSamplesRendered_loop; @@ -2095,13 +1925,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( { return error; } - -#else - if ( ( error = IVAS_DEC_GetSamples( hIvasDec, hVoIP->apaExecBuffer, &nOutSamplesElse ) ) != IVAS_ERR_OK ) - { - return error; - } -#endif } #ifdef VARIABLE_SPEED_DECODING @@ -2140,46 +1963,21 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } /* apply time scaling on decoded/concealed samples */ -#ifdef JBM_TSM_ON_TCS if ( hIvasDec->hasBeenFedFirstGoodFrame ) { -#endif if ( apa_set_scale( hVoIP->hTimeScaler, (uint16_t) scale ) != 0 ) { return IVAS_ERR_UNKNOWN; } -#ifdef JBM_TSM_ON_TCS result = apa_exec( hVoIP->hTimeScaler, hVoIP->apaExecBuffer, hVoIP->nSamplesFrame * nTransportChannels, (uint16_t) maxScaling, hVoIP->apaExecBuffer, &nTimeScalerOutSamples ); -#else - result = apa_exec( hVoIP->hTimeScaler, hVoIP->apaExecBuffer, hVoIP->nSamplesFrame, (uint16_t) maxScaling, hVoIP->apaExecBuffer, &nTimeScalerOutSamples ); -#endif if ( result != 0 ) { return IVAS_ERR_UNKNOWN; } assert( nTimeScalerOutSamples <= APA_BUF ); -#ifdef JBM_TSM_ON_TCS nSamplesTcsScaled = nTimeScalerOutSamples / nTransportChannels; -#else - /* append scaled samples to FIFO */ - if ( pcmdsp_fifo_write( hVoIP->hFifoAfterTimeScaler, (uint8_t *) hVoIP->apaExecBuffer, (uint16_t) ( nTimeScalerOutSamples / hDecoderConfig->nchan_out ) ) != 0 ) - { - return IVAS_ERR_UNKNOWN; - } -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) - { - int16_t nSamplesAvailable = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); - if ( nSamplesAvailable < nSamplesPerChannel ) - { - hVoIP->needNewFrame = true; - } - } -#endif -#endif -#ifdef JBM_TSM_ON_TCS if ( hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->rendererType != JBM_RENDERER_NONE ) { /* render IVAS frames */ @@ -2211,7 +2009,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( nSamplesRendered = nSamplesTcsScaled; } } -#endif #ifdef SUPPORT_JBM_TRACEFILE /* jbmWriterFn and jbmWriter may be NULL if tracefile writing was not requested on CLI */ if ( jbmWriterFn != NULL && jbmWriter != NULL ) @@ -2225,7 +2022,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( } } #endif -#ifdef JBM_TSM_ON_TCS } if ( hIvasDec->hasBeenFedFirstGoodFrame && hVoIP->rendererType != JBM_RENDERER_NONE ) @@ -2286,40 +2082,18 @@ ivas_error IVAS_DEC_VoIP_GetSamples( hVoIP->nSamplesAvailableNext = 0; } -#endif } /* fetch a user-specified number of samples from FIFO */ -#if defined( JBM_TSM_ON_TCS ) if ( hVoIP->hFifoOut ) { if ( pcmdsp_fifo_read( hVoIP->hFifoOut, nSamplesPerChannel, (uint8_t *) pcmBuf ) != 0 ) -#else - if ( pcmdsp_fifo_read( hVoIP->hFifoAfterTimeScaler, nSamplesPerChannel, (uint8_t *) pcmBuf ) != 0 ) -#endif { return IVAS_ERR_UNKNOWN; } -#ifdef JBM_TSM_ON_TCS } -#endif -#if defined( JBM_TSM_ON_TCS ) || defined( VARIABLE_SPEED_DECODING ) -#ifdef JBM_TSM_ON_TCS *sampleAvailableNext = hVoIP->nSamplesAvailableNext; -#else - *sampleAvailableNext = max( 0, pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) ); -#ifdef VARIABLE_SPEED_DECODING - if ( hVoIP->mode == IVAS_DEC_VOIP_MODE_VARIABLE_SPEED ) - { - if ( *sampleAvailableNext < nSamplesPerChannel ) - { - hVoIP->needNewFrame = true; - } - } -#endif -#endif -#endif return error; } @@ -2330,7 +2104,6 @@ ivas_error IVAS_DEC_VoIP_GetSamples( * Function to flush remaining audio in VoIP *---------------------------------------------------------------------*/ -#if defined( VARIABLE_SPEED_DECODING ) || defined( JBM_TSM_ON_TCS ) ivas_error IVAS_DEC_VoIP_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ @@ -2341,41 +2114,24 @@ ivas_error IVAS_DEC_VoIP_Flush( { ivas_error error; IVAS_DEC_VOIP *hVoIP; -#ifdef JBM_TSM_ON_TCS int16_t rendererPcmBuf[( MAX_OUTPUT_CHANNELS * L_FRAME_MAX * APA_MAX_SCALE ) / 100]; uint16_t nSamplesToRender; uint16_t nSamplesFlushedLocal; -#endif error = IVAS_ERR_OK; hVoIP = hIvasDec->hVoIP; -#if defined( JBM_TSM_ON_TCS ) *nSamplesFlushed = min( nSamplesPerChannel, hVoIP->nSamplesAvailableNext ); -#else - *nSamplesFlushed = min( nSamplesPerChannel, pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ) ); -#endif -#ifdef JBM_TSM_ON_TCS if ( hVoIP->rendererType == JBM_RENDERER_NONE ) { -#endif /* fetch a user-specified number of samples from FIFO */ -#if defined( JBM_TSM_ON_TCS ) if ( pcmdsp_fifo_read( hVoIP->hFifoOut, *nSamplesFlushed, (uint8_t *) pcmBuf ) != 0 ) -#else - if ( pcmdsp_fifo_read( hVoIP->hFifoAfterTimeScaler, *nSamplesFlushed, (uint8_t *) pcmBuf ) != 0 ) -#endif { return IVAS_ERR_UNKNOWN; } -#if defined( JBM_TSM_ON_TCS ) hVoIP->nSamplesAvailableNext -= *nSamplesFlushed; *nSamplesAvailableNext = hVoIP->nSamplesAvailableNext; -#else - *nSamplesAvailableNext = pcmdsp_fifo_nReadableSamplesPerChannel( hVoIP->hFifoAfterTimeScaler ); -#endif -#ifdef JBM_TSM_ON_TCS } else { @@ -2399,11 +2155,9 @@ ivas_error IVAS_DEC_VoIP_Flush( *nSamplesAvailableNext = hVoIP->nSamplesAvailableNext; *nSamplesFlushed = (int16_t) nSamplesFlushedLocal; } -#endif return error; } -#endif /*---------------------------------------------------------------------* @@ -2414,17 +2168,10 @@ ivas_error IVAS_DEC_VoIP_Flush( bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ -#ifdef JBM_TSM_ON_TCS , - const int16_t nSamplesAsked -#endif -) + const int16_t nSamplesAsked ) { -#ifdef JBM_TSM_ON_TCS return ( ( JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0 ) && ( hIvasDec->hVoIP->nSamplesAvailableNext < nSamplesAsked ) ); -#else - return JB4_bufferedDataUnits( hIvasDec->hVoIP->hJBM ) == 0; -#endif } @@ -2465,11 +2212,7 @@ static void IVAS_DEC_Close_VoIP( apa_exit( &hVoIP->hTimeScaler ); -#ifdef JBM_TSM_ON_TCS pcmdsp_fifo_destroy( &hVoIP->hFifoOut ); -#else - pcmdsp_fifo_destroy( &hVoIP->hFifoAfterTimeScaler ); -#endif if ( hVoIP->apaExecBuffer != NULL ) { @@ -2768,7 +2511,6 @@ static ivas_error printConfigInfo_dec( fprintf( stdout, "Head rotation: ON\n" ); } -#ifdef FIX_439_OTR_PARAMS if ( st_ivas->hDecoderConfig->orientation_tracking != HEAD_ORIENT_TRK_NONE ) { switch ( st_ivas->hDecoderConfig->orientation_tracking ) @@ -2789,26 +2531,6 @@ static ivas_error printConfigInfo_dec( break; } } -#else - if ( st_ivas->hDecoderConfig->orientation_tracking != IVAS_ORIENT_TRK_NONE ) - { - switch ( st_ivas->hDecoderConfig->orientation_tracking ) - { - case IVAS_ORIENT_TRK_AVG: - fprintf( stdout, "Orientation tracking: AVG\n" ); - break; - case IVAS_ORIENT_TRK_REF: - fprintf( stdout, "Orientation tracking: REF\n" ); - break; - case IVAS_ORIENT_TRK_REF_VEC: - fprintf( stdout, "Orientation tracking: REF_VEC\n" ); - break; - case IVAS_ORIENT_TRK_REF_VEC_LEV: - fprintf( stdout, "Orientation tracking: REF_VEC_LEV\n" ); - break; - } - } -#endif if ( st_ivas->hDecoderConfig->Opt_non_diegetic_pan ) { @@ -2816,7 +2538,6 @@ static ivas_error printConfigInfo_dec( } } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------* * Print VoIP mode info *-----------------------------------------------------------------*/ @@ -2825,7 +2546,6 @@ static ivas_error printConfigInfo_dec( { fprintf( stdout, "VoIP mode: ON\n" ); } -#endif return IVAS_ERR_OK; } @@ -2925,18 +2645,14 @@ void IVAS_DEC_PrintDisclaimer( void ) static ivas_error evs_dec_main( Decoder_Struct *st_ivas, const int16_t nOutSamples, -#ifdef JBM_TSM_ON_TCS float *floatBuf, -#endif int16_t *pcmBuf ) { DEC_CORE_HANDLE *hCoreCoder; float output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN][L_FRAME48k]; float mixer_left, mixer_rigth; -#ifdef JBM_TSM_ON_TCS float *p_output[MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; int16_t ch; -#endif ivas_error error; error = IVAS_ERR_OK; @@ -2946,12 +2662,10 @@ static ivas_error evs_dec_main( mdct_switching_dec( hCoreCoder[0] ); -#ifdef JBM_TSM_ON_TCS for ( ch = 0; ch < MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN; ch++ ) { p_output[ch] = output[ch]; } -#endif /* run the main EVS decoding routine */ if ( hCoreCoder[0]->codec_mode == MODE1 ) @@ -3006,15 +2720,10 @@ static ivas_error evs_dec_main( v_multc( output[0], mixer_left, output[0], nOutSamples ); } -#ifdef JBM_TSM_ON_TCS if ( floatBuf != NULL ) { /* BE workaround */ -#ifdef FIX_473_JITTER_NONDIEGETIC_PANNING int16_t pcm_buf_local[L_FRAME48k * MAX_OUTPUT_CHANNELS_IN_DIEGETIC_PAN]; -#else - int16_t pcm_buf_local[L_FRAME48k]; -#endif /* convert 'float' output data to 'short' */ #ifdef DEBUGGING @@ -3025,18 +2734,11 @@ static ivas_error evs_dec_main( } else { -#endif #ifdef DEBUGGING st_ivas->noClipping += #endif -#ifdef JBM_TSM_ON_TCS ivas_syn_output( p_output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); -#else - ivas_syn_output( output, nOutSamples, st_ivas->hDecoderConfig->nchan_out, pcmBuf ); -#endif -#ifdef JBM_TSM_ON_TCS } -#endif return error; } @@ -3222,11 +2924,7 @@ static ivas_error input_format_API_to_internal( *sdp_hf_only = 1; break; default: -#ifdef FIX_510 return IVAS_ERR_INVALID_BITSTREAM; -#else - return IVAS_ERR_INVALID_INPUT_FORMAT; -#endif break; } @@ -3234,7 +2932,6 @@ static ivas_error input_format_API_to_internal( } -#ifdef JBM_TSM_ON_TCS /*---------------------------------------------------------------------* * IVAS_DEC_VoIP_GetRenderGranularity() * @@ -3397,4 +3094,3 @@ ivas_error IVAS_DEC_VoIP_reconfigure( return error; } -#endif diff --git a/lib_dec/lib_dec.h b/lib_dec/lib_dec.h index 0539d75188f6e5478e51dac2e26d177369ee6f3a..8d2159a71f6257eb6b1c4aa47f890dfb3a03e5a5 100644 --- a/lib_dec/lib_dec.h +++ b/lib_dec/lib_dec.h @@ -133,10 +133,6 @@ typedef ivas_error ( *JbmTraceFileWriterFn )( const void *data, void *writer ); ivas_error IVAS_DEC_Open( IVAS_DEC_HANDLE *phIvasDec, /* i/o: pointer to an IVAS decoder handle to be opened */ IVAS_DEC_MODE mode /* i : compatibility mode (EVS or IVAS) */ -#ifndef FIX_439_OTR_PARAMS - , - const int16_t orientation_tracking /* i : orientation tracking type */ -#endif ); /*! r: error code */ @@ -147,17 +143,11 @@ ivas_error IVAS_DEC_Configure( const int16_t customLsOutputEnabled, /* i : enable custom loudspeaker setup handle */ const int16_t hrtfReaderEnabled, /* i : enable HRTF binary file input */ const int16_t enableHeadRotation, /* i : enable head rotation for binaural output */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking, /* i : head orientation tracking type */ -#endif const int16_t renderConfigEnabled, /* i : enable Renderer config. file for binaural output */ const int16_t Opt_non_diegetic_pan, /* i : diegetic or not */ -#ifdef FIX_356_ISM_METADATA_SYNC const float non_diegetic_pan_gain, /* i : non diegetic panning gain */ const int16_t delayCompensationEnabled /* i : enable delay compensation */ -#else - const float non_diegetic_pan_gain /* i : non diegetic panning gain */ -#endif ); void IVAS_DEC_Close( @@ -242,17 +232,14 @@ ivas_error IVAS_DEC_VoIP_GetSamples( uint16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ int16_t *pcmBuf, /* i/o: buffer for decoded PCM output. The memory must already be allocated and be able to hold the expected number of output samples, based on frame size and number of output channels */ const uint32_t systemTimestamp_ms /* i : current system timestamp */ -#if defined( JBM_TSM_ON_TCS ) || defined(VARIABLE_SPEED_DECODING ) , uint16_t *sampleAvailableNext /* o : samples available for the next call */ -#endif #ifdef SUPPORT_JBM_TRACEFILE , JbmTraceFileWriterFn jbmWriterFn, void* jbmWriter #endif ); -#if defined( JBM_TSM_ON_TCS ) || defined(VARIABLE_SPEED_DECODING ) ivas_error IVAS_DEC_VoIP_Flush( IVAS_DEC_HANDLE hIvasDec, /* i/o: IVAS decoder handle */ const int16_t nSamplesPerChannel, /* i : number of samples per channel requested to be written to output buffer */ @@ -260,7 +247,6 @@ ivas_error IVAS_DEC_VoIP_Flush( uint16_t *nSamplesAvailableNext, /* o : number of samples still available */ int16_t *nSamplesFlushed /* o : number of samples flushed */ ); -#endif /* Setter functions - apply changes to decoder configuration */ @@ -386,10 +372,8 @@ ivas_error IVAS_DEC_GetPcmFrameSize( /*! r: true if decoder has no data in VoIP jitter buffer */ bool IVAS_DEC_VoIP_IsEmpty( IVAS_DEC_HANDLE hIvasDec /* i/o: IVAS decoder handle */ -#ifdef JBM_TSM_ON_TCS , const int16_t nSamplesAsked -#endif ); ivas_error IVAS_DEC_VoIP_Get_CA_offset( diff --git a/lib_enc/ivas_core_pre_proc_front.c b/lib_enc/ivas_core_pre_proc_front.c index 5f775d2403a18af76b8b74fc1d1816dfdf7c314d..3552ee779014b510ece46b739c455af32fead6ff 100644 --- a/lib_enc/ivas_core_pre_proc_front.c +++ b/lib_enc/ivas_core_pre_proc_front.c @@ -563,14 +563,10 @@ ivas_error pre_proc_front_ivas( if ( st->hFdCngEnc != NULL && ( st->ini_frame == 0 || last_element_brate != element_brate || st->last_bwidth != st->bwidth ) ) { -#ifdef FIX_443_FD_CNG_INIT int32_t total_brate; total_brate = ( element_mode == IVAS_SCE ) ? st->total_brate : st->bits_frame_nominal * FRAMES_PER_SEC; configureFdCngEnc( st->hFdCngEnc, max( st->input_bwidth, WB ), total_brate ); -#else - configureFdCngEnc( st->hFdCngEnc, max( st->input_bwidth, WB ), st->bits_frame_nominal * FRAMES_PER_SEC ); -#endif if ( hCPE != NULL ) { st->hFdCngEnc->hFdCngCom->CngBitrate = hCPE->element_brate - 1; diff --git a/lib_enc/ivas_cpe_enc.c b/lib_enc/ivas_cpe_enc.c index 5f19a5395af55a358fd8aafc4e25255acc3cf257..50be3467973a99aa9f7815bacc401c556035e181 100644 --- a/lib_enc/ivas_cpe_enc.c +++ b/lib_enc/ivas_cpe_enc.c @@ -333,12 +333,8 @@ ivas_error ivas_cpe_enc( if ( hCPE->element_mode == IVAS_CPE_DFT ) { - stereo_dft_hybrid_ITD_flag( hCPE->hStereoDft->hConfig, input_Fs -#ifdef HYBRID_ITD_MAX - , - hCPE->hStereoDft->hItd->hybrid_itd_max -#endif - ); + stereo_dft_hybrid_ITD_flag( hCPE->hStereoDft->hConfig, input_Fs, + hCPE->hStereoDft->hItd->hybrid_itd_max ); /* Time Domain ITD compensation using extrapolation */ #ifdef DEBUG_MODE_DFT @@ -467,11 +463,7 @@ ivas_error ivas_cpe_enc( { if ( hCPE->element_mode == IVAS_CPE_DFT || hCPE->element_mode == IVAS_CPE_TD ) { -#ifndef SBA_MODE_CLEAN_UP - 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 ); -#endif } } @@ -481,17 +473,9 @@ ivas_error ivas_cpe_enc( stereoFdCngCoherence( sts, hCPE->last_element_mode, fft_buff ); /* Reset metadata */ -#ifndef SBA_MODE_CLEAN_UP - if ( sts[0]->cng_sba_flag || ( ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) ) -#else if ( sts[0]->cng_sba_flag || ( ivas_format == SBA_FORMAT ) ) -#endif { -#ifndef SBA_MODE_CLEAN_UP - 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 ); -#endif } } diff --git a/lib_enc/ivas_dirac_enc.c b/lib_enc/ivas_dirac_enc.c index 5aa872e4341fc2928e2886dbd0fc839642eea62e..70cbbb2043af91c5de00bbb2a694923adb9fde7b 100644 --- a/lib_enc/ivas_dirac_enc.c +++ b/lib_enc/ivas_dirac_enc.c @@ -62,13 +62,7 @@ ivas_error ivas_dirac_enc_open( ) { int16_t i, j; -#ifndef SBA_MODE_CLEAN_UP - int32_t input_Fs; -#endif DIRAC_ENC_HANDLE hDirAC; -#ifndef SBA_MODE_CLEAN_UP - IVAS_FB_CFG *fb_cfg; -#endif int32_t dirac_slot_ns; ivas_error error; @@ -83,7 +77,6 @@ ivas_error ivas_dirac_enc_open( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC Config\n" ) ); } -#ifdef FIX_485_STATIC_BUFFERS hDirAC->firstrun_sector_params = 1; set_zero( hDirAC->sec_I_vec_smth_x[0], NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); set_zero( hDirAC->sec_I_vec_smth_y[0], NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); @@ -91,15 +84,11 @@ ivas_error ivas_dirac_enc_open( set_zero( hDirAC->azi_prev, NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); set_zero( hDirAC->ele_prev, NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); set_zero( hDirAC->energy_smth[0], NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS ); -#endif /*-----------------------------------------------------------------* * DirAC main configuration *-----------------------------------------------------------------*/ st_ivas->hDirAC = hDirAC; -#ifndef SBA_MODE_CLEAN_UP - input_Fs = st_ivas->hEncoderConfig->input_Fs; -#endif if ( ( error = ivas_dirac_config( (void *) st_ivas, ENC ) ) != IVAS_ERR_OK ) { @@ -107,29 +96,7 @@ ivas_error ivas_dirac_enc_open( } /* set FB config. */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { -#endif - hDirAC->hFbMixer = NULL; -#ifndef SBA_MODE_CLEAN_UP - } - else - { - if ( ( error = ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_DIRAC, - FOA_CHANNELS, - 0, 0, input_Fs, - FOA_CHANNELS ) ) != IVAS_ERR_OK ) - { - return error; - } - /* Allocate and initialize FB mixer handle */ - if ( ( error = ivas_FB_mixer_open( &( hDirAC->hFbMixer ), input_Fs, fb_cfg, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - } -#endif + hDirAC->hFbMixer = NULL; for ( i = 0; i < DIRAC_MAX_NBANDS + 1; i++ ) { @@ -139,30 +106,6 @@ ivas_error ivas_dirac_enc_open( dirac_slot_ns = DIRAC_SLOT_ENC_NS; /* initialize delay for SPAR/DirAC delay synchronization */ -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_DIRAC ) - { - hDirAC->num_samples_synchro_delay = NS2SA( input_Fs, IVAS_FB_ENC_DELAY_NS ); - - for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) - { - if ( ( hDirAC->sba_synchro_buffer[i] = (float *) malloc( hDirAC->num_samples_synchro_delay * sizeof( float ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for DirAC\n" ) ); - } - set_zero( hDirAC->sba_synchro_buffer[i], hDirAC->num_samples_synchro_delay ); - } - } - else - { - hDirAC->num_samples_synchro_delay = 0; - - for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) - { - hDirAC->sba_synchro_buffer[i] = NULL; - } - } -#endif /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) @@ -218,15 +161,7 @@ ivas_error ivas_dirac_enc_open( hDirAC->index_buffer_intensity = 0; st_ivas->hDirAC = hDirAC; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) - { - mvs2s( st_ivas->hDirAC->dirac_to_spar_md_bands, st_ivas->hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); -#endif - st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; -#ifndef SBA_MODE_CLEAN_UP - } -#endif + st_ivas->hSpar->enc_param_start_band = st_ivas->hDirAC->hConfig->enc_param_start_band; return error; } @@ -299,16 +234,6 @@ void ivas_dirac_enc_close( { ivas_FB_mixer_close( &hDirAC->hFbMixer, input_Fs, 0 ); } -#ifndef SBA_MODE_CLEAN_UP - for ( i = 0; i < DIRAC_MAX_ANA_CHANS; i++ ) - { - if ( hDirAC->sba_synchro_buffer[i] != NULL ) - { - free( hDirAC->sba_synchro_buffer[i] ); - hDirAC->sba_synchro_buffer[i] = NULL; - } - } -#endif /* intensity 3-dim */ for ( i = 0; i < DIRAC_NUM_DIMS; i++ ) { @@ -349,220 +274,6 @@ void ivas_dirac_enc_close( return; } -#ifndef SBA_MODE_CLEAN_UP -/*------------------------------------------------------------------------- - * ivas_dirac_enc() - * - * DirAC Encoder - * - * input-data in data_f[] is assumed to be in ACN ordering, i.e. - * data_f[0] --> W - * data_f[1] --> Y - * data_f[2] --> Z - * data_f[3] --> X - *------------------------------------------------------------------------*/ - -void ivas_dirac_enc( - DIRAC_ENC_HANDLE hDirAC, /* i/o: encoder DirAC handle */ - IVAS_QMETADATA_HANDLE hQMetaData, /* i/o: q_metadata handle */ - BSTR_ENC_HANDLE hMetaData, /* i/o: Metadata bitstream handle */ - int16_t *nb_bits_metadata, /* o : number of metadata bits written */ - const int16_t Opt_DTX_ON, /* i : flag signaling DTX on */ - float data_f[][L_FRAME48k], /* i/o: SBA channels */ - const int16_t input_frame, /* i : input frame length */ - const int16_t sba_planar /* i : SBA planar flag */ -) -{ - int16_t i; - - push_wmops( "ivas_dirac_enc" ); - - /*Check if highest band of input signal <= enc_param_start_band: could happen for WB input signal in 4TCs mode*/ - if ( hDirAC->band_grouping[hDirAC->hConfig->nbands] <= hDirAC->band_grouping[hDirAC->hConfig->enc_param_start_band] ) - { - /* Signal 4 bands (WB 4TC mode) on 1 bit */ - push_next_indice( hMetaData, 1, 1 ); - *nb_bits_metadata = hMetaData->nb_bits_tot; - } - else - { - /* WB 4TC mode bit */ - push_next_indice( hMetaData, 0, 1 ); - - /* parameter estimation */ - if ( sba_planar ) - { - /* Z is forced to zero in planar case */ - set_zero( data_f[2], input_frame ); - } - - ivas_dirac_param_est_enc( hDirAC, &( hQMetaData->q_direction[0] ), hQMetaData->useLowerRes, data_f, NULL, NULL, input_frame, SBA_MODE_DIRAC, - 0, - FOA_CHANNELS ); - - /* encode parameters */ - if ( sba_planar || hQMetaData->useLowerRes ) - { - for ( i = hQMetaData->q_direction[0].cfg.start_band; i < hQMetaData->q_direction[0].cfg.nbands; i++ ) - { - /* Make sure elevation is really zero */ - set_zero( hQMetaData->q_direction[0].band_data[i].elevation, hQMetaData->q_direction[0].cfg.nblocks ); - } - } - - ivas_qmetadata_enc_encode( hMetaData, hQMetaData, - 0 ); - - *nb_bits_metadata = hMetaData->nb_bits_tot; - - if ( Opt_DTX_ON ) - { - if ( !( hQMetaData->no_directions == 1 && hQMetaData->numCodingBands == 5 ) ) - { - float orig_azi[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - float orig_ele[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - float orig_energy_ratio[DIRAC_MAX_NBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; - - float dir[3]; - float avg_dir[3]; - - float vecLen; - float energySum; - - int16_t j; - int16_t nbands; - - for ( i = 0; i < DIRAC_MAX_NBANDS; i++ ) - { - mvr2r( &hQMetaData->q_direction[0].band_data[i].azimuth[0], orig_azi[i], MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( &hQMetaData->q_direction[0].band_data[i].elevation[0], orig_ele[i], MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( &hQMetaData->q_direction[0].band_data[i].energy_ratio[0], orig_energy_ratio[i], MAX_PARAM_SPATIAL_SUBFRAMES ); - } - - /* Force to 5 bands */ - nbands = hQMetaData->q_direction[0].cfg.nbands; - hDirAC->hConfig->nbands = 5; - hQMetaData->q_direction[0].cfg.nbands = 5; - - /* compute directions */ - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - set_zero( dir, 3 ); - set_zero( avg_dir, 3 ); - energySum = 0.0f; - - /* average values over last two bands into 5th band */ - for ( j = DIRAC_MAX_NBANDS - 2; j < DIRAC_MAX_NBANDS; j++ ) - { - ivas_qmetadata_azimuth_elevation_to_direction_vector( hQMetaData->q_direction[0].band_data[j].azimuth[i], hQMetaData->q_direction[0].band_data[j].elevation[i], &dir[0] ); - vecLen = hQMetaData->q_direction[0].band_data[j].energy_ratio[i] * hDirAC->buffer_energy[i * DIRAC_MAX_NBANDS + j]; - - avg_dir[0] += dir[0] * vecLen; - avg_dir[1] += dir[1] * vecLen; - avg_dir[2] += dir[2] * vecLen; - - energySum += hDirAC->buffer_energy[i * DIRAC_MAX_NBANDS + j]; - } - - ivas_qmetadata_direction_vector_to_azimuth_elevation( &avg_dir[0], &hQMetaData->q_direction[0].band_data[DIRAC_MAX_NBANDS - 2].azimuth[i], &hQMetaData->q_direction[0].band_data[DIRAC_MAX_NBANDS - 2].elevation[i] ); - - hQMetaData->q_direction[0].band_data[DIRAC_MAX_NBANDS - 2].energy_ratio[i] = sqrtf( dotp( avg_dir, avg_dir, 3 ) ) / ( energySum + EPSILON ); - } - - /* encode SID parameters */ -#ifndef SBA_MODE_CLEAN_UP - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, SBA_MODE_DIRAC ); -#else - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT ); - -#endif - /* restore original metadata */ - hDirAC->hConfig->nbands = nbands; - hQMetaData->q_direction[0].cfg.nbands = nbands; - - for ( i = 0; i < DIRAC_MAX_NBANDS; i++ ) - { - mvr2r( orig_azi[i], &hQMetaData->q_direction[0].band_data[i].azimuth[0], MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( orig_ele[i], &hQMetaData->q_direction[0].band_data[i].elevation[0], MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( orig_energy_ratio[i], &hQMetaData->q_direction[0].band_data[i].energy_ratio[0], MAX_PARAM_SPATIAL_SUBFRAMES ); - } - } - else - { - /*indicate whether SPAR or DiRAC mode*/ - push_next_indice( hMetaData, 0, 1 ); - - /* encode SID parameters */ -#ifndef SBA_MODE_CLEAN_UP - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, SBA_MODE_DIRAC ); -#else - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT ); -#endif - } - } - } - - pop_wmops(); - - return; -} - - -/*------------------------------------------------------------------------- - * ivas_dirac_enc_spar_delay_synchro() - * - * Delay input channels to be synchronized between DirAC and SPAR - *-------------------------------------------------------------------------*/ - -void ivas_dirac_enc_spar_delay_synchro( - Encoder_Struct *st_ivas, /* i/o: IVAS encoder structure */ - const int16_t input_frame, /* i : input frame length */ - float data_f[][L_FRAME48k] /* i/o: SBA channels (ACN / SN3D) */ -) -{ - int16_t ch_idx; - float tmp_buffer[L_FRAME48k]; - Encoder_State *sts[MCT_MAX_BLOCKS]; - int16_t sce_id, cpe_id, i_chan; - - /* check last sba_mode */ - if ( ivas_sba_mode_select() == SBA_MODE_SPAR ) - { - /* initializations */ - i_chan = 0; - for ( sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - sts[sce_id] = st_ivas->hSCE[sce_id]->hCoreCoder[0]; - i_chan++; - } - - for ( cpe_id = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( int16_t ch = 0; ch < CPE_CHANNELS; ch++ ) - { - sts[i_chan] = st_ivas->hCPE[cpe_id]->hCoreCoder[ch]; - i_chan++; - } - } - - /* populate old synchro buffers */ - for ( ch_idx = 0; ch_idx < i_chan; ch_idx++ ) - { - mvr2r( sts[ch_idx]->input, st_ivas->hDirAC->sba_synchro_buffer[ch_idx], st_ivas->hDirAC->num_samples_synchro_delay ); - } - } - - for ( ch_idx = 0; ch_idx < DIRAC_MAX_ANA_CHANS; ch_idx++ ) - { - mvr2r( data_f[ch_idx], tmp_buffer, input_frame ); - mvr2r( st_ivas->hDirAC->sba_synchro_buffer[ch_idx], data_f[ch_idx], st_ivas->hDirAC->num_samples_synchro_delay ); - mvr2r( tmp_buffer, &data_f[ch_idx][st_ivas->hDirAC->num_samples_synchro_delay], input_frame - st_ivas->hDirAC->num_samples_synchro_delay ); - mvr2r( &tmp_buffer[input_frame - st_ivas->hDirAC->num_samples_synchro_delay], st_ivas->hDirAC->sba_synchro_buffer[ch_idx], st_ivas->hDirAC->num_samples_synchro_delay ); - } - - return; -} -#else /*------------------------------------------------------------------------- * ivas_dirac_enc() * @@ -676,7 +387,6 @@ void ivas_dirac_enc( return; } -#endif /*------------------------------------------------------------------------- * computeReferencePower_enc() @@ -691,12 +401,8 @@ void computeReferencePower_enc( float *reference_power, /* o : Estimated power */ const int16_t enc_param_start_band, /* i : first band to process */ const int16_t num_freq_bands, /* i : Number of frequency bands */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode /* i : SBA mode */ -#else - const IVAS_FORMAT ivas_format, /* i : ivas_format */ - int16_t ref_power_w /* i : use 0 if hodirac is enabled */ -#endif + const IVAS_FORMAT ivas_format, /* i : ivas_format */ + int16_t ref_power_w /* i : use 0 if hodirac is enabled */ , const int16_t nchan_ana /* i : number of analysis channels */ ) @@ -730,11 +436,7 @@ void computeReferencePower_enc( } v_multc( reference_power, 0.5f, reference_power, num_freq_bands ); -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT && ref_power_w == 1 ) -#endif { for ( i = 0; i < num_freq_bands; i++ ) { @@ -760,11 +462,7 @@ void ivas_dirac_param_est_enc( float **pp_fr_real, float **pp_fr_imag, const int16_t input_frame, -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, -#else const IVAS_FORMAT ivas_format, -#endif const int16_t hodirac_flag, const int16_t nchan_fb_in ) { @@ -873,12 +571,8 @@ void ivas_dirac_param_est_enc( reference_power[ts], hDirAC->hConfig->enc_param_start_band, num_freq_bands, -#ifndef SBA_MODE_CLEAN_UP - hodirac_flag ? SBA_MODE_DIRAC : sba_mode, -#else ivas_format, hodirac_flag ? 0 : 1, -#endif FOA_CHANNELS ); computeIntensityVector_enc( @@ -920,9 +614,7 @@ void ivas_dirac_param_est_enc( assert( l_ts <= DIRAC_NO_FB_BANDS_MAX ); #endif calculate_hodirac_sector_parameters( -#ifdef FIX_485_STATIC_BUFFERS hDirAC, -#endif Cldfb_RealBuffer, Cldfb_ImagBuffer, 0.20f, diff --git a/lib_enc/ivas_enc.c b/lib_enc/ivas_enc.c index 89a97ea0b079cfc7d8e906fed1665b7681df3dbe..66942eaec33f315cb49841feded0e8382402d294 100644 --- a/lib_enc/ivas_enc.c +++ b/lib_enc/ivas_enc.c @@ -132,11 +132,7 @@ ivas_error ivas_enc( /* bypass EVS coding in float precision, emulating EVS encoder/decoder delay */ for ( i = 0; i < n; i++ ) { -#ifndef SBA_MODE_CLEAN_UP - if ( ( ivas_format == SBA_FORMAT ) && ( st_ivas->sba_mode == SBA_MODE_SPAR ) && !( st_ivas->sba_analysis_order > 1 ) ) -#else if ( ( ivas_format == SBA_FORMAT ) && !( st_ivas->sba_analysis_order > 1 ) ) -#endif { hp20( data_f[HOA_keep_ind[st_ivas->hSpar->hMdEnc->HOA_md_ind[i]]], input_frame, st_ivas->mem_hp20_in[i], input_Fs ); } @@ -221,41 +217,20 @@ ivas_error ivas_enc( /* SBA/MASA metadata encoding and SBA/MASA metadata bitstream writing */ hMetaData = ( st_ivas->nSCE > 0 ) ? st_ivas->hSCE[st_ivas->nSCE - 1]->hMetaData : st_ivas->hCPE[st_ivas->nCPE - 1]->hMetaData; -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->hQMetaData != NULL && st_ivas->sba_mode != SBA_MODE_SPAR ) -#else if ( st_ivas->hQMetaData != NULL && ivas_format != SBA_FORMAT ) -#endif { -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_format == SBA_FORMAT ) + ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ + if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) { - ivas_dirac_enc( st_ivas->hDirAC, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], hEncoderConfig->Opt_DTX_ON, data_f, input_frame, hEncoderConfig->sba_planar ); - - ivas_dirac_enc_spar_delay_synchro( st_ivas, input_frame, data_f ); + return error; } - else + if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, + ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ) ) != IVAS_ERR_OK ) { -#endif - ivas_masa_estimate_energy( st_ivas->hMasa, data_f, input_frame, st_ivas->nchan_transport ); /* energy-estimation uses TF-resolution: 4x24 */ - if ( ( error = ivas_masa_enc_config( st_ivas ) ) != IVAS_ERR_OK ) - { - return error; - } - if ( ( error = ivas_masa_encode( st_ivas->hMasa, st_ivas->hQMetaData, hMetaData, &nb_bits_metadata[0], st_ivas->nchan_transport, ivas_format, - ivas_total_brate, hEncoderConfig->Opt_DTX_ON, st_ivas->nchan_transport == 2 ? st_ivas->hCPE[0]->element_mode : -1 ) ) != IVAS_ERR_OK ) - { - return error; - } -#ifndef SBA_MODE_CLEAN_UP + return error; } -#endif } -#ifndef SBA_MODE_CLEAN_UP - else if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else else if ( ivas_format == SBA_FORMAT ) -#endif { if ( ( error = ivas_spar_enc( st_ivas, data_f, input_frame, nb_bits_metadata, hMetaData ) ) != IVAS_ERR_OK ) { diff --git a/lib_enc/ivas_enc_cov_handler.c b/lib_enc/ivas_enc_cov_handler.c index 61c4ccaef9afc4edcd578f279edb6194c4781c6d..b40b9d1e42df198f27786ef1685aeb2458ab6cdd 100644 --- a/lib_enc/ivas_enc_cov_handler.c +++ b/lib_enc/ivas_enc_cov_handler.c @@ -68,10 +68,8 @@ ivas_error ivas_spar_covar_enc_open( const int32_t input_Fs, /* i : input sampling rate */ const int16_t nchan_inp /* i : number of input channels */ , -#ifdef FIX_489_COV_SMOOTHING COV_SMOOTHING_TYPE smooth_mode, /* i : Smooth covariance for SPAR or MC */ -#endif - const int32_t ivas_total_brate /* i : IVAS total bitrate */ + const int32_t ivas_total_brate /* i : IVAS total bitrate */ ) { ivas_enc_cov_handler_state_t *hCovState; @@ -88,25 +86,13 @@ ivas_error ivas_spar_covar_enc_open( cov_smooth_cfg.max_bands = IVAS_MAX_NUM_BANDS; cov_smooth_cfg.max_update_rate = MAX_UPDATE_RATE; cov_smooth_cfg.min_pool_size = MIN_POOL_SIZE; -#ifdef FIX_489_COV_SMOOTHING if ( smooth_mode == COV_SMOOTH_MC ) { cov_smooth_cfg.max_update_rate = 1.0f; cov_smooth_cfg.min_pool_size = 20; } -#else - if ( nchan_inp == 3 ) /* to discriminate between SPAR and mc there could be a better solution */ - { - cov_smooth_cfg.max_update_rate = 1.0f; - cov_smooth_cfg.min_pool_size = 20; - } -#endif -#ifdef FIX_489_COV_SMOOTHING if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_state, &cov_smooth_cfg, pFb, nchan_inp, smooth_mode, ivas_total_brate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_state, &cov_smooth_cfg, pFb, nchan_inp, ivas_total_brate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -114,11 +100,7 @@ ivas_error ivas_spar_covar_enc_open( cov_smooth_cfg.max_update_rate = MAX_UPDATE_RATE_DTX; cov_smooth_cfg.min_pool_size = MIN_POOL_SIZE_DTX; -#ifdef FIX_489_COV_SMOOTHING if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_dtx_state, &cov_smooth_cfg, pFb, nchan_inp, smooth_mode, ivas_total_brate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_covar_smooth_enc_open( &hCovState->pCov_dtx_state, &cov_smooth_cfg, pFb, nchan_inp, ivas_total_brate ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_entropy_coder.c b/lib_enc/ivas_entropy_coder.c index 830a05e41a3ce8c426c5f6def0012141c3d65904..32e55d85b7097771d3dd1816845dac0e732a7b4a 100644 --- a/lib_enc/ivas_entropy_coder.c +++ b/lib_enc/ivas_entropy_coder.c @@ -128,20 +128,12 @@ static ivas_error ivas_get_dyn_freq_model( * * Arith encoding of an array of symbols *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_arith_encode_array( -#else -static void ivas_arith_encode_array( -#endif int16_t *pInput, ivas_arith_t *pArith, BSTR_ENC_HANDLE hMetaData, - const int16_t in_len -#ifdef ARITH_HUFF_CODER_CHANGES - , - int32_t wc_strat_arith -#endif -) + const int16_t in_len, + int32_t wc_strat_arith ) { int16_t model_index, i, ind; int16_t *pCum_freq = NULL; @@ -152,12 +144,10 @@ static void ivas_arith_encode_array( if ( pArith->dyn_model_bits > 0 ) { ivas_get_dyn_freq_model( pInput, in_len, &model_index, pArith, &pCum_freq ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + pArith->dyn_model_bits ) > wc_strat_arith ) { return -1; } -#endif push_next_indice( hMetaData, model_index, pArith->dyn_model_bits ); } else @@ -172,27 +162,19 @@ static void ivas_arith_encode_array( ind = pInput[i] - pArith->vals[0]; ivas_ari_encode_14bits_ext( hMetaData, &as, ind, (const uint16_t *) pCum_freq ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( hMetaData->nb_bits_tot > wc_strat_arith ) { return -1; } -#endif } ivas_ari_done_encoding_14bits( hMetaData, &as ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( hMetaData->nb_bits_tot > wc_strat_arith ) { return -1; } -#endif } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -201,26 +183,16 @@ static void ivas_arith_encode_array( * * Differential arith encoding *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_arithCoder_encode_array_diff( -#else -static void ivas_arithCoder_encode_array_diff( -#endif ivas_arith_t *pArith_diff, int16_t *pIn_new, int16_t *pIn_old_scratch, const int16_t length, - BSTR_ENC_HANDLE hMetaData -#ifdef ARITH_HUFF_CODER_CHANGES - , - int32_t wc_strat_arith -#endif -) + BSTR_ENC_HANDLE hMetaData, + int32_t wc_strat_arith ) { int16_t n; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif if ( length > 0 ) { @@ -231,22 +203,14 @@ static void ivas_arithCoder_encode_array_diff( ivas_wrap_arround( pIn_old_scratch, pArith_diff->vals[0], pArith_diff->vals[pArith_diff->range - 1], length ); -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_array( pIn_old_scratch, pArith_diff, hMetaData, length, wc_strat_arith ); if ( arith_result < 0 ) { return -1; } -#else - ivas_arith_encode_array( pIn_old_scratch, pArith_diff, hMetaData, length ); -#endif } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -280,27 +244,17 @@ void ivas_huffman_encode( * * Arithmetic encode a cell array *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t arith_encode_cell_array( -#else -static void arith_encode_cell_array( -#endif ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, const int16_t nB, ivas_arith_t *pArith, - int16_t *pSymbol -#ifdef ARITH_HUFF_CODER_CHANGES - , - int32_t wc_strat_arith -#endif -) + int16_t *pSymbol, + int32_t wc_strat_arith ) { int16_t total_symbol_len = 0; int16_t i; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif for ( i = 0; i < nB; i++ ) { @@ -313,24 +267,16 @@ static void arith_encode_cell_array( { if ( pArith->range > 1 ) { -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_array( pSymbol, pArith, hMetaData, total_symbol_len, wc_strat_arith ); if ( arith_result < 0 ) { return -1; } -#else - ivas_arith_encode_array( pSymbol, pArith, hMetaData, total_symbol_len ); -#endif } } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -339,27 +285,17 @@ static void arith_encode_cell_array( * * Arithmetic encode a cell array - differential *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t arith_encode_cell_array_diff( -#else -static void arith_encode_cell_array_diff( -#endif const ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, int16_t nB, ivas_arith_t *pArith_diff, int16_t *pSymbol_old, - int16_t *pSymbol -#ifdef ARITH_HUFF_CODER_CHANGES - , - int32_t wc_strat_arith -#endif -) + int16_t *pSymbol, + int32_t wc_strat_arith ) { int16_t i, total_symbol_len; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif total_symbol_len = 0; for ( i = 0; i < nB; i++ ) @@ -373,24 +309,16 @@ static void arith_encode_cell_array_diff( { if ( pArith_diff->range > 1 ) { -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arithCoder_encode_array_diff( pArith_diff, pSymbol, pSymbol_old, total_symbol_len, hMetaData, wc_strat_arith ); if ( arith_result < 0 ) { return -1; } -#else - ivas_arithCoder_encode_array_diff( pArith_diff, pSymbol, pSymbol_old, total_symbol_len, hMetaData ); -#endif } } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -399,11 +327,7 @@ static void arith_encode_cell_array_diff( * * Arithmetic encode a cell array *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES int16_t ivas_arith_encode_cmplx_cell_array( -#else -void ivas_arith_encode_cmplx_cell_array( -#endif ivas_arith_t *pArith_re, ivas_arith_t *pArith_re_diff, const int16_t *pDo_diff, @@ -412,12 +336,8 @@ void ivas_arith_encode_cmplx_cell_array( int16_t *pSymbol_old_re, ivas_cell_dim_t *pCell_dims, BSTR_ENC_HANDLE hMetaData, - const int16_t any_diff -#ifdef ARITH_HUFF_CODER_CHANGES - , - int32_t wc_strat_arith -#endif -) + const int16_t any_diff, + int32_t wc_strat_arith ) { int16_t input_old[IVAS_MAX_INPUT_LEN]; int16_t input_new[IVAS_MAX_INPUT_LEN]; @@ -425,9 +345,7 @@ void ivas_arith_encode_cmplx_cell_array( ivas_cell_dim_t cell_dim[IVAS_MAX_NUM_BANDS], cell_dim_diff[IVAS_MAX_NUM_BANDS]; int16_t len, idx, i, j, idx1; int16_t total_len; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif idx1 = 0; if ( any_diff == 1 ) @@ -493,7 +411,6 @@ void ivas_arith_encode_cmplx_cell_array( }*/ #endif -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = arith_encode_cell_array( cell_dim, hMetaData, nB, pArith_re, input, wc_strat_arith ); if ( arith_result < 0 ) @@ -507,30 +424,17 @@ void ivas_arith_encode_cmplx_cell_array( { return -1; } -#else - arith_encode_cell_array( cell_dim, hMetaData, nB, pArith_re, input ); - - arith_encode_cell_array_diff( cell_dim_diff, hMetaData, nB, pArith_re_diff, input_old, input_new ); -#endif } else { -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = arith_encode_cell_array( pCell_dims, hMetaData, nB, pArith_re, pSymbol_re, wc_strat_arith ); if ( arith_result < 0 ) { return -1; } -#else - arith_encode_cell_array( pCell_dims, hMetaData, nB, pArith_re, pSymbol_re ); -#endif } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } diff --git a/lib_enc/ivas_init_enc.c b/lib_enc/ivas_init_enc.c index 5591b12f40c96ff715a073209ec6f12f2dc16d77..a69cc2d9fce58bb57181ef8dbe7f22e163e4cd97 100644 --- a/lib_enc/ivas_init_enc.c +++ b/lib_enc/ivas_init_enc.c @@ -355,14 +355,8 @@ ivas_error ivas_init_encoder( /* In IVAS, ensure that minimum coded bandwidth is WB */ hEncoderConfig->max_bwidth = max( hEncoderConfig->max_bwidth, WB ); } -#ifndef SBA_MODE_CLEAN_UP - hEncoderConfig->spar_reconfig_flag = 0; -#endif st_ivas->ism_mode = ISM_MODE_NONE; st_ivas->mc_mode = MC_MODE_NONE; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = SBA_MODE_NONE; -#endif st_ivas->nchan_transport = -1; @@ -517,23 +511,13 @@ ivas_error ivas_init_encoder( if ( ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = ivas_sba_mode_select(); -#endif st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, st_ivas->hEncoderConfig->sba_order ); -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) + if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) { -#endif - if ( ( error = ivas_spar_enc_open( st_ivas, 0 ) ) != IVAS_ERR_OK ) - { - return error; - } - -#ifndef SBA_MODE_CLEAN_UP + return error; } -#endif + if ( ( error = ivas_dirac_enc_open( st_ivas ) ) != IVAS_ERR_OK ) { return error; @@ -564,11 +548,7 @@ ivas_error ivas_init_encoder( reset_indices_enc( st_ivas->hSCE[sce_id]->hMetaData, MAX_BITS_METADATA ); #endif -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR && st_ivas->hEncoderConfig->Opt_DTX_ON ) -#else if ( ivas_format == SBA_FORMAT && st_ivas->hEncoderConfig->Opt_DTX_ON ) -#endif { st_ivas->hSCE[sce_id]->hCoreCoder[0]->dtx_sce_sba = 1; } diff --git a/lib_enc/ivas_ism_param_enc.c b/lib_enc/ivas_ism_param_enc.c index 24038448d9e0b77b595bdb283619d0ac1f1c9cb5..572a0f1802936a966eba0bfbfa7edded5e88fabc 100644 --- a/lib_enc/ivas_ism_param_enc.c +++ b/lib_enc/ivas_ism_param_enc.c @@ -299,13 +299,8 @@ ivas_error ivas_param_ism_enc_open( /* set FB config. */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, SBA_MODE_NONE, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, ISM_FORMAT, st_ivas->hEncoderConfig->nchan_inp, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c index 707e1b3397656913137b85d9a92f6c7041937509..802654c02c8cf1b0bc7d8355dc6e0ee9d3df119d 100644 --- a/lib_enc/ivas_masa_enc.c +++ b/lib_enc/ivas_masa_enc.c @@ -61,16 +61,7 @@ static int16_t encode_lfe_to_total_energy_ratio( MASA_ENCODER_HANDLE hMasa, BSTR static void reduce_metadata_further( MASA_ENCODER_HANDLE hMasa, IVAS_QMETADATA_HANDLE hqmetadata, const IVAS_FORMAT ivas_format ); -static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] -#ifdef HR_METADATA - , - const SPHERICAL_GRID_DATA *sphGrid -#ifdef FIX_505_MASA_SPHGRID_REUSE - , - const uint8_t useSphGrid -#endif -#endif -); +static void average_masa_metadata( MASA_METADATA_FRAME *masaMetadata, float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], const SPHERICAL_GRID_DATA *sphGrid, const uint8_t useSphGrid ); static void copy_masa_metadata_subframe( const MASA_METADATA_HANDLE hMetaFrom, const uint8_t sfFrom, MASA_METADATA_HANDLE hMetaTo, const uint8_t sfTo ); @@ -250,19 +241,15 @@ ivas_error ivas_masa_encode( mvr2r( hMasa->masaMetadata.directional_meta[i].azimuth[j], h_orig_metadata[i].azimuth[j], MASA_FREQUENCY_BANDS ); mvr2r( hMasa->masaMetadata.directional_meta[i].elevation[j], h_orig_metadata[i].elevation[j], MASA_FREQUENCY_BANDS ); mvr2r( hMasa->masaMetadata.directional_meta[i].energy_ratio[j], h_orig_metadata[i].energy_ratio[j], MASA_FREQUENCY_BANDS ); -#ifdef HR_METADATA mvs2s( (int16_t *) ( hMasa->masaMetadata.directional_meta[i].spherical_index[j] ), (int16_t *) ( h_orig_metadata[i].spherical_index[j] ), MASA_FREQUENCY_BANDS ); -#endif } } } -#ifdef HR_METADATA if ( ivas_format == MASA_FORMAT && ivas_total_brate >= IVAS_384k ) { hMasa->config.mergeRatiosOverSubframes = 0; } -#endif /* Combine frequency bands and sub-frames */ combine_freqbands_and_subframes( hMasa ); @@ -327,7 +314,6 @@ ivas_error ivas_masa_encode( } /* Encode metadata */ -#ifdef HR_METADATA if ( ivas_total_brate >= IVAS_384k ) { if ( ivas_total_brate >= IVAS_512k ) @@ -341,12 +327,9 @@ ivas_error ivas_masa_encode( } else { -#endif ivas_qmetadata_enc_encode( hMetaData, hQMetaData, 0 ); -#ifdef HR_METADATA } -#endif *nb_bits_metadata = hMetaData->nb_bits_tot; @@ -402,11 +385,7 @@ ivas_error ivas_masa_encode( free( h_orig_metadata ); -#ifndef SBA_MODE_CLEAN_UP - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, masa_sid_descriptor, ivas_format, SBA_MODE_NONE ); -#else ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, masa_sid_descriptor, ivas_format ); -#endif /* restore old values */ hMasa->config.numCodingBands = numCodingBands; @@ -507,16 +486,9 @@ ivas_error ivas_masa_enc_config( uint8_t coherencePresent; uint8_t isActualTwoDir; /* Flag to tell that when there are two directions present in metadata, they both contain meaningful information. */ int32_t ivas_total_brate; -#ifdef FIX_HBR_MASAMETA uint8_t maxBand; int16_t maxBin, sf; -#endif ivas_error error; -#ifdef HR_METADATA -#ifndef FIX_505_MASA_SPHGRID_REUSE - SPHERICAL_GRID_DATA *sphGrid; -#endif -#endif error = IVAS_ERR_OK; @@ -537,36 +509,11 @@ ivas_error ivas_masa_enc_config( if ( hMasa->data.sync_state.frame_mode == MASA_FRAME_1SF && hMasa->data.sync_state.prev_offset != 0 ) { -#ifdef HR_METADATA -#ifndef FIX_505_MASA_SPHGRID_REUSE - if ( ( sphGrid = (SPHERICAL_GRID_DATA *) malloc( sizeof( SPHERICAL_GRID_DATA ) ) ) == NULL ) - { - return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for MASA spherical grid\n" ) ); - } - - if ( ivas_total_brate == IVAS_512k ) - { - generate_gridEq( sphGrid ); - } - else - { - sphGrid->no_theta = 0; - } -#endif -#endif /* average over sub-frames */ - average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy -#ifdef HR_METADATA - , -#ifdef FIX_505_MASA_SPHGRID_REUSE + average_masa_metadata( &( hMasa->masaMetadata ), hMasa->data.energy, &( hMasa->data.Sph_Grid16 ), - ivas_total_brate == IVAS_512k ? TRUE : FALSE -#else - sphGrid -#endif -#endif - ); + ivas_total_brate == IVAS_512k ? TRUE : FALSE ); } /* Inspect metadata for parameter changes that affect coding. */ @@ -658,7 +605,6 @@ ivas_error ivas_masa_enc_config( ivas_set_qmetadata_maxbit_req( hQMetaData, ivas_format ); -#ifdef FIX_HBR_MASAMETA /* Find maximum band usable */ maxBin = (int16_t) ( st_ivas->hEncoderConfig->input_Fs * INV_CLDFB_BANDWIDTH ); maxBand = 0; @@ -706,9 +652,6 @@ ivas_error ivas_masa_enc_config( set_c( (int8_t *) hMasa->data.twoDirBands, 1, hMasa->config.numCodingBands ); } -#else - masa_sample_rate_band_correction( &( hMasa->config ), hMasa->data.band_mapping, hQMetaData, st_ivas->hEncoderConfig->input_Fs, NULL ); -#endif /* Transmit stereo signals using a mono downmix at lowest bitrates */ if ( ivas_format == MASA_FORMAT && st_ivas->nCPE == 1 && st_ivas->hCPE[0]->hStereoDft != NULL && st_ivas->hCPE[0]->hStereoDft->hConfig != NULL ) @@ -815,11 +758,7 @@ static void combine_freqbands_and_subframes( } } } -#ifdef FIX_HBR_MASAMETA if ( numCodingBands <= MAX_REDUCED_NBANDS ) -#else - if ( numCodingBands < MASA_FREQUENCY_BANDS ) -#endif { /* reduce metadata *frequency* resolution. time resolution is not touched */ for ( i = 0; i < numDirections; i++ ) @@ -1149,9 +1088,7 @@ static void move_metadata_to_qmetadata( hQMeta->q_direction[dir].band_data[band].azimuth[sf] = hMeta->directional_meta[dir].azimuth[sf][band]; hQMeta->q_direction[dir].band_data[band].elevation[sf] = hMeta->directional_meta[dir].elevation[sf][band]; hQMeta->q_direction[dir].band_data[band].energy_ratio[sf] = hMeta->directional_meta[dir].energy_ratio[sf][band]; -#ifdef HR_METADATA hQMeta->q_direction[dir].band_data[band].spherical_index[sf] = hMeta->directional_meta[dir].spherical_index[sf][band]; -#endif if ( hQMeta->q_direction[dir].coherence_band_data != NULL ) { hQMeta->q_direction[dir].coherence_band_data[band].spread_coherence[sf] = (uint8_t) roundf( hMeta->directional_meta[dir].spread_coherence[sf][band] * UINT8_MAX ); @@ -1839,16 +1776,9 @@ void ivas_masa_enc_reconfigure( static void average_masa_metadata( MASA_METADATA_FRAME *hMeta, - float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS] -#ifdef HR_METADATA - , - const SPHERICAL_GRID_DATA *Sph_Grid16 -#ifdef FIX_505_MASA_SPHGRID_REUSE - , - const uint8_t useSphGrid -#endif -#endif -) + float energy[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS], + const SPHERICAL_GRID_DATA *Sph_Grid16, + const uint8_t useSphGrid ) { int16_t i, j, k; float azi_rad, ele_rad; @@ -1895,17 +1825,11 @@ static void average_masa_metadata( j = 0; hMeta->directional_meta[i].azimuth[j][k] = atan2f( y_sum, x_sum ) / EVS_PI * 180.0f; hMeta->directional_meta[i].elevation[j][k] = atan2f( z_sum, sqrtf( x_sum * x_sum + y_sum * y_sum ) ) / EVS_PI * 180.0f; -#ifdef HR_METADATA -#ifdef FIX_505_MASA_SPHGRID_REUSE if ( useSphGrid == TRUE ) -#else - if ( Sph_Grid16->no_theta > 0 ) -#endif { hMeta->directional_meta[i].spherical_index[j][k] = index_theta_phi_16( &( hMeta->directional_meta[i].elevation[j][k] ), &( hMeta->directional_meta[i].azimuth[j][k] ), Sph_Grid16 ); } -#endif vec_len = sqrtf( x_sum * x_sum + y_sum * y_sum + z_sum * z_sum ); hMeta->directional_meta[i].energy_ratio[j][k] = vec_len / ( energy_sum + EPSILON ); @@ -2362,9 +2286,7 @@ static void masa_metadata_direction_alignment( { /* swap the metadata of the two directions in this TF-tile */ float tmp_val; -#ifdef FIX_HBR_MASAMETA uint16_t tmp_int_val; -#endif tmp_val = hMeta->directional_meta[0].azimuth[sf][band]; hMeta->directional_meta[0].azimuth[sf][band] = hMeta->directional_meta[1].azimuth[sf][band]; hMeta->directional_meta[1].azimuth[sf][band] = tmp_val; @@ -2372,11 +2294,9 @@ static void masa_metadata_direction_alignment( tmp_val = hMeta->directional_meta[0].elevation[sf][band]; hMeta->directional_meta[0].elevation[sf][band] = hMeta->directional_meta[1].elevation[sf][band]; hMeta->directional_meta[1].elevation[sf][band] = tmp_val; -#ifdef FIX_HBR_MASAMETA tmp_int_val = hMeta->directional_meta[0].spherical_index[sf][band]; hMeta->directional_meta[0].spherical_index[sf][band] = hMeta->directional_meta[1].spherical_index[sf][band]; hMeta->directional_meta[1].spherical_index[sf][band] = tmp_int_val; -#endif tmp_val = hMeta->directional_meta[0].energy_ratio[sf][band]; hMeta->directional_meta[0].energy_ratio[sf][band] = hMeta->directional_meta[1].energy_ratio[sf][band]; hMeta->directional_meta[1].energy_ratio[sf][band] = tmp_val; diff --git a/lib_enc/ivas_mc_param_enc.c b/lib_enc/ivas_mc_param_enc.c index ba746ff442f53d31a2d2a7e5f0797bae0f6b3fdf..2af0ee3c0420d84d75fe8de58de6e864ea1885d7 100644 --- a/lib_enc/ivas_mc_param_enc.c +++ b/lib_enc/ivas_mc_param_enc.c @@ -140,13 +140,8 @@ ivas_error ivas_param_mc_enc_open( hParamMC->dmx_factors = ivas_param_mc_conf[config_index].dmx_fac; /* set FB config. */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, SBA_MODE_DIRAC, nchan_inp, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, nchan_inp, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } diff --git a/lib_enc/ivas_mc_paramupmix_enc.c b/lib_enc/ivas_mc_paramupmix_enc.c index 272e3f817bace7f59ec381618420c0ebfe2ec7d1..500065c34700ac23892a774400d17a7542595352 100644 --- a/lib_enc/ivas_mc_paramupmix_enc.c +++ b/lib_enc/ivas_mc_paramupmix_enc.c @@ -184,13 +184,8 @@ ivas_error ivas_mc_paramupmix_enc_open( /* set FB config. */ /* need to set num output channels to a value > 0 to get pFb != NULL */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, SBA_MODE_SPAR, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, MC_FORMAT, MC_PARAMUPMIX_COMBINATIONS * MC_PARAMUPMIX_NCH, MC_PARAMUPMIX_COMBINATIONS, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -211,11 +206,7 @@ ivas_error ivas_mc_paramupmix_enc_open( for ( i = 0; i < MC_PARAMUPMIX_COMBINATIONS; i++ ) { /* Covariance handle */ -#ifdef FIX_489_COV_SMOOTHING if ( ( error = ivas_spar_covar_enc_open( &( hMCParamUpmix->hCovEnc[i] ), hMCParamUpmix->hFbMixer->pFb, input_Fs, MC_PARAMUPMIX_NCH + 1, COV_SMOOTH_MC, st_ivas->hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_covar_enc_open( &( hMCParamUpmix->hCovEnc[i] ), hMCParamUpmix->hFbMixer->pFb, input_Fs, MC_PARAMUPMIX_NCH + 1, st_ivas->hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -742,9 +733,7 @@ static void ivas_mc_paramupmix_param_est_enc( int16_t l_ts; int16_t b, i, j, ts, bnd; -#ifdef FIX_468_16KHZ_PUPMIX int16_t maxbands; -#endif int16_t transient_det[MC_PARAMUPMIX_COMBINATIONS][2]; int16_t transient_det_l[2], transient_det_r[2]; @@ -820,18 +809,11 @@ static void ivas_mc_paramupmix_param_est_enc( } ivas_enc_cov_handler_process( hMCParamUpmix->hCovEnc[b], pp_in_fr_real, pp_in_fr_imag, cov_real, cov_dtx_real, hMCParamUpmix->hFbMixer->pFb, 0, hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands, MC_PARAMUPMIX_NCH, 0 /*dtx_vad*/, transient_det[b], HOA_md_ind ); } -#ifdef FIX_468_16KHZ_PUPMIX maxbands = hMCParamUpmix->hFbMixer->pFb->filterbank_num_bands; for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) { for ( bnd = 0; bnd < maxbands; bnd++ ) { -#else - for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) - { - for ( bnd = 0; bnd < IVAS_MAX_NUM_BANDS; bnd++ ) - { -#endif rxy = hMCParamUpmix->cov_real[b][1][0][bnd]; ryy = hMCParamUpmix->cov_real[b][1][1][bnd]; cmat = rxy / ( ryy + EPSILON ); @@ -845,7 +827,6 @@ static void ivas_mc_paramupmix_param_est_enc( betas[b][bnd] = (float) 2.0 * wetaux; } } -#ifdef FIX_468_16KHZ_PUPMIX if ( maxbands < IVAS_MAX_NUM_BANDS ) { for ( b = 0; b < MC_PARAMUPMIX_COMBINATIONS; b++ ) @@ -857,6 +838,5 @@ static void ivas_mc_paramupmix_param_est_enc( } } } -#endif return; } diff --git a/lib_enc/ivas_mcmasa_enc.c b/lib_enc/ivas_mcmasa_enc.c index 09fe5e3f402fa864e908524cfa47c86c9bcdd574..398b975705a723147f4d09a82d6e1562de7d973a 100644 --- a/lib_enc/ivas_mcmasa_enc.c +++ b/lib_enc/ivas_mcmasa_enc.c @@ -188,13 +188,8 @@ ivas_error ivas_mcmasa_enc_open( } /* set FB config. */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfg, MASA_FORMAT, SBA_MODE_NONE, numAnalysisChannels, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfg, MASA_FORMAT, numAnalysisChannels, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -225,13 +220,8 @@ ivas_error ivas_mcmasa_enc_open( else { /* Allocate and initialize FB mixer handle for LFE channel */ -#ifndef SBA_MODE_CLEAN_UP - if ( ( error = ivas_fb_set_cfg( &fb_cfgLfe, MASA_FORMAT, SBA_MODE_NONE, 1, 0, 0, input_Fs, - 0 ) ) != IVAS_ERR_OK ) -#else if ( ( error = ivas_fb_set_cfg( &fb_cfgLfe, MASA_FORMAT, 1, 0, 0, input_Fs, 0 ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -987,12 +977,8 @@ void ivas_mcmasa_param_est_enc( reference_power[ts], 0, num_freq_bands, -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE_NONE, -#else MC_FORMAT, 0, -#endif FOA_CHANNELS ); /* Fill buffers of length "averaging_length" time slots for intensity and energy */ diff --git a/lib_enc/ivas_mct_core_enc.c b/lib_enc/ivas_mct_core_enc.c index 40153a3c69be115415439e11d2e3783fb5541ef5..5298e39f39c41401c8899a058247f941c9ef0dd7 100755 --- a/lib_enc/ivas_mct_core_enc.c +++ b/lib_enc/ivas_mct_core_enc.c @@ -264,10 +264,8 @@ void ivas_mct_core_enc( sp_aud_decision0[i] = hCPE[cpe_id]->hCoreCoder[0]->sp_aud_decision0; -#ifdef FIX_483b sts[i]->hTcxEnc->tns_ms_flag[0] = 0; sts[i]->hTcxEnc->tns_ms_flag[1] = 0; -#endif i++; } @@ -343,11 +341,7 @@ void ivas_mct_core_enc( for ( n = 0; n < nSubframes; n++ ) { -#ifdef FIX_483b if ( sts[ch]->hTcxEnc->tns_ms_flag[n] ) -#else - if ( !sts[ch]->hTcxEnc->fUseTns[n] /*!sts[0]->fUseTns[n] && !sts[1]->fUseTns[n]*/ ) -#endif { /* power spectrum: MDCT^2 + MDST^2 */ for ( i = 0; i < L_subframeTCX; i++ ) @@ -358,9 +352,7 @@ void ivas_mct_core_enc( } else { -#ifdef FIX_483b if ( hMCT->currBlockDataCnt > 0 ) -#endif { /* power spectrum: MDCT^2 + MDST^2 */ powerSpecMsInv[ch][n][0] = inv_spectrum[ch][n][0] * inv_spectrum[ch][n][0]; diff --git a/lib_enc/ivas_mct_enc.c b/lib_enc/ivas_mct_enc.c index 378bcb69105785a3063acc668e313925b5d2c808..20f5c9da291cd3ebc3795b1a27e75c6483a2ade3 100644 --- a/lib_enc/ivas_mct_enc.c +++ b/lib_enc/ivas_mct_enc.c @@ -60,12 +60,8 @@ static ivas_error ivas_mc_enc_reconfig( Encoder_Struct *st_ivas, const int16_t l static void set_mct_enc_params( MCT_ENC_HANDLE hMCT, /* i/o: MCT encoder structure */ const int32_t ivas_total_brate, /* i : IVAS total bitrate */ -#ifndef SBA_MODE_CLEAN_UP - const SBA_MODE sba_mode, /* i : SBA mode */ -#else - const IVAS_FORMAT ivas_format, /* i : IVAS_FORMAT */ -#endif - const uint16_t b_nchan_change /* i : flag indicating different channel count */ + const IVAS_FORMAT ivas_format, /* i : IVAS_FORMAT */ + const uint16_t b_nchan_change /* i : flag indicating different channel count */ ) { int16_t n; @@ -86,11 +82,7 @@ static void set_mct_enc_params( } hMCT->hbr_mct = 0; -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR && ivas_total_brate >= IVAS_256k ) -#else if ( ivas_format == SBA_FORMAT && ivas_total_brate >= IVAS_256k ) -#endif { hMCT->hbr_mct = 1; } @@ -399,11 +391,7 @@ ivas_error create_mct_enc( * Initializations *-----------------------------------------------------------------*/ -#ifndef SBA_MODE_CLEAN_UP - set_mct_enc_params( hMCT, ivas_total_brate, st_ivas->sba_mode, 1 ); -#else set_mct_enc_params( hMCT, ivas_total_brate, ivas_format, 1 ); -#endif st_ivas->hMCT = hMCT; @@ -569,11 +557,7 @@ ivas_error mct_enc_reconfigure( * Initializations *-----------------------------------------------------------------*/ -#ifndef SBA_MODE_CLEAN_UP - set_mct_enc_params( hMCT, ivas_total_brate, st_ivas->sba_mode, b_nchan_change ); -#else set_mct_enc_params( hMCT, ivas_total_brate, ivas_format, b_nchan_change ); -#endif return IVAS_ERR_OK; } diff --git a/lib_enc/ivas_mct_enc_mct.c b/lib_enc/ivas_mct_enc_mct.c index 50982e2e52f08ace13a7ef232d7bc34f4a3831d4..08ed294a56fc4c30fd649a2f5d011e7b3b42fa50 100755 --- a/lib_enc/ivas_mct_enc_mct.c +++ b/lib_enc/ivas_mct_enc_mct.c @@ -700,9 +700,7 @@ void apply_MCT_enc( { v_multc( sts[ch]->hTcxEnc->spectrum[k], qratio, sts[ch]->hTcxEnc->spectrum[k], L_subframeTCX ); v_multc( mdst_spectrum[ch][k], qratio, mdst_spectrum[ch][k], L_subframeTCX ); -#ifdef FIX_483b set_zero( inv_spectrum[ch][k], L_subframeTCX ); -#endif } hMCT->mc_global_ild[ch] = 0; } diff --git a/lib_enc/ivas_qmetadata_enc.c b/lib_enc/ivas_qmetadata_enc.c index 213c0ce7563047d24e60cf4e22cd565cb53fb588..26f46e943fa54bc7677b9710a2cbab20cc5cd9f9 100644 --- a/lib_enc/ivas_qmetadata_enc.c +++ b/lib_enc/ivas_qmetadata_enc.c @@ -60,12 +60,7 @@ static void ivas_qmetadata_reorder_2dir_bands( IVAS_QMETADATA_HANDLE hQMetaData static int16_t ivas_qmetadata_entropy_encode_df_ratio( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, int16_t *df_ratio_bits ); -static int16_t ivas_qmetadata_entropy_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, int16_t max_bits -#ifdef HR_METADATA - , - const int16_t hrmasa_flag -#endif -); +static int16_t ivas_qmetadata_entropy_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const uint16_t diffuseness_index_max_ec_frame, const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, int16_t max_bits, const int16_t hrmasa_flag ); static int16_t ivas_qmetadata_raw_encode_dir( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t nbands, const int16_t start_band ); @@ -93,21 +88,11 @@ static ivas_error write_ec_direction( int16_t *num_bits_written, BSTR_ENC_HANDLE static int16_t write_fixed_rate_direction( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, const int16_t j_idx, const int16_t len ); -static int16_t ivas_qmetadata_quantize_coherence( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t write_flag, int16_t *indice_coherence -#ifdef HR_METADATA - , - const int16_t hrmasa_flag -#endif -); +static int16_t ivas_qmetadata_quantize_coherence( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t write_flag, int16_t *indice_coherence, const int16_t hrmasa_flag ); static void dct4_transform( uint8_t *v, float *dct_v ); -static float quantize_DCT_0_coh( const float x, const int16_t j, const float *coherence_cb, const float delta_var, const int16_t no_cb, IVAS_QDIRECTION *q_direction, uint16_t *idx_x, int16_t *p_no_cb -#ifdef HR_METADATA - , - const int16_t hrmasa_flag -#endif -); +static float quantize_DCT_0_coh( const float x, const int16_t j, const float *coherence_cb, const float delta_var, const int16_t no_cb, IVAS_QDIRECTION *q_direction, uint16_t *idx_x, int16_t *p_no_cb, const int16_t hrmasa_flag ); static int16_t encode_coherence_indexesDCT0( uint16_t *idx_dct, const int16_t len, int16_t *no_cb_vec, BSTR_ENC_HANDLE hMetaData, const int16_t indice_coherence, const int16_t nbits, const int16_t nbits1 ); @@ -133,7 +118,6 @@ static void transform_azimuth_dir2( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *d static int16_t calc_var_azi( const IVAS_QDIRECTION *q_direction, const int16_t diffuseness_index_max_ec_frame, const float avg_azimuth, float *avg_azimuth_out ); -#ifdef HR_METADATA static void ivas_qmetadata_quantize_diffuseness_nrg_ratios_hr( IVAS_QMETADATA_HANDLE hQMetaData, int16_t *needed_bits, int16_t *nbits_diff, int16_t *dfRatioBits, const int16_t bits_dir_hr ); static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( BSTR_ENC_HANDLE hMetaData, IVAS_QDIRECTION *q_direction, uint16_t *diffuseness_index_max_ec_frame ); @@ -145,7 +129,6 @@ static int16_t encode_surround_coherence_hr( IVAS_QMETADATA *hQMetaData, BSTR_EN static void ivas_qmetadata_reorder_2dir_bands_hr( IVAS_QMETADATA_HANDLE hQMetaData ); static int16_t ivas_qmetadata_quantize_coherence_hr_512( IVAS_QMETADATA *hQMetaData, const int16_t idx_d, const int16_t all_coherence_zero, BSTR_ENC_HANDLE hMetaData, const int16_t bits_coh ); -#endif /*-----------------------------------------------------------------------* @@ -423,12 +406,8 @@ ivas_error ivas_qmetadata_enc_encode( if ( all_coherence_zero == 0 ) { - bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence -#ifdef HR_METADATA - , - 0 -#endif - ); + bits_coherence[d] = ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 0, &indice_coherence, + 0 ); } if ( q_direction->cfg.mc_ls_setup == MC_LS_SETUP_5_1 || q_direction->cfg.mc_ls_setup == MC_LS_SETUP_7_1 ) @@ -440,12 +419,8 @@ ivas_error ivas_qmetadata_enc_encode( else { /* Quantize directions*/ - quantize_direction_frame( q_direction, azimuth_orig, elevation_orig -#ifdef HR_METADATA - , - 0 -#endif - ); + quantize_direction_frame( q_direction, azimuth_orig, elevation_orig, + 0 ); } /* Signalling 2D*/ @@ -479,12 +454,8 @@ ivas_error ivas_qmetadata_enc_encode( reduce_bits = hQMetaData->is_masa_ivas_format ? ( total_bits_1dir - ( bits_diff[d] + bits_coherence[d] + bits_signaling[d] ) - 1 ) : MASA_MAX_BITS; bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, - q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits -#ifdef HR_METADATA - , - 0 -#endif - ); + q_direction->cfg.nbands, q_direction->cfg.start_band, bits_dir_bands[0], reduce_bits, + 0 ); if ( bits_ec < 0 ) { @@ -538,12 +509,8 @@ ivas_error ivas_qmetadata_enc_encode( bits_dir_bands[i] = ivas_qmetadata_raw_encode_dir( NULL, q_direction, i + 1, i ); /* Write ec bits */ - bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS -#ifdef HR_METADATA - , - 0 -#endif - ); + bits_ec = ivas_qmetadata_entropy_encode_dir( hMetaData, q_direction, diffuseness_index_max_ec_frame, i + 1, i, bits_dir_bands[i], MASA_MAX_BITS, + 0 ); if ( bits_ec >= 0 ) { @@ -646,12 +613,8 @@ ivas_error ivas_qmetadata_enc_encode( { bit_pos_start = hMetaData->nb_bits_tot; hMetaData->nb_bits_tot = bit_pos_start_coh; - ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence -#ifdef HR_METADATA - , - 0 -#endif - ); + ivas_qmetadata_quantize_coherence( hQMetaData, d, all_coherence_zero, hMetaData, 1, &indice_coherence, + 0 ); hMetaData->nb_bits_tot = bit_pos_start; } @@ -740,7 +703,6 @@ ivas_error ivas_qmetadata_enc_encode( } -#ifdef HR_METADATA /*-----------------------------------------------------------------------* * ivas_qmetadata_enc_encode_hr_384_512() * @@ -759,12 +721,8 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( int16_t nbands, nblocks, start_band; int16_t ndirections, d; int16_t all_coherence_zero; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA int16_t bits_no_dirs_coh; -#endif -#else - int16_t bits_no_dirs_coh; #endif int16_t bits_ec; float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -802,14 +760,9 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( /* Check if coherence should be encoded */ all_coherence_zero = 1; -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh = 0; #endif -#else - bits_no_dirs_coh = 0; -#endif -#ifdef FIX_HBR_MASAMETA if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { push_next_indice( hMetaData, 1, 1 ); @@ -821,29 +774,20 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( /* no change */ push_next_indice( hMetaData, 0, 1 ); } -#endif if ( hQMetaData->coherence_flag ) { all_coherence_zero = hQMetaData->all_coherence_zero; push_next_indice( hMetaData, all_coherence_zero, 1 ); /* signal coherence */ -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += 1; -#endif -#else - bits_no_dirs_coh += 1; #endif } /* encode 2 direction subbands position */ if ( ndirections == 2 && bits_sph_idx == 11 ) { -#ifdef FIX_481_UNUSED_VARIABLES #ifdef DEBUG_MODE_QMETADATA bits_no_dirs_coh += -#endif -#else - bits_no_dirs_coh += #endif write_2dir_info( hMetaData, hQMetaData->twoDirBands, hQMetaData->q_direction[0].cfg.nbands, hQMetaData->numTwoDirBands ); @@ -1003,7 +947,6 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( } } } -#ifdef FIX_HBR_MASAMETA if ( hQMetaData->q_direction->cfg.inactiveBands > 0 ) { hQMetaData->q_direction[0].cfg.nbands += hQMetaData->q_direction->cfg.inactiveBands; @@ -1012,10 +955,8 @@ ivas_error ivas_qmetadata_enc_encode_hr_384_512( hQMetaData->q_direction[1].cfg.nbands += hQMetaData->q_direction->cfg.inactiveBands; } } -#endif return error; } -#endif /*-----------------------------------------------------------------------* @@ -1030,10 +971,6 @@ void ivas_qmetadata_enc_sid_encode( IVAS_QMETADATA *q_metadata, /* i/o: metadata handle */ const int16_t masa_sid_descriptor, /* i : description of MASA SID coding structure */ const int16_t ivas_format /* i : IVAS format */ -#ifndef SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ) { int16_t b, m; @@ -1049,21 +986,8 @@ void ivas_qmetadata_enc_sid_encode( if ( ivas_format == SBA_FORMAT ) { -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) - { -#endif - /* 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*/ -#ifndef SBA_MODE_CLEAN_UP - } - else - { - /* keep 13.2 and 16.4 SID bitrate as 4.4 kbps for now*/ - /* 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; - } -#endif + /* 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 { @@ -1102,11 +1026,7 @@ void ivas_qmetadata_enc_sid_encode( /* sanity checks*/ assert( q_metadata->no_directions == 1 && "Qmetadata SID: only one direction supported!" ); -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { assert( ( q_direction->cfg.nbands == DIRAC_DTX_BANDS ) && "Qmetadata SID: only 2 bands supported!" ); } @@ -1115,11 +1035,7 @@ void ivas_qmetadata_enc_sid_encode( assert( ( q_direction->cfg.nbands == 5 ) && "Qmetadata SID: only 5 bands supported!" ); } -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode != SBA_MODE_SPAR ) -#else if ( ivas_format != SBA_FORMAT ) -#endif { /* Signalling 2D*/ push_next_indice( hMetaData, ( q_direction->not_in_2D > 0 ), 1 ); /*2D flag*/ @@ -1256,19 +1172,7 @@ void ivas_qmetadata_enc_sid_encode( #endif /* TODO: temporary to keep BE */ -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_format == SBA_FORMAT ) - { - if ( sba_mode != SBA_MODE_SPAR ) - { - /* keep 13.2 and 16.4 SID bitrate as 4.4 kbps for now*/ - metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS - 1; /* -1 for spar/dirac indicator*/ - } - } - else -#else if ( ivas_format != SBA_FORMAT ) -#endif { metadata_sid_bits = ( IVAS_SID_5k2 - SID_2k40 ) / FRAMES_PER_SEC - SID_FORMAT_NBITS; } @@ -1296,10 +1200,6 @@ 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 SBA_MODE_CLEAN_UP - , - const SBA_MODE sba_mode /* i : SBA mode */ -#endif ) { int16_t i, next_ind_sid, last_ind_sid; @@ -1313,11 +1213,7 @@ void reset_metadata_spatial( { if ( ( ivas_format == SBA_FORMAT || ivas_format == MASA_FORMAT ) && core_brate != FRAME_NO_DATA ) { -#ifndef SBA_MODE_CLEAN_UP - if ( sba_mode == SBA_MODE_SPAR ) -#else if ( ivas_format == SBA_FORMAT ) -#endif { #ifdef DEBUGGING assert( hMetaData->ind_list[0].nb_bits == 1 ); @@ -1400,11 +1296,7 @@ void reset_metadata_spatial( *total_brate = element_brate; } -#ifndef SBA_MODE_CLEAN_UP - else if ( sba_mode != SBA_MODE_SPAR ) -#else else if ( ivas_format != SBA_FORMAT ) -#endif { /* Reset SID metadata bits*/ while ( hMetaData->nb_bits_tot > nb_bits_metadata ) @@ -1472,7 +1364,6 @@ int16_t quantize_direction2D( } -#ifdef HR_METADATA /*------------------------------------------------------------------------- * ivas_qmetadata_quantize_diffuseness_nrg_ratios() * @@ -1765,7 +1656,6 @@ static int16_t ivas_qmetadata_entropy_encode_diffuseness_hr( return ( hMetaData->nb_bits_tot - start_bit_pos ); } -#endif /*------------------------------------------------------------------------- * ivas_qmetadata_quantize_diffuseness_nrg_ratios() @@ -2277,11 +2167,7 @@ void restore_metadata_buffer( int16_t i; #ifdef IND_LIST_DYN -#ifdef FIX_I503_ASAN_ERROR_IND_LIST for ( i = next_ind_start; i < hMetaData->nb_ind_tot; i++ ) -#else - for ( i = next_ind_start; i <= hMetaData->nb_ind_tot; i++ ) -#endif #else for ( i = next_ind_start; i <= hMetaData->next_ind; i++ ) #endif @@ -2582,12 +2468,8 @@ static int16_t ivas_qmetadata_entropy_encode_dir( const int16_t nbands, const int16_t start_band, const int16_t direction_bits_raw, - int16_t max_bits -#ifdef HR_METADATA - , - const int16_t hrmasa_flag -#endif -) + int16_t max_bits, + const int16_t hrmasa_flag ) { uint16_t diff_idx_min; int16_t i, j; @@ -2634,18 +2516,14 @@ static int16_t ivas_qmetadata_entropy_encode_dir( for ( i = start_band; i < nbands; i++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { diff_idx_min = 0; // min( q_direction->band_data[i].energy_ratio_index_mod[0]>>1, diff_idx_min ); } else { -#endif diff_idx_min = min( q_direction->band_data[i].energy_ratio_index_mod[0], diff_idx_min ); -#ifdef HR_METADATA } -#endif if ( q_direction->band_data[i].energy_ratio_index_mod[0] > diffuseness_index_max_ec_frame ) { @@ -4856,10 +4734,8 @@ static int16_t encode_spread_coherence_1sf( IVAS_QMETADATA *q_metadata, /* i : quantized metadata */ const int16_t idx_d, /* i : current direction index */ BSTR_ENC_HANDLE hMasaMetaData /* i/o: metadata bitstream handle */ -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ -#endif ) { int16_t i, j, k; @@ -4890,18 +4766,14 @@ static int16_t encode_spread_coherence_1sf( extra_cv = coding_subbands / MASA_FACTOR_CV_COH; for ( j = 0; j < coding_subbands; j++ ) { -#ifdef HR_METADATA if ( hrmasa_flag ) { idx_ER = 7 - ( q_direction->band_data[j].energy_ratio_index_mod[0] >> 1 ) + extra_cv; } else { -#endif idx_ER = 7 - q_direction->band_data[j].energy_ratio_index_mod[0] + extra_cv; -#ifdef HR_METADATA } -#endif if ( idx_ER > 0 ) { @@ -5252,7 +5124,6 @@ static int16_t encode_surround_coherence( } -#ifdef HR_METADATA static int16_t encode_surround_coherence_hr( IVAS_QMETADATA *hQMetaData, /* i : quantized metadata */ BSTR_ENC_HANDLE hMetaData /* i/o: metadata bitstream handle */ @@ -5453,8 +5324,6 @@ static int16_t encode_surround_coherence_hr( return nbits; } -#endif - /*-------------------------------------------------------------------* * quantize_DCT_0_coh() @@ -5472,21 +5341,16 @@ static float quantize_DCT_0_coh( IVAS_QDIRECTION *q_direction, /* i : quantized metadata */ uint16_t *idx_x, /* o : codewords index */ int16_t *p_no_cb /* o : actual number of codewords dependent on energy ratio value */ -#ifdef HR_METADATA , const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ -#endif ) { float var_azi, xhat; int16_t idx_sub_cb, idx; -#ifdef HR_METADATA int16_t min_index; -#endif /* quantize first DCT component */ var_azi = var( q_direction->band_data[j].azimuth, q_direction->cfg.nblocks ); -#ifdef HR_METADATA if ( hrmasa_flag ) { minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); @@ -5509,20 +5373,6 @@ static float quantize_DCT_0_coh( idx = squant( x, &xhat, &coherence_cb[idx_sub_cb], len_cb_dct0_masa[min_index] ); *p_no_cb = len_cb_dct0_masa[min_index]; -#else - if ( var_azi < delta_var ) - { - idx_sub_cb = no_cb * q_direction->band_data[j].energy_ratio_index[0]; - } - else - { - idx_sub_cb = no_cb * ( q_direction->band_data[j].energy_ratio_index[0] + DIRAC_DIFFUSE_LEVELS ); - } - - idx = squant( x, &xhat, &coherence_cb[idx_sub_cb], len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]] ); - - *p_no_cb = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; -#endif *idx_x = idx; return xhat; @@ -5591,7 +5441,6 @@ static void dct4_transform( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * ivas_qmetadata_quantize_coherence_hr_512() * @@ -5697,7 +5546,6 @@ static int16_t ivas_qmetadata_quantize_coherence_hr_512( nbits = hMetaData->nb_bits_tot - nbits; return nbits; } -#endif /*-------------------------------------------------------------------* @@ -5713,11 +5561,8 @@ static int16_t ivas_qmetadata_quantize_coherence( const int16_t all_coherence_zero, /* i : all coherence is zero - flag */ BSTR_ENC_HANDLE hMetaData, /* i : metadata handle */ const int16_t write_flag, /* i : flag to actually write the data or not */ - int16_t *indice_coherence -#ifdef HR_METADATA - , + int16_t *indice_coherence, const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding */ -#endif ) { int16_t j, k; @@ -5732,10 +5577,8 @@ static int16_t ivas_qmetadata_quantize_coherence( int16_t two_dir_band[MASA_MAXIMUM_CODING_SUBBANDS]; int16_t no_cb_vec[MASA_MAXIMUM_CODING_SUBBANDS]; IVAS_QDIRECTION *q_direction; -#ifdef HR_METADATA int16_t min_index; min_index = 0; -#endif q_direction = &( hQMetaData->q_direction[idx_d] ); coding_subbands = q_direction->cfg.nbands; nbits = 0; @@ -5747,12 +5590,8 @@ static int16_t ivas_qmetadata_quantize_coherence( if ( hQMetaData->q_direction[idx_d].cfg.nblocks == 1 ) { - nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData -#ifdef HR_METADATA - , - hrmasa_flag -#endif - ); + nbits = encode_spread_coherence_1sf( hQMetaData, idx_d, hMetaData, + hrmasa_flag ); return nbits; } @@ -5808,7 +5647,6 @@ static int16_t ivas_qmetadata_quantize_coherence( /* DCT transform */ dct4_transform( hQMetaData->q_direction[idx_d].coherence_band_data[j].spread_coherence, dct_coh[j] ); -#ifdef HR_METADATA if ( hrmasa_flag ) { minimum_s( (int16_t *) ( q_direction->band_data[j].energy_ratio_index ), q_direction->cfg.nblocks, &min_index ); @@ -5816,21 +5654,14 @@ static int16_t ivas_qmetadata_quantize_coherence( } else { -#endif no_cb_vec[j] = len_cb_dct0_masa[q_direction->band_data[j].energy_ratio_index[0]]; -#ifdef HR_METADATA } -#endif if ( write_flag ) { /* quantize first DCT parameter */ - dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j] -#ifdef HR_METADATA - , - hrmasa_flag -#endif - ); + dct_coh[j][0] = quantize_DCT_0_coh( dct_coh[j][0], j, coherence_cb0_masa, MASA_DELTA_AZI_DCT0, MASA_NO_CV_COH, q_direction, &idx_dct[k], &no_cb_vec[j], + hrmasa_flag ); } if ( coding_subbands < coding_subbands_0 ) @@ -5994,7 +5825,6 @@ static void ivas_qmetadata_reorder_2dir_bands( } -#ifdef HR_METADATA /*-------------------------------------------------------------------* * ivas_qmetadata_reorder_2dir_bands_hr() * @@ -6052,7 +5882,6 @@ static void ivas_qmetadata_reorder_2dir_bands_hr( return; } -#endif /*-------------------------------------------------------------------* diff --git a/lib_enc/ivas_qspherical_enc.c b/lib_enc/ivas_qspherical_enc.c index 4c79b875b7b1dfbc53971c0aec0e400cbabea077..e79c0a01a71023610dc7ea0d615ce3af7457a696 100644 --- a/lib_enc/ivas_qspherical_enc.c +++ b/lib_enc/ivas_qspherical_enc.c @@ -59,11 +59,8 @@ static float direction_distance_cp( float theta, float theta_hat, float theta_ha void quantize_direction_frame( IVAS_QDIRECTION *q_direction, /* i/o: quantized direction structure */ float azimuth_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], - float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES] -#ifdef HR_METADATA - , + float elevation_orig[MASA_MAXIMUM_CODING_SUBBANDS][MAX_PARAM_SPATIAL_SUBFRAMES], const int16_t hrmasa_flag /* i : flag indicating high-rate MASA MD coding*/ -#endif ) { int16_t i, j; @@ -97,7 +94,6 @@ void quantize_direction_frame( q_direction->not_in_2D += q_direction->band_data[i].elevation_index[j]; -#ifdef HR_METADATA if ( hrmasa_flag ) { if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) @@ -113,7 +109,6 @@ void quantize_direction_frame( } else { -#endif if ( q_direction->cfg.mc_ls_setup != MC_LS_SETUP_INVALID ) { q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[idx] - 3]; @@ -124,9 +119,7 @@ void quantize_direction_frame( q_direction->band_data[i].elevation_m_alphabet[j] = no_theta_masa[bits_direction_masa[idx] - 3] * 2 - 1; q_direction->band_data[i].azimuth_m_alphabet[j] = no_phi_masa[bits_direction_masa[idx] - 1][( q_direction->band_data[i].elevation_index[j] + 1 ) >> 1]; } -#ifdef HR_METADATA } -#endif if ( q_direction->band_data[i].azimuth_index[j] == MASA_NO_INDEX ) { diff --git a/lib_enc/ivas_sba_enc.c b/lib_enc/ivas_sba_enc.c index e01de987412d4667582674ab0054f49260bacca8..1d6256b021e29becd2ca43dc40396037f3c329d6 100644 --- a/lib_enc/ivas_sba_enc.c +++ b/lib_enc/ivas_sba_enc.c @@ -121,10 +121,8 @@ ivas_error ivas_sba_enc_reconfigure( SPAR_ENC_HANDLE hSpar; int16_t analysis_order_old; int16_t spar_reconfig_flag; -#ifdef FIX_DTX_428 int16_t nbands_old; int16_t ndir_old; -#endif spar_reconfig_flag = 0; nchan_transport_old = st_ivas->nchan_transport; @@ -132,10 +130,8 @@ ivas_error ivas_sba_enc_reconfigure( nSCE_old = st_ivas->nSCE; st_ivas->sba_analysis_order = ivas_sba_get_analysis_order( ivas_total_brate, hEncoderConfig->sba_order ); analysis_order_old = ivas_sba_get_analysis_order( hEncoderConfig->last_ivas_total_brate, hEncoderConfig->sba_order ); -#ifdef FIX_DTX_428 nbands_old = st_ivas->hQMetaData->q_direction->cfg.nbands; ndir_old = st_ivas->hQMetaData->no_directions; -#endif if ( analysis_order_old != st_ivas->sba_analysis_order ) { @@ -204,17 +200,6 @@ ivas_error ivas_sba_enc_reconfigure( } ivas_spar_config( ivas_total_brate, min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ), &st_ivas->nchan_transport, &st_ivas->nSCE, &st_ivas->nCPE, &st_ivas->hSpar->core_nominal_brate, -1 ); -#ifndef SBA_MODE_CLEAN_UP - for ( n = 0; n < DIRAC_MAX_ANA_CHANS; n++ ) - { - if ( hDirAC->sba_synchro_buffer[n] != NULL ) - { - free( hDirAC->sba_synchro_buffer[n] ); - hDirAC->sba_synchro_buffer[n] = NULL; - } - } - hDirAC->num_samples_synchro_delay = 0; -#endif hSpar = st_ivas->hSpar; if ( st_ivas->nchan_transport == 1 ) @@ -241,16 +226,11 @@ ivas_error ivas_sba_enc_reconfigure( return error; } } -#ifndef SBA_MODE_CLEAN_UP - hEncoderConfig->spar_reconfig_flag = spar_reconfig_flag; -#else st_ivas->hSpar->spar_reconfig_flag = spar_reconfig_flag; -#endif if ( ( error = ivas_dirac_enc_reconfigure( st_ivas ) ) != IVAS_ERR_OK ) { return error; } -#ifdef FIX_DTX_428 if ( st_ivas->hQMetaData->q_direction->cfg.nbands != nbands_old || st_ivas->hQMetaData->no_directions != ndir_old ) { int16_t dir, j, i; @@ -267,10 +247,6 @@ ivas_error ivas_sba_enc_reconfigure( } } } -#endif -#ifndef SBA_MODE_CLEAN_UP - mvs2s( hDirAC->dirac_to_spar_md_bands, hSpar->dirac_to_spar_md_bands, DIRAC_MAX_NBANDS ); -#endif hSpar->enc_param_start_band = hDirAC->hConfig->enc_param_start_band; /*-----------------------------------------------------------------* * Allocate, initialize, and configure SCE/CPE/MCT handles @@ -285,7 +261,6 @@ ivas_error ivas_sba_enc_reconfigure( return error; } -#ifdef ARITH_HUFF_CODER_CHANGES int16_t ivas_sba_get_max_md_bits( Encoder_Struct *st_ivas ) { @@ -300,14 +275,9 @@ int16_t ivas_sba_get_max_md_bits( max_bits = 500; } max_md_bits = min( st_ivas->hQMetaData->metadata_max_bits + 1, max_bits ); // TODO: remove 500 once max MD bits has been defined at all bitrates in DirAC -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->hEncoderConfig->ivas_format == SBA_FORMAT ) -#endif { max_md_bits += st_ivas->hSpar->hMdEnc->spar_md_cfg.max_md_bits_spar; } return max_md_bits; } -#endif diff --git a/lib_enc/ivas_sce_enc.c b/lib_enc/ivas_sce_enc.c index 87c0e8e9d333481f8d0afcf8998bd64c9b836149..3dde94fd3394ba9809faaa59ff0f846b5a4b54f0 100644 --- a/lib_enc/ivas_sce_enc.c +++ b/lib_enc/ivas_sce_enc.c @@ -205,12 +205,8 @@ ivas_error ivas_sce_enc( * Reset metadata *----------------------------------------------------------------*/ -#ifndef SBA_MODE_CLEAN_UP - 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 ); -#endif /*----------------------------------------------------------------* * Write IVAS format signaling in SID frames *----------------------------------------------------------------*/ diff --git a/lib_enc/ivas_spar_encoder.c b/lib_enc/ivas_spar_encoder.c index 5956ef03dd28b76e89be3f2830d6c0354f5807bb..2731fdaf407f7ca8ffd8d0287424dc1c63cf4ed5 100644 --- a/lib_enc/ivas_spar_encoder.c +++ b/lib_enc/ivas_spar_encoder.c @@ -84,9 +84,7 @@ ivas_error ivas_spar_enc_open( } } -#ifdef SBA_MODE_CLEAN_UP hSpar->spar_reconfig_flag = 0; -#endif input_Fs = hEncoderConfig->input_Fs; sba_order_internal = min( st_ivas->sba_analysis_order, IVAS_MAX_SBA_ORDER ); nchan_inp = ivas_sba_get_nchan_metadata( sba_order_internal, @@ -126,13 +124,8 @@ ivas_error ivas_spar_enc_open( /* set FB config. */ active_w_mixing = ivas_spar_br_table_consts[table_idx].active_w; -#ifndef SBA_MODE_CLEAN_UP - ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, SBA_MODE_SPAR, nchan_inp, nchan_transport, active_w_mixing, input_Fs, - nchan_fb_in ); -#else ivas_fb_set_cfg( &fb_cfg, SBA_FORMAT, nchan_inp, nchan_transport, active_w_mixing, input_Fs, nchan_fb_in ); -#endif fb_cfg->remix_order = remix_order_set[hSpar->hMdEnc->spar_md_cfg.remix_unmix_order]; /* FB mixer handle */ @@ -142,11 +135,7 @@ ivas_error ivas_spar_enc_open( } /* Covariance handle */ -#ifdef FIX_489_COV_SMOOTHING if ( ( error = ivas_spar_covar_enc_open( &( hSpar->hCovEnc ), hSpar->hFbMixer->pFb, input_Fs, nchan_inp, COV_SMOOTH_SPAR, hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_spar_covar_enc_open( &( hSpar->hCovEnc ), hSpar->hFbMixer->pFb, input_Fs, nchan_inp, hEncoderConfig->ivas_total_brate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -354,34 +343,6 @@ ivas_error ivas_spar_enc( hEncoderConfig = st_ivas->hEncoderConfig; /* check last sba_mode */ -#ifndef SBA_MODE_CLEAN_UP - if ( ivas_sba_mode_select() == SBA_MODE_DIRAC ) - { - Encoder_State *sts[MCT_MAX_BLOCKS]; - - /* initializations */ - for ( int16_t sce_id = 0; sce_id < st_ivas->nSCE; sce_id++ ) - { - sts[sce_id] = st_ivas->hSCE[sce_id]->hCoreCoder[0]; - } - - for ( int16_t cpe_id = 0, i = 0; cpe_id < st_ivas->nCPE; cpe_id++ ) - { - for ( int16_t ch = 0; ch < CPE_CHANNELS; ch++ ) - { - sts[i] = st_ivas->hCPE[cpe_id]->hCoreCoder[ch]; - i++; - } - } - - /* update FB prior input */ - for ( int16_t i = 0; i < st_ivas->nchan_transport; i++ ) - { - mvr2r( ( sts[i]->input_buff + NS2SA( hEncoderConfig->input_Fs, IVAS_FB_ENC_DELAY_NS ) ), - ( st_ivas->hSpar->hFbMixer->ppFilterbank_prior_input[i] + st_ivas->hSpar->hFbMixer->fb_cfg->prior_input_length - input_frame ), input_frame ); - } - } -#endif /* front VAD */ if ( ( error = front_vad_spar( st_ivas->hSpar, data_f[0], hEncoderConfig, input_frame ) ) != IVAS_ERR_OK ) @@ -440,31 +401,19 @@ static ivas_error ivas_spar_enc_process( const int16_t *order; SPAR_ENC_HANDLE hSpar = st_ivas->hSpar; IVAS_QMETADATA_HANDLE hQMetaData = st_ivas->hQMetaData; -#ifndef SBA_MODE_CLEAN_UP - int16_t ts, l_ts, orig_dirac_bands, num_del_samples; -#else int16_t ts, l_ts, num_del_samples; -#endif float *ppIn_FR_real[IVAS_SPAR_MAX_CH], *ppIn_FR_imag[IVAS_SPAR_MAX_CH]; float wyzx_del_buf[FOA_CHANNELS][IVAS_FB_1MS_48K_SAMP]; -#ifndef SBA_MODE_CLEAN_UP - float dir[3], avg_dir[3]; - float energySum, vecLen; -#endif int16_t nchan_fb_in; -#ifdef ARITH_HUFF_CODER_CHANGES /*Commented for now*/ /*int16_t start_nb_bits; int16_t total_md_bits, total_sba_bits;*/ -#endif push_wmops( "ivas_spar_enc_process" ); -#ifdef ARITH_HUFF_CODER_CHANGES /*Commented for now*/ // start_nb_bits = hMetaData->nb_bits_tot; -#endif /*-----------------------------------------------------------------------------------------* * Initialization @@ -569,94 +518,7 @@ static ivas_error ivas_spar_enc_process( hodirac_flag = ivas_get_hodirac_flag( ivas_total_brate, st_ivas->sba_analysis_order ); -#ifndef SBA_MODE_CLEAN_UP - ivas_dirac_param_est_enc( st_ivas->hDirAC, hQMetaData->q_direction, hQMetaData->useLowerRes, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, st_ivas->sba_mode, hodirac_flag, hodirac_flag ? HOA2_CHANNELS : FOA_CHANNELS ); - - if ( hQMetaData->q_direction->cfg.nbands > 0 ) - { - orig_dirac_bands = hQMetaData->q_direction[0].cfg.nbands; - - if ( dtx_vad == 1 ) - { - /* WB 4TC mode bit : disable for now*/ - push_next_indice( hMetaData, 0, 1 ); - - ivas_qmetadata_enc_encode( hMetaData, hQMetaData, hodirac_flag ); - } - else - { - hQMetaData->q_direction[0].cfg.nbands = DIRAC_DTX_BANDS; - - /* compute directions */ - for ( i = 0; i < hQMetaData->q_direction[0].cfg.nblocks; i++ ) - { - set_zero( dir, 3 ); - set_zero( avg_dir, 3 ); - energySum = 0.0f; - - /* combine all DirAC bands except the last one, handle last band separately, last band covers BW above WB */ - for ( j = 0; j < orig_dirac_bands - 1; j++ ) - { - ivas_qmetadata_azimuth_elevation_to_direction_vector( hQMetaData->q_direction[0].band_data[j].azimuth[i], hQMetaData->q_direction[0].band_data[j].elevation[i], &dir[0] ); - vecLen = hQMetaData->q_direction[0].band_data[j].energy_ratio[i] * st_ivas->hDirAC->buffer_energy[i * orig_dirac_bands + j]; - - avg_dir[0] += dir[0] * vecLen; - avg_dir[1] += dir[1] * vecLen; - avg_dir[2] += dir[2] * vecLen; - - energySum += st_ivas->hDirAC->buffer_energy[i * orig_dirac_bands + j]; - } - - ivas_qmetadata_direction_vector_to_azimuth_elevation( &avg_dir[0], &hQMetaData->q_direction[0].band_data[0].azimuth[i], &hQMetaData->q_direction[0].band_data[0].elevation[i] ); - hQMetaData->q_direction[0].band_data[0].energy_ratio[i] = sqrtf( dotp( avg_dir, avg_dir, 3 ) ) / ( energySum + EPSILON ); - - hQMetaData->q_direction[0].band_data[1].azimuth[i] = hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i]; - hQMetaData->q_direction[0].band_data[1].elevation[i] = hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i]; - hQMetaData->q_direction[0].band_data[1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i]; - } - - /* 1 bit to indicate mode MD coding : temp solution*/ - push_next_indice( hMetaData, 1, 1 ); - - /* encode SID parameters */ - ivas_qmetadata_enc_sid_encode( hMetaData, hQMetaData, -1, SBA_FORMAT, st_ivas->sba_mode ); - } - - for ( b = hQMetaData->q_direction->cfg.start_band; b < hQMetaData->q_direction->cfg.nbands; b++ ) - { - for ( i_ts = 0; i_ts < ( ( dtx_vad == 1 ) ? hQMetaData->q_direction[0].cfg.nblocks : 1 ); i_ts++ ) - { - hQMetaData->q_direction->band_data[b].azimuth[i_ts] = hQMetaData->q_direction->band_data[b].q_azimuth[i_ts]; - hQMetaData->q_direction->band_data[b].elevation[i_ts] = hQMetaData->q_direction->band_data[b].q_elevation[i_ts]; - hQMetaData->q_direction[0].band_data[b].energy_ratio[0] = 1.0f - diffuseness_reconstructions[hQMetaData->q_direction[0].band_data[b].energy_ratio_index[0]]; - } - } - - if ( dtx_vad == 0 ) - { - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].azimuth[i] = hQMetaData->q_direction[0].band_data[1].azimuth[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].elevation[i] = hQMetaData->q_direction[0].band_data[1].elevation[0]; - hQMetaData->q_direction[0].band_data[orig_dirac_bands - 1].energy_ratio[i] = hQMetaData->q_direction[0].band_data[1].energy_ratio[0]; - } - - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) - { - for ( j = orig_dirac_bands - 2; j >= 0; j-- ) - { - hQMetaData->q_direction[0].band_data[j].azimuth[i] = hQMetaData->q_direction[0].band_data[0].azimuth[0]; - hQMetaData->q_direction[0].band_data[j].elevation[i] = hQMetaData->q_direction[0].band_data[0].elevation[0]; - hQMetaData->q_direction[0].band_data[j].energy_ratio[i] = hQMetaData->q_direction[0].band_data[0].energy_ratio[0]; - } - } - - hQMetaData->q_direction->cfg.nbands = orig_dirac_bands; - } - } -#else ivas_dirac_enc( st_ivas->hDirAC, hQMetaData, hMetaData, data_f, ppIn_FR_real, ppIn_FR_imag, input_frame, dtx_vad, hEncoderConfig->ivas_format, hodirac_flag ); -#endif /*-----------------------------------------------------------------------------------------* * Set SPAR bitrates *-----------------------------------------------------------------------------------------*/ @@ -666,11 +528,7 @@ static ivas_error ivas_spar_enc_process( if ( hSpar->hMdEnc->table_idx != table_idx ) { hSpar->hMdEnc->table_idx = table_idx; -#ifndef SBA_MODE_CLEAN_UP - if ( ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) && ( !hEncoderConfig->spar_reconfig_flag ) ) -#else if ( ( ivas_total_brate != hEncoderConfig->last_ivas_total_brate ) && ( !hSpar->spar_reconfig_flag ) ) -#endif { if ( ( error = ivas_spar_md_enc_init( hSpar->hMdEnc, hEncoderConfig, sba_order ) ) != IVAS_ERR_OK ) { @@ -680,14 +538,10 @@ static ivas_error ivas_spar_enc_process( else { ivas_spar_set_bitrate_config( &hSpar->hMdEnc->spar_md_cfg, table_idx, - ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND -#ifdef ARITH_HUFF_CODER_CHANGES - , + ( hSpar->hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, hSpar->hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, - hSpar->AGC_Enable -#endif - ); + hSpar->AGC_Enable ); } } /*-----------------------------------------------------------------------------------------* @@ -1048,12 +902,10 @@ static ivas_error ivas_spar_enc_process( pop_wmops(); -#ifdef ARITH_HUFF_CODER_CHANGES /*Commented for now*/ /*total_md_bits = hMetaData->nb_bits_tot - start_nb_bits; total_sba_bits = ivas_sba_get_max_md_bits( st_ivas ); assert( total_md_bits <= total_sba_bits );*/ -#endif return error; } diff --git a/lib_enc/ivas_spar_md_enc.c b/lib_enc/ivas_spar_md_enc.c index 50ef2f03487406478d0b825ac15bd3f2b7f7fae4..2776f6576532428af78edec0ed6170f8d70509b8 100644 --- a/lib_enc/ivas_spar_md_enc.c +++ b/lib_enc/ivas_spar_md_enc.c @@ -71,16 +71,8 @@ static void ivas_band_mixer( float *cov_re[IVAS_SPAR_MAX_CH][IVAS_SPAR_MAX_CH], static void ivas_get_band_differential_index( ivas_band_coeffs_ind_t *pBand_idx, const int16_t q_levels[2], const int16_t one_sided, const int16_t nB, const int16_t complex_cov, const int16_t dim, const ivas_coeffs_type_t coeff_type ); -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t bands_bw ); -#else -static void ivas_get_huffman_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t bands_bw ); -#endif -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); -#else -static void ivas_get_arith_coded_bs( ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, const int16_t bands_bw, const int16_t nB, const int16_t qsi, const int16_t planarCP, const int16_t strat, const int32_t ivas_total_brate ); -#endif static ivas_error ivas_spar_set_enc_config( ivas_spar_md_enc_state_t *hMdEnc, int16_t *max_freq_per_chan, const int16_t nchan_transport, float *pFC, const int16_t nchan_inp ); @@ -327,9 +319,7 @@ ivas_error ivas_spar_md_enc_init( table_idx = ivas_get_spar_table_idx( hEncoderConfig->ivas_total_brate, sba_order, SPAR_CONFIG_BW, NULL, NULL ); ivas_spar_set_bitrate_config( &hMdEnc->spar_md_cfg, table_idx, - ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND -#ifdef ARITH_HUFF_CODER_CHANGES - , + ( hMdEnc->spar_hoa_md_flag ) ? IVAS_MAX_NUM_BANDS : SPAR_DIRAC_SPLIT_START_BAND, hMdEnc->spar_hoa_dirac2spar_md_flag, 1, hEncoderConfig->Opt_PCA_ON, #ifndef DEBUG_AGC_ENCODER_CMD_OPTION @@ -338,7 +328,6 @@ ivas_error ivas_spar_md_enc_init( ivas_agc_enc_get_flag( hEncoderConfig->Opt_AGC_ON, ivas_spar_br_table_consts[table_idx].nchan_transport ) #endif -#endif ); /* get FB coefficients */ @@ -595,22 +584,16 @@ ivas_error ivas_spar_md_enc_process( int16_t last_ind_start; #endif BSTR_ENC_DATA hMetaData_tmp; -#ifdef ARITH_HUFF_CODER_CHANGES Indice *ind_list_tmp; int16_t md_indices_allocated; -#else - Indice ind_list_tmp[MAX_BITS_METADATA]; // IVAS_fmToDo: size to be optimized -#endif #ifdef IND_LIST_DYN int16_t max_num_indices_tmp; #endif float Wscale[IVAS_MAX_NUM_BANDS]; -#ifdef ARITH_HUFF_CODER_CHANGES /*extra 16 bits for arithmetic coder as overshoot check is after a symbol is written*/ md_indices_allocated = hMdEnc->spar_md_cfg.max_bits_per_blk + IVAS_SPAR_ARITH_OVERSHOOT_BITS; ind_list_tmp = (Indice *) malloc( sizeof( Indice ) * md_indices_allocated ); -#endif num_quant_strats = hMdEnc->spar_md_cfg.num_quant_strats; num_ch = ivas_sba_get_nchan_metadata( sba_order, @@ -978,17 +961,11 @@ ivas_error ivas_spar_md_enc_process( strat = cs[i]; if ( strat != NO_STRAT ) { -#ifdef ARITH_HUFF_CODER_CHANGES reset_indices_enc( &hMetaData_tmp, md_indices_allocated ); -#else - reset_indices_enc( &hMetaData_tmp, MAX_BITS_METADATA ); -#endif ivas_write_spar_md_bitstream( hMdEnc, num_bands, bands_bw, &hMetaData_tmp, hEncoderConfig->ivas_total_brate, strat, qsi, planarCP ); -#ifdef ARITH_HUFF_CODER_CHANGES /*write to main buffer if its a valid bitstream*/ if ( hMetaData_tmp.nb_bits_tot > 0 ) { -#endif if ( hMetaData->nb_bits_tot == bit_pos_start || hMetaData_tmp.nb_bits_tot < ( hMetaData->nb_bits_tot - bit_pos_start ) ) { write_metadata_buffer( &hMetaData_tmp, hMetaData, bit_pos_start, next_ind_start @@ -1016,27 +993,21 @@ ivas_error ivas_spar_md_enc_process( break; } -#ifdef ARITH_HUFF_CODER_CHANGES /*only if valid bitstream was written to main buffer*/ if ( hMetaData->nb_bits_tot > bit_pos_start ) -#endif { if ( hMetaData->nb_bits_tot - bit_pos_start + ( ( ( hEncoderConfig->ivas_total_brate == IVAS_256k ) && ( sba_order == SBA_FOA_ORDER ) ) ? 1 : 0 ) <= hMdEnc->spar_md_cfg.max_bits_per_blk ) { -#ifdef ARITH_HUFF_CODER_CHANGES packed_ok = 1; -#endif break; } } } -#ifdef ARITH_HUFF_CODER_CHANGES if ( dtx_vad == 1 ) { assert( packed_ok == 1 ); } -#endif if ( hEncoderConfig->ivas_total_brate >= IVAS_256k ) { assert( qsi == 0 ); @@ -1279,9 +1250,7 @@ ivas_error ivas_spar_md_enc_process( hMdEnc->spar_md.dtx_vad = dtx_vad; hMdEnc->spar_md.num_bands = num_bands; -#ifdef ARITH_HUFF_CODER_CHANGES free( ind_list_tmp ); -#endif return IVAS_ERR_OK; } @@ -1352,9 +1321,7 @@ static void ivas_write_spar_md_bitstream( { int16_t no_ec, i; int16_t do_diff[IVAS_MAX_NUM_BANDS]; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t entropy_coding_result; -#endif if ( strat == NO_STRAT ) { @@ -1459,28 +1426,22 @@ static void ivas_write_spar_md_bitstream( #endif if ( no_ec == 1 ) { -#ifdef ARITH_HUFF_CODER_CHANGES entropy_coding_result = -#endif ivas_get_huffman_coded_bs( hMdEnc, hMetaData, nB, qsi, planarCP, bands_bw ); } else { -#ifdef ARITH_HUFF_CODER_CHANGES entropy_coding_result = -#endif ivas_get_arith_coded_bs( hMdEnc, hMetaData, do_diff, bands_bw, nB, qsi, planarCP, strat, ivas_total_brate ); } -#ifdef ARITH_HUFF_CODER_CHANGES if ( entropy_coding_result < 0 ) { hMetaData->nb_bits_tot = 0; } -#endif return; } @@ -1491,11 +1452,7 @@ static void ivas_write_spar_md_bitstream( * * Generate huffman coded bitstream *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_get_huffman_coded_bs( -#else -static void ivas_get_huffman_coded_bs( -#endif ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t nB, @@ -1528,12 +1485,10 @@ static void ivas_get_huffman_coded_bs( for ( j = pred_offset; j < pred_coeff_dim; j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.pred_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].pred_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } @@ -1542,12 +1497,10 @@ static void ivas_get_huffman_coded_bs( if ( keep_planar[(int16_t) floor( j / ( ndm - 1 ) )] ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.drct_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].drct_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } } @@ -1557,12 +1510,10 @@ static void ivas_get_huffman_coded_bs( if ( keep_planar[j] ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.decd_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].decd_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } } @@ -1572,46 +1523,36 @@ static void ivas_get_huffman_coded_bs( for ( j = pred_offset; j < pred_coeff_dim; j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.pred_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].pred_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } for ( j = 0; j < ndec * ( ndm - 1 ); j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.drct_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].drct_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } for ( j = 0; j < ndec; j++ ) { ivas_huffman_encode( &hMdEnc->huff_coeffs.decd_huff_re[qsi], hMdEnc->spar_md.band_coeffs_idx[i].decd_index_re[j], &code, &len ); -#ifdef ARITH_HUFF_CODER_CHANGES if ( ( hMetaData->nb_bits_tot + len ) > hMdEnc->spar_md_cfg.max_bits_per_blk ) { return -1; } -#endif push_next_indice( hMetaData, code, len ); } } } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } @@ -1620,11 +1561,7 @@ static void ivas_get_huffman_coded_bs( * * Generate arithmetic coded bitstream *-----------------------------------------------------------------------------------------*/ -#ifdef ARITH_HUFF_CODER_CHANGES static int16_t ivas_get_arith_coded_bs( -#else -static void ivas_get_arith_coded_bs( -#endif ivas_spar_md_enc_state_t *hMdEnc, BSTR_ENC_HANDLE hMetaData, const int16_t *pDo_diff, @@ -1643,9 +1580,7 @@ static void ivas_get_arith_coded_bs( ivas_cell_dim_t decx_cell_dims[IVAS_MAX_NUM_BANDS]; int16_t symbol_arr_re[IVAS_MAX_INPUT_LEN]; int16_t symbol_arr_old_re[IVAS_MAX_INPUT_LEN]; -#ifdef ARITH_HUFF_CODER_CHANGES int16_t arith_result; -#endif for ( i = 0; i < nB; i++ ) { @@ -1720,7 +1655,6 @@ static void ivas_get_arith_coded_bs( ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, pred_cell_dims, PRED_COEFF, planarCP ); } -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.pred_arith_re[qsi], &hMdEnc->arith_coeffs.pred_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, pred_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); @@ -1728,10 +1662,6 @@ static void ivas_get_arith_coded_bs( { return -1; } -#else - ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.pred_arith_re[qsi], &hMdEnc->arith_coeffs.pred_arith_re_diff[qsi], pDo_diff, nB, - symbol_arr_re, symbol_arr_old_re, pred_cell_dims, hMetaData, any_diff ); -#endif if ( hMdEnc->spar_hoa_md_flag && hMdEnc->spar_hoa_dirac2spar_md_flag ) { @@ -1773,7 +1703,6 @@ static void ivas_get_arith_coded_bs( } } -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.drct_arith_re[qsi], &hMdEnc->arith_coeffs.drct_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, drct_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); @@ -1781,10 +1710,6 @@ static void ivas_get_arith_coded_bs( { return -1; } -#else - ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.drct_arith_re[qsi], &hMdEnc->arith_coeffs.drct_arith_re_diff[qsi], pDo_diff, nB, - symbol_arr_re, symbol_arr_old_re, drct_cell_dims, hMetaData, any_diff ); -#endif ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, decd_cell_dims, DECD_COEFF, planarCP ); @@ -1801,7 +1726,6 @@ static void ivas_get_arith_coded_bs( decd_cell_dims[i].dim1 = decd_cell_dims[i].dim1 - IVAS_SPAR_HOA3_NP_CHS; } } -#ifdef ARITH_HUFF_CODER_CHANGES arith_result = ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.decd_arith_re[qsi], &hMdEnc->arith_coeffs.decd_arith_re_diff[qsi], pDo_diff, nB, symbol_arr_re, symbol_arr_old_re, decd_cell_dims, hMetaData, any_diff, hMdEnc->spar_md_cfg.max_bits_per_blk ); @@ -1809,10 +1733,6 @@ static void ivas_get_arith_coded_bs( { return -1; } -#else - ivas_arith_encode_cmplx_cell_array( &hMdEnc->arith_coeffs.decd_arith_re[qsi], &hMdEnc->arith_coeffs.decd_arith_re_diff[qsi], pDo_diff, nB, - symbol_arr_re, symbol_arr_old_re, decd_cell_dims, hMetaData, any_diff ); -#endif ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md.band_coeffs_idx, nB, symbol_arr_re, decx_cell_dims, DECX_COEFF, planarCP ); @@ -1822,11 +1742,7 @@ static void ivas_get_arith_coded_bs( ivas_copy_band_coeffs_idx_to_arr( hMdEnc->spar_md_prior.band_coeffs_idx_mapped, nB, symbol_arr_old_re, decx_cell_dims, DECX_COEFF, planarCP ); } -#ifdef ARITH_HUFF_CODER_CHANGES return 0; -#else - return; -#endif } diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h index a4bd36207db192df2b52e3c769ecfa5880631342..4f2f375af7094af2561f6b387a47f98565b070ef 100644 --- a/lib_enc/ivas_stat_enc.h +++ b/lib_enc/ivas_stat_enc.h @@ -81,10 +81,8 @@ typedef struct stereo_itd_data_struct int16_t prev_itd1; int16_t prev_itd2; -#ifdef HYBRID_ITD_MAX /*flag for hybrid ITD for very large ITDs*/ int16_t hybrid_itd_max; -#endif } ITD_DATA, *ITD_DATA_HANDLE; typedef struct dft_ana_struct @@ -591,10 +589,6 @@ typedef struct ivas_dirac_enc_data_structure PARAM_ISM_CONFIG_HANDLE hParamIsm; /* Parametric ISM handle */ IVAS_FB_MIXER_HANDLE hFbMixer; -#ifndef SBA_MODE_CLEAN_UP - float *sba_synchro_buffer[DIRAC_MAX_ANA_CHANS]; - int16_t num_samples_synchro_delay; -#endif /* DirAC parameter estimation */ float **direction_vector[DIRAC_NUM_DIMS]; @@ -602,7 +596,6 @@ typedef struct ivas_dirac_enc_data_structure float diffuseness_m[DIRAC_MAX_NBANDS]; int16_t band_grouping[DIRAC_MAX_NBANDS + 1]; int16_t block_grouping[5]; -#ifdef FIX_485_STATIC_BUFFERS int16_t firstrun_sector_params; float sec_I_vec_smth_x[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; @@ -612,11 +605,7 @@ typedef struct ivas_dirac_enc_data_structure float energy_smth[NUM_ANA_SECTORS][IVAS_MAX_NUM_BANDS]; float azi_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; float ele_prev[NUM_ANA_SECTORS * IVAS_MAX_NUM_BANDS]; -#endif -#ifndef SBA_MODE_CLEAN_UP - int16_t dirac_to_spar_md_bands[DIRAC_MAX_NBANDS]; -#endif /* diffuseness */ int16_t index_buffer_intensity; @@ -715,9 +704,7 @@ typedef struct ivas_spar_enc_lib_t FRONT_VAD_ENC_HANDLE hFrontVad; /* front-VAD handle */ ENC_CORE_HANDLE hCoreCoderVAD; /* core-coder handle for front-VAD module */ -#ifdef SBA_MODE_CLEAN_UP int16_t spar_reconfig_flag; -#endif int16_t front_vad_flag; int16_t front_vad_dtx_flag; int16_t force_front_vad; @@ -1123,9 +1110,6 @@ typedef struct encoder_config_structure /* temp. development parameters */ int16_t Opt_PCA_ON; /* flag indicating PCA operation in SBA */ -#ifndef SBA_MODE_CLEAN_UP - int16_t spar_reconfig_flag; - #endif #ifdef DEBUGGING /* debugging options */ int16_t stereo_mode_cmdl; /* stereo mode forced from the command-line */ @@ -1184,9 +1168,6 @@ typedef struct LFE_ENC_HANDLE hLFE; /* LFE data handle */ ISM_MODE ism_mode; /* ISM format mode */ -#ifndef SBA_MODE_CLEAN_UP - SBA_MODE sba_mode; /* SBA format mode */ -#endif MC_MODE mc_mode; /* MC format mode */ /* Stereo downmix for EVS module */ diff --git a/lib_enc/ivas_stereo_dft_enc.c b/lib_enc/ivas_stereo_dft_enc.c index 36e577b48248c0e15903729fcc39097a17f6704e..e043fb485724260fd253daf9dc64706b4ca43e7e 100644 --- a/lib_enc/ivas_stereo_dft_enc.c +++ b/lib_enc/ivas_stereo_dft_enc.c @@ -297,12 +297,8 @@ ivas_error stereo_dft_enc_create( stereo_dft_enc_open( hStereoDft_loc, input_Fs, max_bwidth ); - stereo_dft_hybrid_ITD_flag( hStereoDft_loc->hConfig, input_Fs -#ifdef HYBRID_ITD_MAX - , - hStereoDft_loc->hItd->hybrid_itd_max -#endif - ); + stereo_dft_hybrid_ITD_flag( hStereoDft_loc->hConfig, input_Fs, + hStereoDft_loc->hItd->hybrid_itd_max ); *hStereoDft = hStereoDft_loc; @@ -567,9 +563,7 @@ void stereo_enc_itd_init( hItd->prev_itd1 = 0; hItd->prev_itd2 = 0; -#ifdef HYBRID_ITD_MAX hItd->hybrid_itd_max = 0; -#endif return; } diff --git a/lib_enc/ivas_stereo_dft_enc_itd.c b/lib_enc/ivas_stereo_dft_enc_itd.c index 025729e0cdc3832e6487d73f76e1f8781f275130..669a4a0a12932be3d2cf07544c965fd8d05f14f2 100644 --- a/lib_enc/ivas_stereo_dft_enc_itd.c +++ b/lib_enc/ivas_stereo_dft_enc_itd.c @@ -115,19 +115,13 @@ static void set_band_limits( void stereo_dft_hybrid_ITD_flag( STEREO_DFT_CONFIG_DATA_HANDLE hConfig, /* o : DFT stereo configuration */ const int32_t input_Fs /* i : CPE element sampling rate */ -#ifdef HYBRID_ITD_MAX , const int16_t hybrid_itd_max /* i : flag for hybrid ITD for very large ITDs */ -#endif ) { if ( hConfig != NULL ) { - if ( hConfig->res_cod_mode || ( hConfig->ada_wb_res_cod_mode && input_Fs == 16000 ) -#ifdef HYBRID_ITD_MAX - || ( hybrid_itd_max == 1 ) -#endif - ) + if ( hConfig->res_cod_mode || ( hConfig->ada_wb_res_cod_mode && input_Fs == 16000 ) || ( hybrid_itd_max == 1 ) ) { hConfig->hybrid_itd_flag = 1; } @@ -650,10 +644,8 @@ void stereo_dft_enc_compute_itd( float cng_xcorr_filt; -#ifdef HYBRID_ITD_MAX int16_t prev_itd_max; int16_t itd_max_flip; -#endif if ( hCPE->element_mode == IVAS_CPE_DFT ) { @@ -1341,12 +1333,10 @@ void stereo_dft_enc_compute_itd( hItd->prev_sum_nrg_L_lb = sum_nrg_L_lb; mvr2r( xcorr_lb, hItd->prev_xcorr_lb, STEREO_DFT_XCORR_LB_MAX ); } -#ifdef HYBRID_ITD_MAX /*save previous flag*/ prev_itd_max = hItd->hybrid_itd_max; /* enable hybrid ITD handling for very large ITDs*/ hItd->hybrid_itd_max = ( abs( itd ) > STEREO_DFT_ITD_MAX && abs( itd ) < STEREO_DFT_ITD_MAX_ANA && !hCPE->hCoreCoder[0]->sp_aud_decision0 && hCPE->element_brate < IVAS_32k ); -#endif /* Update memory */ hItd->prev_itd = itd; @@ -1371,7 +1361,6 @@ void stereo_dft_enc_compute_itd( hItd->deltaItd[k_offset] = hItd->itd[k_offset] - hItd->td_itd[k_offset]; -#ifdef HYBRID_ITD_MAX if ( hItd->hybrid_itd_max ) { /*check if there is an ITD flip*/ @@ -1388,7 +1377,6 @@ void stereo_dft_enc_compute_itd( { hItd->hybrid_itd_max = -1; } -#endif #ifdef DEBUG_MODE_DFT { diff --git a/lib_enc/ivas_stereo_dft_td_itd.c b/lib_enc/ivas_stereo_dft_td_itd.c index 27a71dfae477f0d3702d266163887e9204d73f00..613fd3342429a9cf6ffe1a62f2313712ac6d0610 100644 --- a/lib_enc/ivas_stereo_dft_td_itd.c +++ b/lib_enc/ivas_stereo_dft_td_itd.c @@ -271,14 +271,12 @@ void stereo_td_itd( hITD->td_itd_32k[i] = hITD->td_itd_32k[i + 1]; } } -#ifdef HYBRID_ITD_MAX /*reset TD ITDs in case of hybrid itd_max change - turn hybrid ITD off*/ if ( hITD->hybrid_itd_max == -1 && hybrid_itd_flag == 0 ) { hITD->td_itd[k_offset] = 0; hITD->td_itd_32k[k_offset] = 0; } -#endif if ( hybrid_itd_flag == 0 ) { return; diff --git a/lib_enc/ivas_stereo_mdct_core_enc.c b/lib_enc/ivas_stereo_mdct_core_enc.c index c8e3dcfcd4423d95102842b379a6f6aa37369edc..3c274b149e725423799c4d19b75ca0f766856eac 100755 --- a/lib_enc/ivas_stereo_mdct_core_enc.c +++ b/lib_enc/ivas_stereo_mdct_core_enc.c @@ -223,10 +223,8 @@ void stereo_mdct_core_enc( inv_spectrum[ch][1] = quantized_spectrum[ch][1]; mdst_spectrum[ch][0] = mdst_spectrum_long[ch]; mdst_spectrum[ch][1] = mdst_spectrum_long[ch] + N_TCX10_MAX; -#ifdef FIX_483b sts[ch]->hTcxEnc->tns_ms_flag[0] = 0; sts[ch]->hTcxEnc->tns_ms_flag[1] = 0; -#endif } @@ -279,11 +277,7 @@ void stereo_mdct_core_enc( for ( n = 0; n < nSubframes; n++ ) { -#ifdef FIX_483b if ( sts[ch]->hTcxEnc->tns_ms_flag[n] ) -#else - if ( !sts[ch]->hTcxEnc->fUseTns[n] ) -#endif { /* power spectrum: MDCT^2 + MDST^2 */ for ( i = 0; i < L_subframeTCX; i++ ) @@ -294,9 +288,7 @@ void stereo_mdct_core_enc( } else { -#ifdef FIX_483b if ( hStereoMdct->mdct_stereo_mode[n] != SMDCT_DUAL_MONO ) -#endif { /* power spectrum: MDCT^2 + MDST^2 */ powerSpecMsInv[ch][n][0] = inv_spectrum[ch][n][0] * inv_spectrum[ch][n][0]; diff --git a/lib_enc/ivas_stereo_mdct_stereo_enc.c b/lib_enc/ivas_stereo_mdct_stereo_enc.c index 97c9ebe7ff3121542df08033e79802da2d3afb81..b8ab5398ec4556f2e4177294ea8656d7c1c9ad40 100755 --- a/lib_enc/ivas_stereo_mdct_stereo_enc.c +++ b/lib_enc/ivas_stereo_mdct_stereo_enc.c @@ -430,10 +430,8 @@ void stereo_coder_tcx( if ( !sts[0]->hTcxEnc->fUseTns[k] && !sts[1]->hTcxEnc->fUseTns[k] ) { -#ifdef FIX_483b sts[0]->hTcxEnc->tns_ms_flag[k] = 1; sts[1]->hTcxEnc->tns_ms_flag[k] = 1; -#endif ms_inv_mask_processing( hStereoMdct, sts, ms_mask, k, mdst_spectrum[0][k], mdst_spectrum[1][k], inv_mdst_spectrum[0][k], inv_mdst_spectrum[1][k], -1 ); ms_processing( hStereoMdct, sts, ms_mask, k, mdst_spectrum[0][k], mdst_spectrum[1][k], sfbConf->sfbCnt ); } @@ -563,12 +561,10 @@ void ms_inv_mask_processing( { int16_t sfb; STEREO_MDCT_BAND_PARAMETERS *sfbConf; -#ifdef FIX_483b int16_t nSubframes, L_subframeTCX; nSubframes = ( sts[0]->hTcxEnc->tcxMode == TCX_20 ) ? 1 : NB_DIV; L_subframeTCX = sts[0]->hTcxEnc->L_frameTCX / nSubframes; -#endif sfbConf = ( sts[0]->core == TCX_20_CORE ) ? &hStereoMdct->stbParamsTCX20 : &hStereoMdct->stbParamsTCX10; if ( sts[0]->last_core == ACELP_CORE ) @@ -593,14 +589,12 @@ void ms_inv_mask_processing( } } -#ifdef FIX_483b /* set rest of inverse spectrum to zero */ if ( L_subframeTCX > sfbConf->sfbOffset[maxSfb] ) { set_zero( &x_inv_0[sfbConf->sfbOffset[maxSfb]], L_subframeTCX - sfbConf->sfbOffset[maxSfb] ); set_zero( &x_inv_1[sfbConf->sfbOffset[maxSfb]], L_subframeTCX - sfbConf->sfbOffset[maxSfb] ); } -#endif return; } diff --git a/lib_enc/lib_enc.c b/lib_enc/lib_enc.c index 1fe61ef2bfd7495e2e2aa57122508f26f3a049b6..28a733d3a3c8192f8bbf6bbec1890adf0575ea6c 100755 --- a/lib_enc/lib_enc.c +++ b/lib_enc/lib_enc.c @@ -197,9 +197,6 @@ ivas_error IVAS_ENC_Open( /* set high-level parameters */ st_ivas->mc_mode = MC_MODE_NONE; st_ivas->ism_mode = ISM_MODE_NONE; -#ifndef SBA_MODE_CLEAN_UP - st_ivas->sba_mode = SBA_MODE_NONE; -#endif st_ivas->sba_analysis_order = 0; return IVAS_ERR_OK; @@ -911,27 +908,16 @@ static ivas_error configureEncoder( return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "8kHz input sampling rate is not supported in IVAS." ); } -#ifdef FIX_170_DTX_MASA if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && ( ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || // ToDo: support for 3+ TCs to be done hEncoderConfig->ivas_format == MC_FORMAT // ToDo: TBD ) ) -#else - if ( hEncoderConfig->Opt_DTX_ON && hEncoderConfig->ivas_format != MONO_FORMAT && - ( ( hEncoderConfig->ivas_format == MASA_FORMAT && hEncoderConfig->ivas_total_brate > IVAS_128k ) || // ToDo: remove the bitrate limitation - ( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_get_sba_num_TCs( hEncoderConfig->ivas_total_brate, 1 ) > 2 ) || - hEncoderConfig->ivas_format == MC_FORMAT ) ) -#endif { return IVAS_ERROR( IVAS_ERR_DTX_NOT_SUPPORTED, "DTX is not supported in this IVAS format and element mode." ); } #ifdef DEBUG_AGC_ENCODER_CMD_OPTION -#ifndef SBA_MODE_CLEAN_UP - if ( hEncoderConfig->Opt_AGC_ON == SBA_AGC_FORCE_ENABLE && !( hEncoderConfig->ivas_format == SBA_FORMAT && ivas_sba_mode_select() == SBA_MODE_SPAR ) ) -#else if ( hEncoderConfig->Opt_AGC_ON == SBA_AGC_FORCE_ENABLE && !( hEncoderConfig->ivas_format == SBA_FORMAT ) ) -#endif { return IVAS_ERROR( IVAS_ERR_NOT_SUPPORTED_OPTION, "AGC supported in SBA format at bitrates >= 24.4 kbps only." ); } diff --git a/lib_enc/nois_est.c b/lib_enc/nois_est.c index bf506cd9db8d412e8f22fcc5d9d10d2bc4f691c0..b35b3612b569285381e7c7a171dcaee9e660dad0 100644 --- a/lib_enc/nois_est.c +++ b/lib_enc/nois_est.c @@ -378,7 +378,6 @@ void noise_est( { if ( st->hSpMusClas != NULL ) { -#ifdef FIX_483 float E; E = mean( lf_E, 8 ); @@ -391,15 +390,6 @@ void noise_est( st->hSpMusClas->ener_RAT = 10.0f * (float) log10( E ); st->hSpMusClas->ener_RAT /= ( Etot + 0.01f ); } -#else - st->hSpMusClas->ener_RAT = 10.0f * (float) log10( mean( lf_E, 8 ) ); - st->hSpMusClas->ener_RAT /= ( Etot + 0.01f ); - - if ( st->hSpMusClas->ener_RAT < 0.0f ) - { - st->hSpMusClas->ener_RAT = 0.0f; - } -#endif if ( st->hSpMusClas->ener_RAT > 1.0 ) { diff --git a/lib_enc/stat_enc.h b/lib_enc/stat_enc.h index 1a5c893dbd9816aa0c903d9bf64c86a0656ac730..762b8f6066e94f658f3dc04cccac84531106b2b1 100755 --- a/lib_enc/stat_enc.h +++ b/lib_enc/stat_enc.h @@ -1121,9 +1121,7 @@ typedef struct tcx_enc_structure float *acelp_zir; float tcx_target_bits_fac; -#ifdef FIX_483b int16_t tns_ms_flag[2]; -#endif } TCX_ENC_DATA, *TCX_ENC_HANDLE; /*----------------------------------------------------------------------------------* diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index ae66c4fcfcc5b08d5972b7e4c9aa923acfeffbd4..10f8743b230cce1a26c0255a5792acd6adfcd3a0 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -1292,13 +1292,8 @@ static ivas_error ivas_rend_crendConvolver( const CREND_WRAPPER *pCrend, IVAS_REND_AudioConfig inConfig, IVAS_REND_AudioConfig outConfig, -#ifdef JBM_TSM_ON_TCS float *pcm_in[], float *pcm_out[], -#else - float pcm_in[][L_FRAME48k], - float pcm_out[][L_FRAME48k], -#endif const int32_t output_Fs, const int16_t i_ts ) { @@ -1471,19 +1466,13 @@ ivas_error ivas_rend_crendProcess( HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: input/output audio channels */ -#else - float output[][L_FRAME48k], /* i/o: input/output audio channels */ -#endif const int32_t output_Fs ) { int16_t i, subframe_idx, output_frame, subframe_len; int16_t nchan_out; float pcm_tmp[BINAURAL_CHANNELS][L_FRAME48k]; -#ifdef JBM_TSM_ON_TCS float *p_pcm_tmp[BINAURAL_CHANNELS]; -#endif AUDIO_CONFIG in_config; IVAS_REND_AudioConfigType inConfigType; ivas_error error; @@ -1507,12 +1496,10 @@ ivas_error ivas_rend_crendProcess( output_frame = (int16_t) ( output_Fs / FRAMES_PER_SEC ); subframe_len = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < BINAURAL_CHANNELS; i++ ) { p_pcm_tmp[i] = pcm_tmp[i]; } -#endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { @@ -1537,22 +1524,14 @@ ivas_error ivas_rend_crendProcess( if ( ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) || ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, p_pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendConvolver( pCrend, inRendConfig, outRendConfig, output, pcm_tmp, output_Fs, subframe_idx ) ) != IVAS_ERR_OK ) -#endif { return error; } if ( pCrend->hCrend->hReverb != NULL ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, p_pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_reverb_process( pCrend->hCrend->hReverb, in_config, 1, output, pcm_tmp, subframe_idx ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -1576,7 +1555,6 @@ ivas_error ivas_rend_crendProcess( } -#ifdef JBM_TSM_ON_TCS /*-----------------------------------------------------------------------------------------* * Function ivas_rend_crendProcessSubframe() * @@ -1712,4 +1690,3 @@ ivas_error ivas_rend_crendProcessSubframe( return IVAS_ERR_OK; } -#endif diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c index a561f2ecd0af3ebf56dda2dff5b7a2adc797bcb3..2e4dbbabcb0238b9ff88a298e8fdc6ce0145a3ef 100644 --- a/lib_rend/ivas_dirac_dec_binaural_functions.c +++ b/lib_rend/ivas_dirac_dec_binaural_functions.c @@ -81,11 +81,7 @@ typedef struct hrtfGainCache * Local function prototypes *------------------------------------------------------------------------*/ -#ifdef JBM_TSM_ON_TCS static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float *output_f[], const int16_t nchan_transport, const int16_t subframe ); -#else -static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], const int16_t nchan_transport, const int16_t subframe ); -#endif static void ivas_dirac_dec_decorrelate_slot( DIRAC_DEC_HANDLE hDirAC, const int16_t slot, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float decRe[][CLDFB_NO_CHANNELS_MAX], float decIm[][CLDFB_NO_CHANNELS_MAX] ); #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH @@ -98,19 +94,11 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric static void ivas_dirac_dec_binaural_determine_processing_matrices( Decoder_Struct *st_ivas, const int16_t max_band_decorr, float Rmat[3][3] ); #endif -#ifdef JBM_TSM_ON_TCS static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float *output_f[], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, const int16_t nSlots, float Rmat[3][3] ); -#else -static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, float output_f[][L_FRAME48k], float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, const int16_t numInChannels, const int16_t subframe ); - -static void adaptTransportSignalsHeadtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, float Rmat[3][3] ); - -static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( HEAD_TRACK_DATA_HANDLE hHeadTrackData, float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, float Rmat[3][3] ); -#endif static void formulate2x2MixingMatrix( float Ein1, float Ein2, float CinRe, float CinIm, float Eout1, float Eout2, float CoutRe, float CoutIm, float Q[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mre[BINAURAL_CHANNELS][BINAURAL_CHANNELS], float Mim[BINAURAL_CHANNELS][BINAURAL_CHANNELS], const float regularizationFactor ); #ifdef FIX_511_OPTIMIZE_PARAMBIN_GAIN_FETCH @@ -258,7 +246,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( st_ivas->hDiracDecBin = hBinaural; -#ifdef JBM_TSM_ON_TCS /* allocate transport channels*/ if ( st_ivas->hDecoderConfig->voip_active == 1 && st_ivas->hTcBuffer == NULL ) { @@ -270,7 +257,6 @@ ivas_error ivas_dirac_dec_init_binaural_data( return error; } } -#endif return IVAS_ERR_OK; } @@ -351,7 +337,6 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs( } -#ifdef JBM_TSM_ON_TCS /*------------------------------------------------------------------------- * void ivas_dirac_dec_binaural_render() * @@ -418,7 +403,6 @@ void ivas_dirac_dec_binaural_render( return; } -#endif /*------------------------------------------------------------------------- @@ -434,7 +418,6 @@ void ivas_dirac_dec_binaural( ) { int16_t subframe; -#ifdef JBM_TSM_ON_TCS float cng_td_buffer[L_FRAME16k]; float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; @@ -457,53 +440,35 @@ void ivas_dirac_dec_binaural( } ivas_dirac_dec_set_md_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { ivas_spar_dec_set_render_map( st_ivas, DEFAULT_JBM_CLDFB_TIMESLOTS ); } -#endif if ( st_ivas->hDiracDecBin->useTdDecorr ) { float *decorr_signal[BINAURAL_CHANNELS]; -#ifndef JBM_TSM_ON_TCS - int16_t ch; -#endif int16_t output_frame; for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { decorr_signal[ch] = (float *) &( output_f[ch + BINAURAL_CHANNELS][0] ); -#ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer->tc[ch + BINAURAL_CHANNELS] = decorr_signal[ch]; -#endif } output_frame = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ); -#ifdef JBM_TSM_ON_TCS ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, p_output, decorr_signal, output_frame ); - -#else - ivas_td_decorr_process( st_ivas->hDiracDecBin->hTdDecorr, output_f, decorr_signal, output_frame ); -#endif } -#ifdef JBM_TSM_ON_TCS if ( nchan_transport == 1 && st_ivas->nchan_transport != 2 && st_ivas->hSCE[0]->hCoreCoder[0] != NULL && st_ivas->hSCE[0]->hCoreCoder[0]->cng_sba_flag ) { Decoder_State *st = st_ivas->hSCE[0]->hCoreCoder[0]; st_ivas->hTcBuffer->tc[nchan_transport] = &cng_td_buffer[0]; generate_masking_noise_lb_dirac( st->hFdCngDec->hFdCngCom, st_ivas->hTcBuffer->tc[nchan_transport], DEFAULT_JBM_CLDFB_TIMESLOTS, st->cna_dirac_flag && st->flag_cna ); } -#endif for ( subframe = 0; subframe < MAX_PARAM_SPATIAL_SUBFRAMES; subframe++ ) { -#ifdef JBM_TSM_ON_TCS int16_t n_samples_sf = slot_size * st_ivas->hDirAC->subframe_nbslots[subframe]; ivas_dirac_dec_binaural_internal( st_ivas, p_output, nchan_transport, subframe ); @@ -513,17 +478,12 @@ void ivas_dirac_dec_binaural( p_output[ch] += n_samples_sf; } st_ivas->hDirAC->dirac_read_idx = ( st_ivas->hDirAC->dirac_read_idx + 1 ) % st_ivas->hDirAC->dirac_md_buffer_length; -#else - ivas_dirac_dec_binaural_internal( st_ivas, output_f, nchan_transport, subframe ); -#endif } -#ifdef JBM_TSM_ON_TCS for ( ch = 0; ch < 2 * BINAURAL_CHANNELS; ch++ ) { st_ivas->hTcBuffer->tc[ch] = NULL; } -#endif return; } @@ -536,11 +496,7 @@ void ivas_dirac_dec_binaural( static void ivas_dirac_dec_binaural_internal( Decoder_Struct *st_ivas, -#ifdef JBM_TSM_ON_TCS float *output_f[], -#else - float output_f[][L_FRAME48k], -#endif const int16_t nchan_transport, const int16_t subframe ) { @@ -555,11 +511,7 @@ static void ivas_dirac_dec_binaural_internal( hDirAC = st_ivas->hDirAC; nBins = hDirAC->num_freq_bands; -#ifdef JBM_TSM_ON_TCS offsetSamples = hDirAC->slots_rendered * nBins; -#else - offsetSamples = subframe * CLDFB_SLOTS_PER_SUBFRAME * nBins; -#endif /* The input channel number at this processing function (not nchan_transport) */ numInChannels = BINAURAL_CHANNELS; @@ -581,22 +533,14 @@ static void ivas_dirac_dec_binaural_internal( Rmat[2][2] = 1.0f; /* CLDFB Analysis of input */ -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( ch = 0; ch < numInChannels; ch++ ) { if ( ch == 0 || nchan_transport == 2 ) { cldfbAnalysis_ts( -#ifdef JBM_TSM_ON_TCS &( st_ivas->hTcBuffer->tc[ch][nBins * slot + offsetSamples] ), -#else - &( output_f[ch][nBins * slot + offsetSamples] ), -#endif Cldfb_RealBuffer_in[ch][slot], Cldfb_ImagBuffer_in[ch][slot], nBins, st_ivas->cldfbAnaDec[ch] ); @@ -616,19 +560,11 @@ static void ivas_dirac_dec_binaural_internal( int16_t slotInFrame; numCoreBands = st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom->numCoreBands; -#ifdef JBM_TSM_ON_TCS slotInFrame = hDirAC->slots_rendered + slot; -#else - slotInFrame = subframe * CLDFB_SLOTS_PER_SUBFRAME + slot; -#endif generate_masking_noise_dirac( st_ivas->hSCE[0]->hCoreCoder[0]->hFdCngDec->hFdCngCom, st_ivas->cldfbAnaDec[1], -#ifdef JBM_TSM_ON_TCS st_ivas->hTcBuffer->tc[nchan_transport], -#else - &( output_f[1][L_FRAME48k - L_FRAME16k] ), /*used as temporary static buffer for the whole frame*/ -#endif Cldfb_RealBuffer_in[2][slot], Cldfb_ImagBuffer_in[2][slot], slotInFrame, st_ivas->hSCE[0]->hCoreCoder[0]->cna_dirac_flag && st_ivas->hSCE[0]->hCoreCoder[0]->flag_cna, @@ -681,11 +617,7 @@ static void ivas_dirac_dec_binaural_internal( for ( ch = BINAURAL_CHANNELS; ch < ( 2 * BINAURAL_CHANNELS ); ch++ ) { cldfbAnalysis_ts( -#ifdef JBM_TSM_ON_TCS &( st_ivas->hTcBuffer->tc[ch][nBins * slot + offsetSamples] ), -#else - &( output_f[ch][nBins * slot + offsetSamples] ), -#endif Cldfb_RealBuffer_in[ch][slot], Cldfb_ImagBuffer_in[ch][slot], nBins, st_ivas->cldfbAnaDec[ch] ); @@ -699,11 +631,7 @@ static void ivas_dirac_dec_binaural_internal( } } -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR ) -#else if ( st_ivas->ivas_format == SBA_FORMAT ) -#endif { st_ivas->hDirAC->hDiffuseDist = &diffuseDistData; @@ -718,15 +646,9 @@ static void ivas_dirac_dec_binaural_internal( if ( nchan_transport == 2 ) { -#ifdef JBM_TSM_ON_TCS adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, hDirAC->subframe_nbslots[subframe], Rmat ); -#else - adaptTransportSignalsHeadtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, Rmat ); - - ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( st_ivas->hHeadTrackData, Cldfb_RealBuffer_in, Cldfb_ImagBuffer_in, nBins, Rmat ); -#endif } } @@ -759,12 +681,8 @@ static void ivas_dirac_dec_binaural_internal( st_ivas->hDirAC->hDiffuseDist = NULL; -#ifdef JBM_TSM_ON_TCS hDirAC->slots_rendered += hDirAC->subframe_nbslots[subframe]; hDirAC->subframes_rendered++; -#else - hDirAC->dirac_read_idx = ( hDirAC->dirac_read_idx + 1 ) % hDirAC->dirac_md_buffer_length; -#endif return; } @@ -821,9 +739,6 @@ static void ivas_dirac_dec_decorrelate_slot( return; } -#ifdef JBM_TSM_ON_TCS -#endif - static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matrices( Decoder_Struct *st_ivas, @@ -901,18 +816,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric /* Formulate input and target covariance matrices for this subframe */ set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); -#ifdef JBM_TSM_ON_TCS dirac_read_idx = hDirAC->render_to_md_map[subframe]; -#else - dirac_read_idx = hDirAC->dirac_read_idx; -#endif /* Calculate input covariance matrix */ -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) -#else - for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) -#endif { for ( bin = 0; bin < nBins; bin++ ) { @@ -953,11 +860,7 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric set_zero( subFrameTotalEne, CLDFB_NO_CHANNELS_MAX ); -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < hDirAC->subframe_nbslots[subframe]; slot++ ) -#else - for ( slot = 0; slot < hDirAC->subframe_nbslots; slot++ ) -#endif { for ( bin = 0; bin < nBins; bin++ ) { @@ -1185,18 +1088,10 @@ static void ivas_dirac_dec_binaural_formulate_input_and_target_covariance_matric } else /* When rendering binaural, ambience has frequency dependent ICC. */ { -#ifndef SBA_MODE_CLEAN_UP - if ( st_ivas->ivas_format == SBA_FORMAT && st_ivas->sba_mode == SBA_MODE_SPAR && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) -#else if ( st_ivas->ivas_format == SBA_FORMAT && bin < BINAURAL_COHERENCE_DIFFERENCE_BINS ) -#endif { float diffuseFieldCoherence; -#ifdef JBM_TSM_ON_TCS diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[bin] * h->diffuseFieldCoherenceZ[bin]; -#else - diffuseFieldCoherence = hDirAC->hDiffuseDist->diffuseRatioX[subframe][bin] * h->diffuseFieldCoherenceX[bin] + hDirAC->hDiffuseDist->diffuseRatioY[subframe][bin] * h->diffuseFieldCoherenceY[bin] + hDirAC->hDiffuseDist->diffuseRatioZ[subframe][bin] * h->diffuseFieldCoherenceZ[bin]; -#endif h->ChCrossReOut[bin] += ( ( 1.0f - surCoh ) * diffuseFieldCoherence + surCoh ) * diffEne; } else @@ -1469,11 +1364,7 @@ static void ivas_dirac_dec_binaural_determine_processing_matrices( static void ivas_dirac_dec_binaural_process_output( Decoder_Struct *st_ivas, -#ifdef JBM_TSM_ON_TCS float *output_f[], -#else - float output_f[][L_FRAME48k], -#endif float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t max_band_decorr, @@ -1491,41 +1382,23 @@ static void ivas_dirac_dec_binaural_process_output( float *decSlotRePointer; float *decSlotImPointer; int16_t offsetSamples; -#ifdef JBM_TSM_ON_TCS int16_t nSlots; -#endif h = st_ivas->hDiracDecBin; nBins = st_ivas->hDirAC->num_freq_bands; -#ifdef JBM_TSM_ON_TCS offsetSamples = 0; nSlots = st_ivas->hDirAC->subframe_nbslots[subframe]; -#else - offsetSamples = subframe * CLDFB_SLOTS_PER_SUBFRAME * nBins; -#endif if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { /* Process second / room effect part of binaural output when needed */ -#ifdef JBM_TSM_ON_TCS ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, nSlots, inRe, inIm, reverbRe, reverbIm ); -#else - ivas_binaural_reverb_processSubframe( st_ivas->hDiracDecBin->hReverb, numInChannels, inRe, inIm, reverbRe, reverbIm ); -#endif } interpVal = 0.0f; -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { -#ifdef JBM_TSM_ON_TCS interpVal += 1.0f / (float) nSlots; -#else - interpVal += 1.0f / ( (float) CLDFB_SLOTS_PER_SUBFRAME ); -#endif if ( !st_ivas->hDiracDecBin->useTdDecorr && max_band_decorr > 0 ) { ivas_dirac_dec_decorrelate_slot( st_ivas->hDirAC, slot, inRe, inIm, decSlotRe, decSlotIm ); @@ -1607,9 +1480,7 @@ static void adaptTransportSignalsHeadtracked( float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, -#ifdef JBM_TSM_ON_TCS const int16_t nSlots, -#endif float Rmat[3][3] ) { int16_t slot, ch, bin, louderCh; @@ -1641,11 +1512,7 @@ static void adaptTransportSignalsHeadtracked( for ( ch = 0; ch < 2; ch++ ) { ch_nrg[ch] = 0.0f; -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( bin = bin_lo; bin < bin_hi; bin++ ) { @@ -1681,11 +1548,7 @@ static void adaptTransportSignalsHeadtracked( { float band_nrg = 0.0f; -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( bin = bin_lo; bin < bin_hi; bin++ ) { @@ -1711,11 +1574,7 @@ static void adaptTransportSignalsHeadtracked( ene_proc = hHeadTrackData->procChEneIIR[0][band_idx] + hHeadTrackData->procChEneIIR[1][band_idx]; eqVal = fminf( 4.0f, sqrtf( ene_target / fmaxf( 1e-12f, ene_proc ) ) ); -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( ch = 0; ch < 2; ch++ ) { @@ -1736,9 +1595,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( float inRe[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], float inIm[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], const int16_t nBins, -#ifdef JBM_TSM_ON_TCS const int16_t nSlots, -#endif float Rmat[3][3] ) { int16_t slot, bin, ch; @@ -1761,11 +1618,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( /* When currently in interpolation */ if ( hHeadTrackData->lrSwitchedNext != hHeadTrackData->lrSwitchedCurrent ) { -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { float switchOrderFactor, origOrderFactor; @@ -1821,11 +1674,7 @@ static void ivas_dirac_dec_binaural_check_and_switch_transports_headtracked( /* If not in interpolation, but in switched prototype situation, then switch left and right channels */ if ( hHeadTrackData->lrSwitchedCurrent == 1 ) { -#ifdef JBM_TSM_ON_TCS for ( slot = 0; slot < nSlots; slot++ ) -#else - for ( slot = 0; slot < CLDFB_SLOTS_PER_SUBFRAME; slot++ ) -#endif { for ( bin = 0; bin < nBins; bin++ ) { diff --git a/lib_rend/ivas_limiter.c b/lib_rend/ivas_limiter.c index 7875165e51d0ce47be819eba3bd6124fe92061be..106c4330341b0e42e8b30ab1db2470cd31d62740 100644 --- a/lib_rend/ivas_limiter.c +++ b/lib_rend/ivas_limiter.c @@ -171,15 +171,11 @@ void ivas_limiter_close( *-------------------------------------------------------------------*/ void ivas_limiter_dec( - IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ -#ifdef JBM_TSM_ON_TCS + IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ -#else - float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], /* i/o: input/output buffer */ -#endif - const int16_t num_channels, /* i : number of channels to be processed */ - const int16_t output_frame, /* i : number of samples per channel in the buffer */ - const int16_t BER_detect /* i : BER detect flag */ + const int16_t num_channels, /* i : number of channels to be processed */ + const int16_t output_frame, /* i : number of samples per channel in the buffer */ + const int16_t BER_detect /* i : BER detect flag */ ) { int16_t c; diff --git a/lib_rend/ivas_objectRenderer.c b/lib_rend/ivas_objectRenderer.c index 2f5b406c66cedfe26113c93f8d5214f1c45cbe53..4d324e60f36c5526f52f50dd90310cdbbc1b7ece 100644 --- a/lib_rend/ivas_objectRenderer.c +++ b/lib_rend/ivas_objectRenderer.c @@ -263,25 +263,16 @@ ivas_error ivas_td_binaural_renderer_unwrap( const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ -#ifdef FIX_356_ISM_METADATA_SYNC - const int16_t ism_md_subframe_update, /* i: Number of subframes to delay ism metadata to sync with audio */ -#endif -#ifdef JBM_TSM_ON_TCS - float *output[], /* i/o: SCE channels / Binaural synthesis */ -#else - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ -#endif - const int16_t output_frame /* i : output frame length */ + const int16_t ism_md_subframe_update, /* i: Number of subframes to delay ism metadata to sync with audio */ + float *output[], /* i/o: SCE channels / Binaural synthesis */ + const int16_t output_frame /* i : output frame length */ ) { int16_t subframe_length; int16_t subframe_idx; float reverb_signal[BINAURAL_CHANNELS][L_FRAME48k]; ivas_error error; -#ifdef FIX_356_ISM_METADATA_SYNC int16_t c_indx, nS; -#endif -#ifdef JBM_TSM_ON_TCS float *p_reverb_signal[BINAURAL_CHANNELS]; int16_t ch; @@ -289,11 +280,9 @@ ivas_error ivas_td_binaural_renderer_unwrap( { p_reverb_signal[ch] = reverb_signal[ch]; } -#endif subframe_length = output_frame / MAX_PARAM_SPATIAL_SUBFRAMES; -#ifdef FIX_356_ISM_METADATA_SYNC c_indx = 0; for ( nS = 0; nS < num_src; nS++ ) { @@ -304,41 +293,27 @@ ivas_error ivas_td_binaural_renderer_unwrap( c_indx++; } } -#else - /* Update object position(s) */ - TDREND_Update_object_positions( hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, output ); -#endif for ( subframe_idx = 0; subframe_idx < MAX_PARAM_SPATIAL_SUBFRAMES; subframe_idx++ ) { -#ifdef FIX_356_ISM_METADATA_SYNC if ( subframe_idx == ism_md_subframe_update ) { /* Update object position(s) */ TDREND_Update_object_positions( hBinRendererTd, num_src, ivas_format, hIsmMetaData ); } -#endif /* Update the listener's location/orientation */ TDREND_Update_listener_orientation( hBinRendererTd, Opt_Headrotation, ( Quaternions != NULL ) ? &Quaternions[subframe_idx] : NULL, ( Pos != NULL ) ? &Pos[subframe_idx] : NULL ); if ( hReverb != NULL && hReverb->pConfig.roomAcoustics.late_reverb_on ) { -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_reverb_process( hReverb, transport_config, 0, output, p_reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_reverb_process( hReverb, transport_config, 0, output, reverb_signal, subframe_idx ) ) != IVAS_ERR_OK ) -#endif { return error; } } /* Render subframe */ -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx, ism_md_subframe_update ) ) != IVAS_ERR_OK ) -#else - if ( ( error = TDREND_GetMix( hBinRendererTd, output, subframe_length, subframe_idx ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -363,18 +338,10 @@ ivas_error ivas_td_binaural_renderer_unwrap( ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ -#ifdef JBM_TSM_ON_TCS - float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ -#else - float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ -#endif - const int16_t subframe_length, /* i/o: subframe length */ -#ifdef FIX_356_ISM_METADATA_SYNC - const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ - const int16_t ism_md_subframe_update /* Number of subframes to delay ism metadata to sync with audio */ -#else - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#endif + float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ + const int16_t subframe_length, /* i/o: subframe length */ + const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ + const int16_t ism_md_subframe_update /* Number of subframes to delay ism metadata to sync with audio */ ) { int16_t i; @@ -387,11 +354,9 @@ ivas_error TDREND_GetMix( float hrf_right_delta[SFX_SPAT_BIN_MAX_FILTER_LENGTH]; int16_t intp_count; float pan_left, pan_right; -#ifdef FIX_356_ISM_METADATA_SYNC int16_t subframe_update_flag; subframe_update_flag = subframe_idx == ism_md_subframe_update; -#endif error = IVAS_ERR_OK; @@ -416,11 +381,7 @@ ivas_error TDREND_GetMix( if ( ( SrcRend_p->PlayStatus == TDREND_PLAYSTATUS_PLAYING ) && ( hBinRendererTd->Listener_p->PoseUpdated || SrcSpatial_p->Updated ) ) { TDREND_SRC_REND_UpdateFiltersFromSpatialParams( hBinRendererTd, SrcRend_p, SrcSpatial_p, Src_p->hrf_left_prev, -#ifdef FIX_356_ISM_METADATA_SYNC Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_update_flag ); -#else - Src_p->hrf_right_prev, hrf_left_delta, hrf_right_delta, &intp_count, &Src_p->filterlength, &Src_p->itd, &Src_p->Gain, Src_p, subframe_idx ); -#endif } /* Render source if needed */ @@ -481,45 +442,20 @@ static void TDREND_Clear_Update_flags( void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ -#ifndef FIX_356_ISM_METADATA_SYNC - const int16_t lfe_idx, /* i : Input LFE index */ -#endif - const IVAS_FORMAT in_format, /* i : Format of input sources */ - const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ -#ifndef FIX_356_ISM_METADATA_SYNC - , -#ifdef JBM_TSM_ON_TCS - float *output[] /* i/o: SCE/MC channels */ -#else - float output[][L_FRAME48k] /* i/o: SCE/MC channels */ -#endif -#endif + const IVAS_FORMAT in_format, /* i : Format of input sources */ + const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ ) { TDREND_DirAtten_t *DirAtten_p; int16_t nS; float Pos[3]; float Dir[3]; -#ifndef FIX_356_ISM_METADATA_SYNC - int16_t c_indx; -#endif DirAtten_p = hBinRendererTd->DirAtten_p; /* For each source, write the frame data to the source object*/ -#ifndef FIX_356_ISM_METADATA_SYNC - c_indx = 0; -#endif for ( nS = 0; nS < num_src; nS++ ) { -#ifndef FIX_356_ISM_METADATA_SYNC - if ( !( in_format == MC_FORMAT && nS == lfe_idx ) ) /* Skip LFE for MC */ - { - hBinRendererTd->Sources[c_indx]->InputFrame_p = output[nS]; - hBinRendererTd->Sources[c_indx]->SrcRend_p->InputAvailable = TRUE; - c_indx++; - } -#endif if ( in_format == ISM_FORMAT ) { /* Update the source positions */ @@ -527,13 +463,6 @@ void TDREND_Update_object_positions( angles_to_vec( hIsmMetaData[nS]->radius, hIsmMetaData[nS]->azimuth, hIsmMetaData[nS]->elevation, Pos ); angles_to_vec( 1.0f, hIsmMetaData[nS]->yaw, hIsmMetaData[nS]->pitch, Dir ); -#ifndef FIX_463_TD_RENDERER_DIRECTIVITY_RESET - - /* Source directivity info */ - DirAtten_p->ConeInnerAngle = 360.0f; - DirAtten_p->ConeOuterAngle = 360.0f; - DirAtten_p->ConeOuterGain = 1.0f; -#endif TDREND_MIX_SRC_SetPos( hBinRendererTd, nS, Pos ); TDREND_MIX_SRC_SetDirAtten( hBinRendererTd, nS, DirAtten_p ); @@ -689,10 +618,7 @@ ivas_error ivas_td_binaural_renderer_ext( IVAS_REND_AudioConfigType inConfigType; AUDIO_CONFIG transport_config; ivas_error error; -#ifdef FIX_356_ISM_METADATA_SYNC int16_t ism_md_subframe_update_ext; -#endif -#ifdef JBM_TSM_ON_TCS float *p_output[MAX_OUTPUT_CHANNELS]; int16_t ch; @@ -700,16 +626,13 @@ ivas_error ivas_td_binaural_renderer_ext( { p_output[ch] = output[ch]; } -#endif push_wmops( "ivas_td_binaural_renderer_ext" ); inConfigType = getAudioConfigType( inConfig ); lfe_idx = LFE_CHANNEL; hIsmMetaData[0] = NULL; -#ifdef FIX_356_ISM_METADATA_SYNC ism_md_subframe_update_ext = 0; -#endif if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) { @@ -742,27 +665,9 @@ ivas_error ivas_td_binaural_renderer_ext( hIsmMetaData[0]->non_diegetic_flag = currentPos->non_diegetic_flag; } -#ifdef JBM_TSM_ON_TCS -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, ( headRotData != NULL ) ? headRotData->headPositions : NULL, ( headRotData != NULL ) ? headRotData->Pos : NULL, ism_md_subframe_update_ext, p_output, output_frame ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, - ( headRotData != NULL ) ? headRotData->Pos : NULL, p_output, output_frame ) ) != IVAS_ERR_OK ) -#endif -#else -#ifdef FIX_356_ISM_METADATA_SYNC - if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, - ( headRotData != NULL ) ? headRotData->Pos : NULL, ism_md_subframe_update_ext, output, output_frame ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_td_binaural_renderer_unwrap( hReverb, transport_config, pTDRend->hBinRendererTd, num_src, lfe_idx, ivas_format, hIsmMetaData, headRotData->headRotEnabled, - ( headRotData != NULL ) ? headRotData->headPositions : NULL, - ( headRotData != NULL ) ? headRotData->Pos : NULL, output, output_frame ) ) != IVAS_ERR_OK ) -#endif -#endif { return error; } diff --git a/lib_rend/ivas_objectRenderer_sources.c b/lib_rend/ivas_objectRenderer_sources.c index 146827357200dd85373647ae21dc102bea6d5b6f..456b406b1d6ff39b8b9d7a023b2d961f1504b784 100644 --- a/lib_rend/ivas_objectRenderer_sources.c +++ b/lib_rend/ivas_objectRenderer_sources.c @@ -259,12 +259,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( int16_t *itd, /* o: ITD value */ float *Gain, /* o: Gain value */ TDREND_SRC_t *Src_p, /* i/o: Source pointer */ -#ifdef FIX_356_ISM_METADATA_SYNC - const int16_t subframe_update_flag -#else - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#endif -) + const int16_t subframe_update_flag ) { TDREND_MIX_Listener_t *Listener_p; TDREND_HRFILT_FiltSet_t *HrFiltSet_p; @@ -357,11 +352,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( azim_delta = ( azim_delta > 180.0f ) ? ( azim_delta - 360 ) : ( ( azim_delta < -180.0f ) ? ( azim_delta + 360 ) : ( azim_delta ) ); /* map to -180:180 range */ *intp_count = min( MAX_INTERPOLATION_STEPS, max( (int16_t) ( fabsf( azim_delta ) * MAX_ANGULAR_STEP_INV ), (int16_t) ( fabsf( elev_delta ) * MAX_ANGULAR_STEP_INV ) ) ); -#ifdef FIX_356_ISM_METADATA_SYNC if ( ( *intp_count > 0 ) && subframe_update_flag ) -#else - if ( ( *intp_count > 0 ) && subframe_idx == 0 ) -#endif { /* Set deltas for interpolation */ v_sub( hrf_left, hrf_left_prev, hrf_left_delta, *filterlength ); diff --git a/lib_rend/ivas_orient_trk.c b/lib_rend/ivas_orient_trk.c index ae646b4d5c4b05f4164366730274e152ef58de92..e05c8061dd406a900bcb5836f8386e3080f6c2cb 100644 --- a/lib_rend/ivas_orient_trk.c +++ b/lib_rend/ivas_orient_trk.c @@ -406,11 +406,7 @@ ivas_error ivas_orient_trk_Init( pOTR->refRot = identity; /* set safe default tracking mode */ -#ifdef FIX_439_OTR_PARAMS pOTR->orientation_tracking = HEAD_ORIENT_TRK_NONE; -#else - pOTR->trackingType = OTR_TRACKING_NONE; -#endif return IVAS_ERR_OK; } @@ -423,12 +419,8 @@ ivas_error ivas_orient_trk_Init( *-------------------------------------------------------------------*/ ivas_error ivas_orient_trk_SetTrackingType( - ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ -#ifdef FIX_439_OTR_PARAMS + ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ const HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ -#else - const OTR_TRACKING_T trackingType /* i/o: orientation tracking type */ -#endif ) { if ( pOTR == NULL ) @@ -436,11 +428,7 @@ ivas_error ivas_orient_trk_SetTrackingType( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_439_OTR_PARAMS pOTR->orientation_tracking = orientation_tracking; -#else - pOTR->trackingType = trackingType; -#endif return IVAS_ERR_OK; } @@ -491,35 +479,17 @@ ivas_error ivas_orient_trk_GetMainOrientation( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_439_OTR_PARAMS switch ( pOTR->orientation_tracking ) -#else - switch ( pOTR->trackingType ) -#endif { -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: -#else - case OTR_TRACKING_NONE: -#endif *pOrientation = IdentityQuaternion(); break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_REF_VEC: case HEAD_ORIENT_TRK_REF_VEC_LEV: case HEAD_ORIENT_TRK_REF: -#else - case OTR_TRACKING_REF_VEC: - case OTR_TRACKING_REF_VEC_LEV: - case OTR_TRACKING_REF_ORIENT: -#endif *pOrientation = pOTR->refRot; break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_AVG: -#else - case OTR_TRACKING_AVG_ORIENT: -#endif *pOrientation = pOTR->absAvgRot; break; } @@ -571,30 +541,15 @@ ivas_error ivas_orient_trk_SetReferenceVector( return IVAS_ERR_UNEXPECTED_NULL_POINTER; } -#ifdef FIX_439_OTR_PARAMS switch ( pOTR->orientation_tracking ) -#else - switch ( pOTR->trackingType ) -#endif { -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: case HEAD_ORIENT_TRK_REF: case HEAD_ORIENT_TRK_AVG: case HEAD_ORIENT_TRK_REF_VEC: -#else - case OTR_TRACKING_NONE: - case OTR_TRACKING_REF_ORIENT: - case OTR_TRACKING_AVG_ORIENT: - case OTR_TRACKING_REF_VEC: -#endif acousticFrontVector = VectorSubtract( listenerPos, refPos ); break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_REF_VEC_LEV: -#else - case OTR_TRACKING_REF_VEC_LEV: -#endif /* ignore the height difference between listener position and reference position */ listenerPosLevel.z = refPosLevel.z = listenerPos.z; listenerPosLevel.x = listenerPos.x; @@ -652,28 +607,14 @@ ivas_error ivas_orient_trk_Process( result = IVAS_ERR_OK; -#ifdef FIX_439_OTR_PARAMS switch ( pOTR->orientation_tracking ) -#else - switch ( pOTR->trackingType ) -#endif { -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_NONE: -#else - case OTR_TRACKING_NONE: -#endif pOTR->trkRot = absRot; break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_REF: case HEAD_ORIENT_TRK_REF_VEC: case HEAD_ORIENT_TRK_REF_VEC_LEV: -#else - case OTR_TRACKING_REF_VEC: - case OTR_TRACKING_REF_VEC_LEV: - case OTR_TRACKING_REF_ORIENT: -#endif /* Reset average orientation */ pOTR->absAvgRot = absRot; @@ -685,11 +626,7 @@ ivas_error ivas_orient_trk_Process( QuaternionProduct( pOTR->trkRot, absRot, &pOTR->trkRot ); break; -#ifdef FIX_439_OTR_PARAMS case HEAD_ORIENT_TRK_AVG: -#else - case OTR_TRACKING_AVG_ORIENT: -#endif /* Compute average (low-pass filtered) absolute orientation */ QuaternionSlerp( pOTR->absAvgRot, absRot, alpha, &pOTR->absAvgRot ); diff --git a/lib_rend/ivas_prot_rend.h b/lib_rend/ivas_prot_rend.h index ac9e765abee7c7f79b49dcd26c28f71ff4bf6ecb..e1328ca9d39c67b55bc21140c93dd854e95a3f1c 100644 --- a/lib_rend/ivas_prot_rend.h +++ b/lib_rend/ivas_prot_rend.h @@ -92,11 +92,7 @@ void ivas_limiter_close( void ivas_limiter_dec ( IVAS_LIMITER_HANDLE hLimiter, /* i/o: limiter struct handle */ -#ifdef JBM_TSM_ON_TCS float *output[MAX_OUTPUT_CHANNELS], /* i/o: input/output buffer */ -#else - float output[MAX_OUTPUT_CHANNELS][L_FRAME48k], /* i/o: input/output buffer */ -#endif const int16_t num_channels, /* i : number of channels to be processed */ const int16_t output_frame, /* i : number of samples per channel in the buffer */ const int16_t BER_detect /* i : BER detect flag */ @@ -159,7 +155,6 @@ void ivas_dirac_dec_binaural( const int16_t nchan_transport /* i : number of transport channels */ ); -#ifdef JBM_TSM_ON_TCS void ivas_dirac_dec_binaural_render( Decoder_Struct *st_ivas, /* i/o: IVAS decoder handle */ const uint16_t nSamplesAsked, /* i : number of CLDFB slots requested */ @@ -168,7 +163,6 @@ void ivas_dirac_dec_binaural_render( const int16_t nchan_transport, /* i : number of transport channels */ float *output_f[] /* o : rendered time signal */ ); -#endif ivas_error ivas_dirac_dec_init_binaural_data( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ @@ -236,14 +230,8 @@ ivas_error ivas_td_binaural_renderer_unwrap( const int16_t Opt_Headrotation, /* i : Head rotation flag */ const IVAS_QUATERNION *Quaternions, /* i : Head tracking data per subframe */ const IVAS_VECTOR3 *Pos, /* i : Listener position data per subframe */ -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t ism_md_subframe_update, -#endif -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: SCE channels / Binaural synthesis */ -#else - float output[][L_FRAME48k], /* i/o: SCE channels / Binaural synthesis */ -#endif const int16_t output_frame /* i : output frame length */ ); @@ -285,18 +273,10 @@ void ivas_td_binaural_close( ivas_error TDREND_GetMix( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o: TD renderer handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: ISM object synth / rendered output in 0,1 */ -#else - float output[][L_FRAME48k], /* i/o: ISM object synth / rendered output in 0,1 */ -#endif const int16_t subframe_length, /* i/o: subframe length */ -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t subframe_idx, /* i : Subframe index to 5 ms subframe */ const int16_t ism_md_subframe_update /* Number of subframes to delay metadata to sync with audio */ -#else - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#endif ); void TDREND_Update_listener_orientation( @@ -309,19 +289,8 @@ void TDREND_Update_listener_orientation( void TDREND_Update_object_positions( BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd, /* i/o : TD Renderer handle */ const int16_t num_src, /* i : number of sources to render */ -#ifndef FIX_356_ISM_METADATA_SYNC - const int16_t lfe_idx, /* i : Input LFE index */ -#endif const IVAS_FORMAT in_format, /* i : Format of input sources */ const ISM_METADATA_HANDLE *hIsmMetaData /* i : Input metadata for ISM objects */ -#ifndef FIX_356_ISM_METADATA_SYNC - , -#ifdef JBM_TSM_ON_TCS - float *output[] /* i/o: SCE/MC channels */ -#else - float output[][L_FRAME48k] /* i/o: SCE/MC channels */ -#endif -#endif ); void BSplineModelEvalDealloc( @@ -392,11 +361,7 @@ void TDREND_SRC_REND_UpdateFiltersFromSpatialParams( int16_t *itd, /* o: ITD value */ float *Gain, /* o: Gain value */ TDREND_SRC_t *Src_p, -#ifdef FIX_356_ISM_METADATA_SYNC const int16_t subframe_update_flag /* i : Flag to determine update subframe idx */ -#else - const int16_t subframe_idx /* i : Subframe index to 5 ms subframe */ -#endif ); ivas_error TDREND_SRC_Alloc( @@ -538,15 +503,10 @@ ivas_error ivas_rend_crendProcess( HEAD_TRACK_DATA_HANDLE hHeadTrackData, IVAS_OUTPUT_SETUP_HANDLE hIntSetup, EFAP_HANDLE hEFAPdata, -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: input/output audio channels */ -#else - float output[][L_FRAME48k], /* i/o: input/output audio channels */ -#endif const int32_t output_Fs ); -#ifdef JBM_TSM_ON_TCS ivas_error ivas_rend_crendProcessSubframe( const CREND_WRAPPER *pCrend, /* i/o: Crend wrapper handle */ const AUDIO_CONFIG inConfig, /* i : input audio configuration */ @@ -561,7 +521,6 @@ ivas_error ivas_rend_crendProcessSubframe( const int16_t n_samples_to_render, /* i : output frame length per channel */ const int32_t output_Fs /* i : output sampling rate */ ); -#endif /*----------------------------------------------------------------------------------* * Reverberator @@ -586,17 +545,13 @@ void ivas_binaural_reverb_close( void ivas_binaural_reverb_processSubframe( REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ const int16_t numInChannels, /* i : num input channels to be processed */ -#ifdef JBM_TSM_ON_TCS const int16_t numSlots, /* i : number of slots to be processed */ -#endif float inReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real */ float inImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ float outReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ float outImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX] /* o : output CLDFB data imag */ ); -#ifdef JBM_TSM_ON_TCS -#endif ivas_error ivas_reverb_open( REVERB_HANDLE *hReverb, /* i/o: Reverberator handle */ @@ -614,13 +569,8 @@ ivas_error ivas_reverb_process( const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const int16_t mix_signals, /* i : add reverb to output signal */ -#ifdef JBM_TSM_ON_TCS float *pcm_in[], /* i : the PCM audio to apply reverb on */ float *pcm_out[], /* o : the PCM audio with reverb applied */ -#else - float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ - float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ -#endif const int16_t i_ts /* i : subframe index */ ); @@ -843,11 +793,7 @@ void SHrotmatgen( void rotateFrame_shd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ -#else - float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ -#endif const int16_t subframe_len, /* i : subframe length per channel */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ const int16_t subframe_idx /* i : subframe index */ @@ -855,11 +801,7 @@ void rotateFrame_shd( void rotateFrame_sd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ -#ifdef JBM_TSM_ON_TCS float *output[], /* i/o: unrotated SD signal buffer in TD */ -#else - float output[][L_FRAME48k], /* i/o: unrotated SD signal buffer in TD */ -#endif const int16_t subframe_len, /* i : subframe length per channel */ const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ @@ -871,9 +813,7 @@ void rotateFrame_shd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ float Rmat[3][3], /* i : real-space rotation matrix */ const int16_t nInChannels, /* i : number of channels */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif const int16_t shd_rot_max_order /* i : split-order rotation method */ ); @@ -883,9 +823,7 @@ void rotateFrame_sd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ -#ifdef JBM_TSM_ON_TCS const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif const int16_t nb_band /* i : number of CLDFB bands to process */ ); @@ -918,11 +856,7 @@ ivas_error ivas_orient_trk_Init( ivas_error ivas_orient_trk_SetTrackingType( ivas_orient_trk_state_t *pOTR, /* i/o: orientation tracker handle */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking /* i : orientation tracking type */ -#else - const OTR_TRACKING_T trackingType /* i : orientation tracking type */ -#endif ); ivas_error ivas_orient_trk_SetReferenceRotation( diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index baa83fad0e58d61fb16a3eb6ccee7f1e0f353728..e5f0a0ac96640c92e29b74e7a32ea509709fcbe5 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -1437,11 +1437,7 @@ static void reverb_block( static ivas_error downmix_input_block( const REVERB_HANDLE hReverb, -#ifdef JBM_TSM_ON_TCS float *pcm_in[], -#else - float pcm_in[][L_FRAME48k], -#endif const AUDIO_CONFIG input_audio_config, float *pPcm_out, const int16_t input_offset ) @@ -1583,14 +1579,9 @@ ivas_error ivas_reverb_process( const REVERB_HANDLE hReverb, /* i : Reverberator handle */ const AUDIO_CONFIG input_audio_config, /* i : reverb. input audio configuration */ const int16_t mix_signals, /* i : add reverb to output signal */ -#ifdef JBM_TSM_ON_TCS - float *pcm_in[], /* i : the PCM audio to apply reverb on */ - float *pcm_out[], /* o : the PCM audio with reverb applied */ -#else - float pcm_in[][L_FRAME48k], /* i : the PCM audio to apply reverb on */ - float pcm_out[][L_FRAME48k], /* o : the PCM audio with reverb applied */ -#endif - const int16_t i_ts /* i : subframe index */ + float *pcm_in[], /* i : the PCM audio to apply reverb on */ + float *pcm_out[], /* o : the PCM audio with reverb applied */ + const int16_t i_ts /* i : subframe index */ ) { float tmp0[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp1[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES], tmp2[L_FRAME48k / MAX_PARAM_SPATIAL_SUBFRAMES]; @@ -1626,11 +1617,9 @@ ivas_error ivas_reverb_process( *------------------------------------------------------------------------*/ void ivas_binaural_reverb_processSubframe( - REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ - const int16_t numInChannels, /* i : num inputs to be processed */ -#ifdef JBM_TSM_ON_TCS - const int16_t numSlots, /* i : number of slots to be processed */ -#endif + REVERB_STRUCT_HANDLE hReverb, /* i/o: binaural reverb handle */ + const int16_t numInChannels, /* i : num inputs to be processed */ + const int16_t numSlots, /* i : number of slots to be processed */ float inReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data real, Comment: This change swaps two first dimensions as first dimension is not constant. */ float inImag[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* i : input CLDFB data imag */ float outReal[][CLDFB_SLOTS_PER_SUBFRAME][CLDFB_NO_CHANNELS_MAX], /* o : output CLDFB data real */ @@ -1647,7 +1636,6 @@ void ivas_binaural_reverb_processSubframe( * for convolution purposes later on. */ for ( bin = 0; bin < hReverb->numBins; bin++ ) { -#ifdef JBM_TSM_ON_TCS /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + numSlots, hReverb->loopBufLength[bin] ); mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + numSlots, hReverb->loopBufLength[bin] ); @@ -1657,32 +1645,13 @@ void ivas_binaural_reverb_processSubframe( * is decorrelated later on. */ v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], numSlots ); v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], numSlots ); -#else - /* Move the data forwards by blockSize (i.e. by the frame size of 16 CLDFB slots) */ - mvr2r( hReverb->loopBufReal[bin], hReverb->loopBufReal[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); - mvr2r( hReverb->loopBufImag[bin], hReverb->loopBufImag[bin] + hReverb->blockSize, hReverb->loopBufLength[bin] ); - - /* Add the data from the end of the loop to the beginning, with an attenuation factor - * according to RT60. This procedure generates an IIR decaying response. The response - * is decorrelated later on. */ - v_multc( hReverb->loopBufReal[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufReal[bin], hReverb->blockSize ); - v_multc( hReverb->loopBufImag[bin] + hReverb->loopBufLength[bin], hReverb->loopAttenuationFactor[bin], hReverb->loopBufImag[bin], hReverb->blockSize ); -#endif } /* 2) Apply the determined pre-delay to the input audio, and add the delayed audio to the loop. */ idx = hReverb->preDelayBufferIndex; -#ifdef JBM_TSM_ON_TCS for ( sample = 0; sample < numSlots; sample++ ) -#else - for ( sample = 0; sample < hReverb->blockSize; sample++ ) -#endif { -#ifdef JBM_TSM_ON_TCS invertSampleIndex = numSlots - sample - 1; -#else - invertSampleIndex = hReverb->blockSize - sample - 1; -#endif for ( bin = 0; bin < hReverb->numBins; bin++ ) { @@ -1725,20 +1694,14 @@ void ivas_binaural_reverb_processSubframe( phaseShiftTypePr = hReverb->tapPhaseShiftType[bin][ch]; /* Flush output */ -#ifdef JBM_TSM_ON_TCS set_f( hReverb->outputBufferReal[bin][ch], 0.0f, numSlots ); set_f( hReverb->outputBufferImag[bin][ch], 0.0f, numSlots ); -#else - set_f( hReverb->outputBufferReal[bin][ch], 0.0f, hReverb->blockSize ); - set_f( hReverb->outputBufferImag[bin][ch], 0.0f, hReverb->blockSize ); -#endif /* Add from temporally decaying sparse tap locations the audio to the output. */ for ( tapIdx = 0; tapIdx < hReverb->taps[bin][ch]; tapIdx++ ) { switch ( phaseShiftTypePr[tapIdx] ) { -#ifdef JBM_TSM_ON_TCS case 0: /* 0 degrees phase */ v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], numSlots ); v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], numSlots ); @@ -1755,24 +1718,6 @@ void ivas_binaural_reverb_processSubframe( v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], numSlots ); v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], numSlots ); break; -#else - case 0: /* 0 degrees phase */ - v_add( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_add( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - case 1: /* 90 degrees phase */ - v_sub( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_add( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - case 2: /* 180 degrees phase */ - v_sub( hReverb->outputBufferReal[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_sub( hReverb->outputBufferImag[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; - default: /* 270 degrees phase */ - v_add( hReverb->outputBufferReal[bin][ch], tapImagPr[tapIdx], hReverb->outputBufferReal[bin][ch], hReverb->blockSize ); - v_sub( hReverb->outputBufferImag[bin][ch], tapRealPr[tapIdx], hReverb->outputBufferImag[bin][ch], hReverb->blockSize ); - break; -#endif } } } @@ -1782,11 +1727,7 @@ void ivas_binaural_reverb_processSubframe( { if ( hReverb->useBinauralCoherence ) { -#ifdef JBM_TSM_ON_TCS for ( sample = 0; sample < numSlots; sample++ ) -#else - for ( sample = 0; sample < hReverb->blockSize; sample++ ) -#endif { float leftRe, rightRe, leftIm, rightIm; @@ -1807,18 +1748,10 @@ void ivas_binaural_reverb_processSubframe( /* 4) Write data to output */ for ( ch = 0; ch < BINAURAL_CHANNELS; ch++ ) { -#ifdef JBM_TSM_ON_TCS for ( sample = 0; sample < numSlots; sample++ ) -#else - for ( sample = 0; sample < hReverb->blockSize; sample++ ) -#endif { -/* Audio was in the temporally inverted order for convolution, re-invert audio to output */ -#ifdef JBM_TSM_ON_TCS + /* Audio was in the temporally inverted order for convolution, re-invert audio to output */ invertSampleIndex = numSlots - sample - 1; -#else - invertSampleIndex = hReverb->blockSize - sample - 1; -#endif for ( bin = 0; bin < hReverb->numBins; bin++ ) { @@ -1837,8 +1770,6 @@ void ivas_binaural_reverb_processSubframe( return; } -#ifdef JBM_TSM_ON_TCS -#endif /*------------------------------------------------------------------------- * ivas_binaural_reverb_open() diff --git a/lib_rend/ivas_rotation.c b/lib_rend/ivas_rotation.c index 79ef75e4708d8f98c845e55b9afc33f9376da4aa..2ae0347fd38164b50f0c5f917c2fc0d7db86a7f1 100644 --- a/lib_rend/ivas_rotation.c +++ b/lib_rend/ivas_rotation.c @@ -250,14 +250,10 @@ void rotateAziEle( void rotateFrame_shd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ -#ifdef JBM_TSM_ON_TCS - float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ -#else - float output[][L_FRAME48k], /* i/o: unrotated HOA3 signal buffer in TD */ -#endif - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const int16_t subframe_idx /* i : subframe index */ + float *output[], /* i/o: unrotated HOA3 signal buffer in TD */ + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const int16_t subframe_idx /* i : subframe index */ ) { int16_t i, l, n, m; @@ -357,15 +353,11 @@ void rotateFrame_shd( void rotateFrame_sd( HEAD_TRACK_DATA_HANDLE hHeadTrackData, /* i : head track handle */ -#ifdef JBM_TSM_ON_TCS - float *output[], /* i/o: unrotated SD signal buffer in TD */ -#else - float output[][L_FRAME48k], /* i/o: unrotated SD signal buffer in TD */ -#endif - const int16_t subframe_len, /* i : subframe length per channel */ - const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ - const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ - const int16_t subframe_idx /* i : subframe index */ + float *output[], /* i/o: unrotated SD signal buffer in TD */ + const int16_t subframe_len, /* i : subframe length per channel */ + const IVAS_OUTPUT_SETUP hTransSetup, /* i : format for rotation */ + const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ + const int16_t subframe_idx /* i : subframe index */ ) { int16_t i, j; @@ -499,10 +491,8 @@ void rotateFrame_shd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ float Rmat[3][3], /* i : real-space rotation matrix */ const int16_t nInChannels, /* i : number of channels */ -#ifdef JBM_TSM_ON_TCS - const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif - const int16_t shd_rot_max_order /* i : split-order rotation method */ + const int16_t numTimeSlots, /* i : number of time slots to process */ + const int16_t shd_rot_max_order /* i : split-order rotation method */ ) { int16_t n = 0; @@ -525,11 +515,7 @@ void rotateFrame_shd_cldfb( SHrotmatgen( SHrotmat, Rmat, shd_rot_max_order ); /* rotation by mtx multiplication */ -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < numTimeSlots; i++ ) -#else - for ( i = 0; i < MAX_PARAM_SPATIAL_SUBFRAMES; i++ ) -#endif { for ( iBand = 0; iBand < CLDFB_NO_CHANNELS_MAX; iBand++ ) { @@ -600,10 +586,8 @@ void rotateFrame_sd_cldfb( float Cldfb_ImagBuffer[][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX], /* i/o: unrotated HOA3 signal buffer in cldfb domain imag part */ const IVAS_OUTPUT_SETUP_HANDLE hOutputSetup, /* i : output format setup number of channels */ const EFAP_HANDLE hEFAPdata, /* i : EFAP structure */ -#ifdef JBM_TSM_ON_TCS - const int16_t numTimeSlots, /* i : number of time slots to process */ -#endif - const int16_t nb_band /* i : number of CLDFB bands to process */ + const int16_t numTimeSlots, /* i : number of time slots to process */ + const int16_t nb_band /* i : number of CLDFB bands to process */ ) { int16_t iBlock, iBand, m, n; @@ -661,11 +645,7 @@ void rotateFrame_sd_cldfb( p_imagRot = imagRot[n]; if ( g1 > 0.f ) { -#ifdef JBM_TSM_ON_TCS for ( iBlock = 0; iBlock < numTimeSlots; iBlock++ ) -#else - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) -#endif { p_real = Cldfb_RealBuffer[m][iBlock]; p_imag = Cldfb_ImagBuffer[m][iBlock]; @@ -685,11 +665,7 @@ void rotateFrame_sd_cldfb( { p_realRot = realRot[n]; p_imagRot = imagRot[n]; -#ifdef JBM_TSM_ON_TCS for ( iBlock = 0; iBlock < numTimeSlots; iBlock++ ) -#else - for ( iBlock = 0; iBlock < MAX_PARAM_SPATIAL_SUBFRAMES; iBlock++ ) -#endif { p_real = Cldfb_RealBuffer[n][iBlock]; p_imag = Cldfb_ImagBuffer[n][iBlock]; diff --git a/lib_rend/ivas_sba_rendering.c b/lib_rend/ivas_sba_rendering.c index 059cd847e1a44782cf226dafafa90a65043666ca..09746779229d97b3c14b75a51d92ed8ef08fb807 100644 --- a/lib_rend/ivas_sba_rendering.c +++ b/lib_rend/ivas_sba_rendering.c @@ -66,9 +66,7 @@ void ivas_sba_prototype_renderer( int16_t cldfb_band; int16_t out_ch, in_ch; int16_t firstInCh, inChEnd, firstOutCh, outChEnd; -#ifdef JBM_TSM_ON_TCS int16_t slot_idx_start, md_idx; -#endif push_wmops( "ivas_sba_prototype_renderer" ); @@ -79,9 +77,7 @@ void ivas_sba_prototype_renderer( num_cldfb_bands = hSpar->hFbMixer->pFb->fb_bin_to_band.num_cldfb_bands; numch_in = hSpar->hFbMixer->fb_cfg->num_in_chans; numch_out = hSpar->hFbMixer->fb_cfg->num_out_chans; -#ifdef JBM_TSM_ON_TCS slot_idx_start = hSpar->slots_rendered; -#endif if ( st_ivas->nchan_transport == 1 ) { @@ -99,19 +95,11 @@ void ivas_sba_prototype_renderer( } /* Apply mixing matrix */ -#ifdef JBM_TSM_ON_TCS for ( ts = 0; ts < hSpar->subframe_nbslots[hSpar->subframes_rendered]; ts++ ) -#else - for ( ts = 0; ts < CLDFB_SLOTS_PER_SUBFRAME; ts++ ) -#endif { /* determine SPAR parameters for this time slot */ -#ifdef JBM_TSM_ON_TCS md_idx = hSpar->render_to_md_map[ts + slot_idx_start]; ivas_spar_get_parameters( hSpar, hDecoderConfig, md_idx, numch_out, numch_in, num_spar_bands, mixer_mat ); -#else - ivas_spar_get_parameters( hSpar, hDecoderConfig, ts + subframe * CLDFB_SLOTS_PER_SUBFRAME, numch_out, numch_in, num_spar_bands, mixer_mat ); -#endif for ( cldfb_band = 0; cldfb_band < num_cldfb_bands; cldfb_band++ ) { @@ -155,7 +143,6 @@ void ivas_sba_prototype_renderer( } } -#ifdef JBM_TSM_ON_TCS /* Update mixing matrices */ if ( ( ( slot_idx_start + ts + 1 ) == hSpar->num_slots ) || ( ( md_idx / JBM_CLDFB_SLOTS_IN_SUBFRAME ) != ( hSpar->render_to_md_map[ts + slot_idx_start + 1] / JBM_CLDFB_SLOTS_IN_SUBFRAME ) ) ) { @@ -179,38 +166,13 @@ void ivas_sba_prototype_renderer( } } } -#endif } -#ifndef JBM_TSM_ON_TCS - /* Update mixing matrices */ - hSpar->i_subframe++; - hSpar->i_subframe = min( hSpar->i_subframe, MAX_PARAM_SPATIAL_SUBFRAMES ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[1][0][0], hSpar->hMdDec->mixer_mat_prev[0][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[2][0][0], hSpar->hMdDec->mixer_mat_prev[1][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[3][0][0], hSpar->hMdDec->mixer_mat_prev[2][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - mvr2r( hSpar->hMdDec->mixer_mat_prev[4][0][0], hSpar->hMdDec->mixer_mat_prev[3][0][0], IVAS_MAX_FB_MIXER_OUT_CH * IVAS_MAX_FB_MIXER_IN_CH * IVAS_MAX_NUM_BANDS ); - - for ( out_ch = 0; out_ch < numch_out; out_ch++ ) - { - for ( in_ch = 0; in_ch < numch_in; in_ch++ ) - { - for ( b = 0; b < num_spar_bands; b++ ) - { - hSpar->hMdDec->mixer_mat_prev[4][out_ch][in_ch][b] = hSpar->hMdDec->mixer_mat[out_ch][in_ch][b + subframe * IVAS_MAX_NUM_BANDS]; - } - } - } -#endif /* Create prototypes */ if ( st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC || st_ivas->renderer_type == RENDERER_BINAURAL_PARAMETRIC_ROOM ) { -#ifdef JBM_TSM_ON_TCS for ( ts = 0; ts < hSpar->subframe_nbslots[subframe]; ts++ ) -#else - for ( ts = 0; ts < CLDFB_SLOTS_PER_SUBFRAME; ts++ ) -#endif { if ( st_ivas->nchan_transport == 1 ) /* Dual mono */ { @@ -236,10 +198,8 @@ void ivas_sba_prototype_renderer( } } -#ifdef JBM_TSM_ON_TCS hSpar->subframes_rendered++; hSpar->slots_rendered += hSpar->subframe_nbslots[subframe]; -#endif pop_wmops(); return; diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index 877076db9ad596804a7e3054209fd2dc1c5f4dd4..b90b7b55077d08ba60f68c495c4e0b1fdc02d823 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -228,11 +228,7 @@ typedef struct EFAP typedef struct ivas_orient_trk_state_t { -#ifdef FIX_439_OTR_PARAMS HEAD_ORIENT_TRK_T orientation_tracking; -#else - OTR_TRACKING_T trackingType; -#endif float centerAdaptationRate; float offCenterAdaptationRate; float adaptationAngle; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 41f68b652037f6721543ad487190ba0c27521e38..b4a0950c5fbce72577bab6f78ef74c5ddf6a181e 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -2212,10 +2212,7 @@ static ivas_error initMasaDummyDecForMcOut( decDummy->sba_analysis_order = 1; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ -#ifndef SBA_MODE_CLEAN_UP - decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ -#endif - decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ + decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ ivas_output_init( &( decDummy->hOutSetup ), output_config ); ivas_output_init( &( decDummy->hIntSetup ), output_config ); @@ -2297,10 +2294,7 @@ static ivas_error initMasaDummyDecForSbaOut( decDummy->hDecoderConfig->output_config = output_config; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ -#ifndef SBA_MODE_CLEAN_UP - decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ -#endif - decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ + decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ decDummy->sba_analysis_order = 1; @@ -2373,10 +2367,7 @@ static ivas_error initMasaDummyDecForBinauralOut( decDummy->sba_analysis_order = 1; decDummy->hDecoderConfig->ivas_total_brate = IVAS_512k; /* Todo Nokia: This is preventing initialization of 2TC as 1TC, should be fixed properly in ivas_dirac_dec_config() */ -#ifndef SBA_MODE_CLEAN_UP - decDummy->sba_mode = SBA_MODE_NONE; /* Todo Nokia: This is done to prevent ivas_dirac_dec_config() to not use uninitialized value. It could be considered if this should not be even accessed when not in SBA. */ -#endif - decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ + decDummy->mc_mode = MC_MODE_NONE; /* Todo Nokia: This should be also refactored in such way that it is not checked if not in MC mode */ ivas_output_init( &( decDummy->hOutSetup ), output_config ); if ( output_config == AUDIO_CONFIG_BINAURAL ) @@ -2473,9 +2464,7 @@ static DecoderDummy *initDecoderDummy( decDummy->hDecoderConfig->output_Fs = sampleRate; decDummy->hDecoderConfig->nchan_out = numOutChannels; decDummy->hDecoderConfig->Opt_Headrotation = 0; -#ifdef JBM_TSM_ON_TCS decDummy->hDecoderConfig->voip_active = 0; -#endif decDummy->hBinRenderer = NULL; decDummy->hEFAPdata = NULL; @@ -2487,14 +2476,10 @@ static DecoderDummy *initDecoderDummy( decDummy->hMasa = NULL; decDummy->hDiracDecBin = NULL; decDummy->hQMetaData = NULL; -#ifdef FIX_482_DUMMYDEC_INIT decDummy->hHrtfParambin = NULL; decDummy->hHeadTrackData = NULL; decDummy->hDirAC = NULL; -#endif -#ifdef JBM_TSM_ON_TCS decDummy->hTcBuffer = NULL; -#endif decDummy->hDecoderConfig->output_config = getIvasAudioConfigFromRendAudioConfig( outConfig ); decDummy->nchan_transport = numTransChannels; @@ -2508,7 +2493,6 @@ static DecoderDummy *initDecoderDummy( decDummy->hHeadTrackData->Rmat_prev[i][i] = 1.0f; } -#ifdef FIX_482_DUMMYDEC_INIT set_zero( decDummy->hHeadTrackData->chEneIIR[0], MASA_FREQUENCY_BANDS ); set_zero( decDummy->hHeadTrackData->chEneIIR[1], MASA_FREQUENCY_BANDS ); set_zero( decDummy->hHeadTrackData->procChEneIIR[0], MASA_FREQUENCY_BANDS ); @@ -2520,7 +2504,6 @@ static DecoderDummy *initDecoderDummy( decDummy->hHeadTrackData->Quaternions[i].y = 0.0f; decDummy->hHeadTrackData->Quaternions[i].z = 0.0f; } -#endif decDummy->hHeadTrackData->num_quaternions = 0; decDummy->hHeadTrackData->lrSwitchInterpVal = 0.0f; decDummy->hHeadTrackData->lrSwitchedCurrent = 0; @@ -2544,10 +2527,8 @@ static DecoderDummy *initDecoderDummy( decDummy->hRenderConfig = NULL; } -#ifdef JBM_TSM_ON_TCS /* get a default TC buffer, needed for some renderers */ ivas_jbm_dec_tc_buffer_open( decDummy, TC_BUFFER_MODE_NONE, 0, 0, 0, 1 ); -#endif decDummy->renderer_type = RENDERER_DISABLE; @@ -2656,10 +2637,8 @@ static void freeDecoderDummy( /* Parametric binaural renderer handle */ ivas_dirac_dec_close_binaural_data( &pDecDummy->hDiracDecBin ); -#ifdef JBM_TSM_ON_TCS /* TC buffer */ ivas_jbm_dec_tc_buffer_close( &pDecDummy->hTcBuffer ); -#endif free( pDecDummy ); pDecDummy = NULL; @@ -3794,9 +3773,7 @@ int16_t IVAS_REND_GetRenderConfig( hRCout->room_acoustics.nBands = hRCin->roomAcoustics.nBands; hRCout->room_acoustics.acousticPreDelay = hRCin->roomAcoustics.acousticPreDelay; hRCout->room_acoustics.inputPreDelay = hRCin->roomAcoustics.inputPreDelay; -#ifdef FIX_463_TD_RENDERER_DIRECTIVITY_RESET mvr2r( hRCin->directivity, hRCout->directivity, 3 ); -#endif mvr2r( hRCin->roomAcoustics.pFc_input, hRCout->room_acoustics.pFc_input, CLDFB_NO_CHANNELS_MAX ); mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX ); @@ -3913,52 +3890,11 @@ ivas_error IVAS_REND_SetHeadRotation( *-------------------------------------------------------------------*/ ivas_error IVAS_REND_SetOrientationTrackingMode( - IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef FIX_439_OTR_PARAMS + IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ -#else - const uint8_t otrMode /* i : Orientation tracking mode */ -#endif ) { -#ifdef FIX_439_OTR_PARAMS return ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, orientation_tracking ); -#else - OTR_TRACKING_T mode; - ivas_error error; - - if ( hIvasRend == NULL ) - { - return IVAS_ERR_UNEXPECTED_NULL_POINTER; - } - - switch ( otrMode ) - { - case IVAS_ORIENT_TRK_AVG: - mode = OTR_TRACKING_AVG_ORIENT; - break; - case IVAS_ORIENT_TRK_REF: - mode = OTR_TRACKING_REF_ORIENT; - break; - case IVAS_ORIENT_TRK_REF_VEC: - mode = OTR_TRACKING_REF_VEC; - break; - case IVAS_ORIENT_TRK_REF_VEC_LEV: - mode = OTR_TRACKING_REF_VEC_LEV; - break; - case IVAS_ORIENT_TRK_NONE: - default: - mode = OTR_TRACKING_NONE; - break; - } - - if ( ( error = ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, mode ) ) != IVAS_ERR_OK ) - { - return error; - } - - return IVAS_ERR_OK; -#endif } @@ -4426,14 +4362,12 @@ static ivas_error renderIsmToBinauralRoom( IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioObjectPosition rotatedPos; const IVAS_REND_HeadRotData *headRotData; -#ifdef JBM_TSM_ON_TCS float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpRendBuffer[i] = tmpRendBuffer[i]; } -#endif push_wmops( "renderIsmToBinauralRoom" ); @@ -4532,13 +4466,8 @@ static ivas_error renderIsmToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpRendBuffer ); -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, NULL, NULL, NULL, NULL, p_tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( ismInput->crendWrapper, AUDIO_CONFIG_7_1_4, AUDIO_CONFIG_BINAURAL_ROOM, - NULL, NULL, NULL, NULL, tmpRendBuffer, *ismInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -4806,7 +4735,6 @@ static ivas_error renderMcToBinaural( IVAS_REND_AudioConfig inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; -#ifdef JBM_TSM_ON_TCS float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; int16_t i; @@ -4814,7 +4742,6 @@ static ivas_error renderMcToBinaural( { p_tmpRendBuffer[i] = tmpRendBuffer[i]; } -#endif push_wmops( "renderMcToBinaural" ); @@ -4855,13 +4782,8 @@ static ivas_error renderMcToBinaural( } /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -4889,7 +4811,6 @@ static ivas_error renderMcToBinauralRoom( IVAS_REND_AudioConfig inConfig; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; -#ifdef JBM_TSM_ON_TCS float *p_tmpRendBuffer[MAX_OUTPUT_CHANNELS]; int16_t i; @@ -4897,7 +4818,6 @@ static ivas_error renderMcToBinauralRoom( { p_tmpRendBuffer[i] = tmpRendBuffer[i]; } -#endif push_wmops( "renderMcToBinauralRoom" ); @@ -4938,13 +4858,8 @@ static ivas_error renderMcToBinauralRoom( } /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( mcInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpRendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -4975,9 +4890,7 @@ static ivas_error renderMcCustomLsToBinauralRoom( IVAS_REND_AudioBuffer tmpRotBuffer; IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioBuffer *tmpBufPtr; -#ifdef JBM_TSM_ON_TCS float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; -#endif push_wmops( "renderMcCustomLsToBinauralRoom" ); @@ -4985,12 +4898,10 @@ static ivas_error renderMcCustomLsToBinauralRoom( headRotEnabled = mcInput->base.ctx.pHeadRotData->headRotEnabled; -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } -#endif /* apply rotation */ if ( headRotEnabled ) @@ -5025,13 +4936,8 @@ static ivas_error renderMcCustomLsToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( mcInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, - tmpCrendBuffer, *mcInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -5231,19 +5137,15 @@ static ivas_error renderSbaToBinaural( float tmpCrendBuffer[MAX_OUTPUT_CHANNELS][L_FRAME48k]; ivas_error error; IVAS_REND_AudioBuffer tmpRotBuffer; -#ifdef JBM_TSM_ON_TCS float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; int16_t i; -#endif push_wmops( "renderSbaToBinaural" ); -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } -#endif /* apply rotation */ if ( sbaInput->base.ctx.pHeadRotData->headRotEnabled ) @@ -5268,13 +5170,8 @@ static ivas_error renderSbaToBinaural( } /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, getIvasAudioConfigFromRendAudioConfig( sbaInput->base.inConfig ), getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -5299,20 +5196,16 @@ static ivas_error renderSbaToBinauralRoom( IVAS_REND_AudioBuffer tmpRotBuffer; IVAS_REND_AudioBuffer tmpMcBuffer; IVAS_REND_AudioBuffer *tmpBufPtr; -#ifdef JBM_TSM_ON_TCS float *p_tmpCrendBuffer[MAX_OUTPUT_CHANNELS]; -#endif tmpRotBuffer = outAudio; /* avoid compilation warning */ push_wmops( "renderSbaToBinauralRoom" ); -#ifdef JBM_TSM_ON_TCS for ( i = 0; i < MAX_OUTPUT_CHANNELS; i++ ) { p_tmpCrendBuffer[i] = tmpCrendBuffer[i]; } -#endif headRotEnabled = sbaInput->base.ctx.pHeadRotData->headRotEnabled; @@ -5352,13 +5245,8 @@ static ivas_error renderSbaToBinauralRoom( copyBufferTo2dArray( tmpMcBuffer, tmpCrendBuffer ); /* call CREND */ -#ifdef JBM_TSM_ON_TCS if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), NULL, NULL, NULL, NULL, p_tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#else - if ( ( error = ivas_rend_crendProcess( sbaInput->crendWrapper, AUDIO_CONFIG_7_1_4, getIvasAudioConfigFromRendAudioConfig( outConfig ), - NULL, NULL, NULL, NULL, tmpCrendBuffer, *sbaInput->base.ctx.pOutSampleRate ) ) != IVAS_ERR_OK ) -#endif { return error; } @@ -5510,11 +5398,7 @@ static void renderMasaToMc( } else { -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); -#else - ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, NULL, NULL, -1 ); -#endif } accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); @@ -5531,11 +5415,7 @@ static void renderMasaToSba( copyBufferTo2dArray( masaInput->base.inputBuffer, tmpBuffer ); copyMasaMetadataToDiracRenderer( &masaInput->masaMetadata, masaInput->decDummy->hDirAC ); -#ifdef JBM_TSM_ON_TCS ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels ); -#else - ivas_dirac_dec( masaInput->decDummy, tmpBuffer, masaInput->base.inputBuffer.config.numChannels, NULL, NULL, -1 ); -#endif accumulate2dArrayToBuffer( tmpBuffer, &outAudio ); diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h index 33cbd78f56c6a20d34ef5845fe0a4d7818abb355..cf0db7e4b5139552032bb021664a55124354c1ac 100644 --- a/lib_rend/lib_rend.h +++ b/lib_rend/lib_rend.h @@ -251,11 +251,7 @@ ivas_error IVAS_REND_SetHeadRotation( ivas_error IVAS_REND_SetOrientationTrackingMode( IVAS_REND_HANDLE hIvasRend, /* i/o: Renderer handle */ -#ifdef FIX_439_OTR_PARAMS const HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */ -#else - const uint8_t otrMode /* i : Orientation tracking mode */ -#endif ); ivas_error IVAS_REND_SetReferenceRotation( diff --git a/lib_util/masa_file_reader.c b/lib_util/masa_file_reader.c index 90756a39b1ec5dcb33c3c2034f832ba5f1d9042e..5fda0fcc3c146b9fa9c99b467b2983e348c99675 100644 --- a/lib_util/masa_file_reader.c +++ b/lib_util/masa_file_reader.c @@ -96,163 +96,6 @@ IVAS_MASA_METADATA_HANDLE MasaFileReader_getMetadataHandle( } -#ifndef HR_METADATA -/*------------------------------------------------------------------------- - * deindex_sph_idx() - * - * deindex the MASA metadata from the input metadata file - *------------------------------------------------------------------------*/ -static void deindex_sph_idx( - const uint16_t sphIndex, /* i : Spherical index */ - const SPHERICAL_GRID_DATA *gridData, /* i : Prepared spherical grid */ - float *theta, /* o : Elevation */ - float *phi /* o : Azimuth */ -) -{ - float ba_crt, del_crt, div_crt, a4_crt; - float estim; - int32_t base_low, base_up; - int16_t n_crt; - int16_t id_th; - int16_t sign_theta; - int16_t id_phi; - int16_t no_th = gridData->no_theta; - const int16_t *n = gridData->no_phi; - const float ba[3] = { - 2.137991118026424e+02f, - 1.244854404591542e+02f, - 1.228408647140870e+02f, - }; - const float del[3] = { 7.998262115303199e+05f, 1.300883976959332e+06f, 1.424072242426373e+06f }; - const float div[3] = { -0.237662341081474f, -0.100938185496887f, -0.092050209205032f }; - const float a4[3] = { -8.415300425381099f, -19.814106922515204f, -21.727272727270197f }; - const uint16_t limit_index1 = 64964, limit_index2 = 47870; - - if ( sphIndex >= limit_index1 ) - { - ba_crt = ba[2]; - div_crt = div[2]; - a4_crt = a4[2]; - del_crt = del[2]; - } - else if ( sphIndex >= limit_index2 ) - { - ba_crt = ba[1]; - div_crt = div[1]; - a4_crt = a4[1]; - del_crt = del[1]; - } - else - { - ba_crt = ba[0]; - div_crt = div[0]; - a4_crt = a4[0]; - del_crt = del[0]; - } - estim = ba_crt + div_crt * sqrtf( del_crt + a4_crt * sphIndex ); - - if ( estim > MASA_NO_CIRCLES ) - { - estim = MASA_NO_CIRCLES; - } - - assert( estim > 0 ); - id_th = (int16_t) roundf( estim ) - 1; - if ( id_th < 0 ) - { - id_th = 0; - } - - if ( id_th == 0 ) - { - base_low = 0; - base_up = n[0]; - } - else - { - estim = MASA_ANGLE_AT_EQUATOR * (float) ( id_th - 0.5f ); - base_low = n[0]; - if ( id_th >= 2 ) - { - if ( id_th == 2 ) - { - base_low += 2 * (int16_t) ceilf( MASA_NTOT2_FAC * ( sinf( estim ) - MASA_ASIN_OFFSET ) ); - } - else - { - base_low += 2 * (int16_t) roundf( MASA_NTOT2_FAC * ( sinf( estim ) - MASA_ASIN_OFFSET ) ); - } - } - base_up = base_low + 2 * n[id_th]; - } - - sign_theta = 1; - - n_crt = n[id_th]; - if ( sphIndex < base_low ) - { - id_th--; - n_crt = n[id_th]; - if ( id_th == 0 ) - { - base_low = 0; - base_up = n_crt; - } - else - { - base_up = base_low; - base_low -= 2 * n[id_th]; - } - assert( sphIndex >= base_low ); - } - else if ( sphIndex >= base_up ) - { - id_th++; - n_crt = n[id_th]; - base_low = base_up; - base_up += 2 * n_crt; - assert( sphIndex < base_up ); - } - - id_phi = (int16_t) ( sphIndex - base_low ); - if ( sphIndex - base_low >= n_crt ) - { - id_phi -= n_crt; - sign_theta = -1; - } - - if ( id_th == 0 ) - { - *theta = 0.f; - *phi = (float) sphIndex * 360 / (float) n_crt - 180; - } - else - { - if ( id_th == no_th - 1 ) - { - id_phi = 0; - *phi = -180; - *theta = 90 * (float) sign_theta; - } - else - { - *theta = id_th * MASA_ANGLE_AT_EQUATOR_DEG * (float) sign_theta; - if ( id_th % 2 == 0 ) - { - *phi = (float) id_phi * 360 / (float) n_crt - 180; - } - else - { - *phi = ( (float) id_phi + 0.5f ) * 360 / (float) n_crt - 180; - } - } - } - - return; -} -#endif - - /*------------------------------------------------------------------------- * MasaFileReader_readNextFrame() * @@ -344,9 +187,7 @@ ivas_error MasaFileReader_readNextFrame( for ( b = 0; b < MASA_FREQUENCY_BANDS; b++ ) { deindex_sph_idx( readIndex[b], &self->sph_grid16, &( hMeta->directional_meta[i].elevation[j][b] ), &( hMeta->directional_meta[i].azimuth[j][b] ) ); -#ifdef HR_METADATA hMeta->directional_meta[i].spherical_index[j][b] = readIndex[b]; -#endif } /* Direct-to-total ratio */