From 4a2bbffbaba95129bff33d958c91faf3cc286ab4 Mon Sep 17 00:00:00 2001 From: Sandesh Venkatesh Date: Sun, 18 Feb 2024 11:50:50 +0530 Subject: [PATCH] Changes for subfunctions of ivas_ism_bitrate_switching_dec function --- lib_com/common_api_types.h | 3 + lib_com/ivas_cnst.h | 3 + lib_com/ivas_prot.h | 6 + lib_dec/ivas_corecoder_dec_reconfig.c | 78 +++ lib_dec/ivas_init_dec.c | 15 + lib_dec/ivas_ism_dec.c | 6 + lib_dec/ivas_stat_dec.h | 1 + lib_rend/ivas_crend.c | 832 +++++++++++++++++------- lib_rend/ivas_reverb.c | 35 + lib_rend/ivas_rom_binaural_crend_head.c | 15 + lib_rend/ivas_rom_binaural_crend_head.h | 16 + lib_rend/ivas_stat_rend.h | 9 + lib_rend/lib_rend.c | 21 +- 13 files changed, 789 insertions(+), 251 deletions(-) diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h index 0127d0555..9d6a3a01b 100644 --- a/lib_com/common_api_types.h +++ b/lib_com/common_api_types.h @@ -231,6 +231,9 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG float pAcoustic_dsr[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */ float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */ float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */ +#ifdef IVAS_FLOAT_FIXED + Word32 acousticPreDelay_fx; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] *//*Assumed Q-27*/ +#endif // IVAS_FLOAT_FIXED /* early reflections */ int16_t use_er; /* ER activation flag */ diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h index 215e61e5a..6445a74f0 100644 --- a/lib_com/ivas_cnst.h +++ b/lib_com/ivas_cnst.h @@ -1539,6 +1539,9 @@ typedef enum #define HRTF_NUM_BINS 60 #define REVERB_PREDELAY_MAX 20 /* Max input delay for reverb module */ #define GAIN_LFE 1.88364911f /* Gain applied to LFE during renderering */ +#ifdef IVAS_FLOAT_FIXED +#define GAIN_LFE_FX 30862 /* Gain applied to LFE during renderering */ +#endif // IVAS_FLOAT_FIXED #define LOW_BIT_RATE_BINAURAL_EQ_BINS 17 /* Number of bins in an EQ applied at low bit rates in binauralization */ #define LOW_BIT_RATE_BINAURAL_EQ_OFFSET 14 /* Offset of bins where the low-bit-rate EQ starts*/ diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h index 77c228a28..84189d7a5 100644 --- a/lib_com/ivas_prot.h +++ b/lib_com/ivas_prot.h @@ -379,6 +379,12 @@ ivas_error ivas_corecoder_dec_reconfig( const int32_t brate_SCE, /* i : bitrate to be set for the SCEs */ const int32_t brate_CPE /* i : bitrate to be set for the CPEs */ ); +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_hp20_dec_reconfig_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nchan_hp20_old /* i : number of HP20 filters in previous frame*/ +); +#endif // IVAS_FLOAT_FIXED ivas_error ivas_hp20_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ diff --git a/lib_dec/ivas_corecoder_dec_reconfig.c b/lib_dec/ivas_corecoder_dec_reconfig.c index dcab83e68..26d79808e 100644 --- a/lib_dec/ivas_corecoder_dec_reconfig.c +++ b/lib_dec/ivas_corecoder_dec_reconfig.c @@ -379,6 +379,84 @@ ivas_error ivas_corecoder_dec_reconfig( * Allocate, initialize, and configure HP20 memory handles in case of bitrate switching *-------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +ivas_error ivas_hp20_dec_reconfig_fx( + Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ + const Word16 nchan_hp20_old /* i : number of HP20 filters in previous frame */ +) +{ + Word16 i, nchan_hp20; + Word32 **old_mem_hp20_out_fx; + ivas_error error; + + error = IVAS_ERR_OK; + + /*-----------------------------------------------------------------* + * HP20 memories + *-----------------------------------------------------------------*/ + + nchan_hp20 = getNumChanSynthesis( st_ivas ); + + IF ( GT_16(nchan_hp20 , nchan_hp20_old) ) + { + /* save old mem_hp_20 pointer */ + old_mem_hp20_out_fx = st_ivas->mem_hp20_out_fx; + st_ivas->mem_hp20_out_fx = NULL; + + IF ( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( nchan_hp20 * sizeof( Word32 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + + FOR ( i = 0; i < nchan_hp20_old; i++ ) + { + st_ivas->mem_hp20_out_fx[i] = old_mem_hp20_out_fx[i]; + old_mem_hp20_out_fx[i] = NULL; + } + /* create additional hp20 memories */ + FOR ( ; i < nchan_hp20; i++ ) + { + IF ( ( st_ivas->mem_hp20_out_fx[i] = (Word32 *) malloc( L_HP20_MEM * sizeof( Word32 ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + + set32_fx( st_ivas->mem_hp20_out_fx[i], 0, L_HP20_MEM ); + } + + free( old_mem_hp20_out_fx ); + old_mem_hp20_out_fx = NULL; + } + ELSE IF ( LT_16(nchan_hp20 , nchan_hp20_old) ) + { + /* save old mem_hp_20 pointer */ + old_mem_hp20_out_fx = st_ivas->mem_hp20_out_fx; + st_ivas->mem_hp20_out_fx = NULL; + + IF ( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( nchan_hp20 * sizeof(Word32 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } + + FOR ( i = 0; i < nchan_hp20; i++ ) + { + st_ivas->mem_hp20_out_fx[i] = old_mem_hp20_out_fx[i]; + old_mem_hp20_out_fx[i] = NULL; + } + /* remove superfluous hp20 memories */ + FOR ( ; i < nchan_hp20_old; i++ ) + { + free( old_mem_hp20_out_fx[i] ); + old_mem_hp20_out_fx[i] = NULL; + } + + free( old_mem_hp20_out_fx ); + old_mem_hp20_out_fx = NULL; + } + + return error; +} +#endif ivas_error ivas_hp20_dec_reconfig( Decoder_Struct *st_ivas, /* i/o: IVAS decoder structure */ const int16_t nchan_hp20_old /* i : number of HP20 filters in previous frame */ diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c index 8e92869e9..fa823f557 100644 --- a/lib_dec/ivas_init_dec.c +++ b/lib_dec/ivas_init_dec.c @@ -1696,6 +1696,12 @@ ivas_error ivas_init_decoder( { return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); } +#ifdef IVAS_FLOAT_FIXED + IF( ( st_ivas->mem_hp20_out_fx = (Word32 **) malloc( n * sizeof(Word32 * ) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } +#endif // IVAS_FLOAT_FIXED } ELSE { @@ -1709,6 +1715,12 @@ ivas_error ivas_init_decoder( return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); } +#ifdef IVAS_FLOAT_FIXED + IF( ( st_ivas->mem_hp20_out_fx[i] = (Word32 *) malloc( L_HP20_MEM * sizeof(Word32) ) ) == NULL ) + { + return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HP20 filter memory\n" ) ); + } +#endif // IVAS_FLOAT_FIXED set_f( st_ivas->mem_hp20_out[i], 0.0f, L_HP20_MEM ); } @@ -2255,6 +2267,9 @@ void ivas_initialize_handles_dec( st_ivas->bit_stream = NULL; st_ivas->mem_hp20_out = NULL; +#ifdef IVAS_FLOAT_FIXED + st_ivas->mem_hp20_out_fx = NULL; +#endif // IVAS_FLOAT_FIXED st_ivas->hLimiter = NULL; /* ISM metadata handles */ diff --git a/lib_dec/ivas_ism_dec.c b/lib_dec/ivas_ism_dec.c index 373d00610..c74c45387 100644 --- a/lib_dec/ivas_ism_dec.c +++ b/lib_dec/ivas_ism_dec.c @@ -111,6 +111,12 @@ static ivas_error ivas_ism_bitrate_switching_dec( /*-----------------------------------------------------------------* * HP20 memories *-----------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED + if ( ( error = ivas_hp20_dec_reconfig_fx( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) + { + return error; + } +#endif // IVAS_FLOAT_FIXED if ( ( error = ivas_hp20_dec_reconfig( st_ivas, nchan_transport_old ) ) != IVAS_ERR_OK ) { diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h index 9a5a2b630..9e51d0891 100644 --- a/lib_dec/ivas_stat_dec.h +++ b/lib_dec/ivas_stat_dec.h @@ -1190,6 +1190,7 @@ typedef struct Decoder_Struct float *p_output_f[MAX_OUTPUT_CHANNELS+MAX_NUM_OBJECTS]; /* floating-point output audio buffers */ #ifdef IVAS_FLOAT_FIXED + Word32 **mem_hp20_out_fx; Word32 *p_output_fx[MAX_OUTPUT_CHANNELS+MAX_NUM_OBJECTS]; /* floating-point output audio buffers */ #endif diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c index ff0e7d700..95b5a12ca 100644 --- a/lib_rend/ivas_crend.c +++ b/lib_rend/ivas_crend.c @@ -43,6 +43,7 @@ #include "lib_rend.h" #include "wmc_auto.h" #ifdef IVAS_FLOAT_FIXED +#include "control.h" #include "prot_fx1.h" #include "prot_fx2.h" #include "debug.h" @@ -60,40 +61,58 @@ ivas_error ivas_hrtf_init( HRTFS_DATA *hHrtf /* i/o: HRTF handle */ ) { - int16_t i, j; + Word16 i, j; - if ( hHrtf == NULL ) + IF ( hHrtf == NULL ) { return IVAS_ERR_WRONG_PARAMS; } +#if 1 /*To be removed later: Floating point initialization*/ hHrtf->latency_s = 0; + hHrtf->gain_lfe = 0; +#endif + hHrtf->latency_s_fx = 0; + hHrtf->gain_lfe_fx = 0; hHrtf->max_num_ir = 0; hHrtf->max_num_iterations = 0; - hHrtf->gain_lfe = 0; hHrtf->index_frequency_max_diffuse = 0; + move16(); + move16(); + move16(); + move16(); + move16(); - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { +#if 1 /*To be removed later: Floating point initialization*/ hHrtf->inv_diffuse_weight[i] = 0; +#endif hHrtf->inv_diffuse_weight_fx[i] = 0; - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + move16(); + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { +#if 1 /*To be removed later: Floating point memory allocation*/ + hHrtf->pOut_to_bin_re[i][j] = NULL; + hHrtf->pOut_to_bin_im[i][j] = NULL; +#endif hHrtf->num_iterations[i][j] = 0; + move16(); hHrtf->pIndex_frequency_max[i][j] = NULL; - hHrtf->pOut_to_bin_re[i][j] = NULL; hHrtf->pOut_to_bin_re_fx[i][j] = NULL; - hHrtf->pOut_to_bin_im[i][j] = NULL; hHrtf->pOut_to_bin_im_fx[i][j] = NULL; } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - hHrtf->num_iterations_diffuse[j] = 0; - hHrtf->pIndex_frequency_max_diffuse[j] = NULL; +#if 1 /*To be removed later: Floating point memory allocations*/ hHrtf->pOut_to_bin_diffuse_re[j] = NULL; hHrtf->pOut_to_bin_diffuse_im[j] = NULL; +#endif + hHrtf->num_iterations_diffuse[j] = 0; + move16(); + hHrtf->pIndex_frequency_max_diffuse[j] = NULL; hHrtf->pOut_to_bin_diffuse_re_fx[j] = NULL; hHrtf->pOut_to_bin_diffuse_im_fx[j] = NULL; @@ -154,7 +173,36 @@ ivas_error ivas_hrtf_init( * * Open hHrtf handle *------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static ivas_error ivas_hrtf_open( + HRTFS_HANDLE *hHrtf_out /* o : HRTF handle */ +) +{ + HRTFS_HANDLE hHrtf; + ivas_error error; + + IF ( *hHrtf_out == NULL ) + { + IF ( ( hHrtf = (HRTFS_HANDLE) malloc( sizeof( HRTFS_DATA ) ) ) == NULL ) + { + return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for SPAR decoder\n" ); + } + + IF ( ( error = ivas_hrtf_init( hHrtf ) ) != IVAS_ERR_OK ) + { + return error; + } + + *hHrtf_out = hHrtf; + } + ELSE + { + return IVAS_ERR_INTERNAL; + } + return IVAS_ERR_OK; +} +#else static ivas_error ivas_hrtf_open( HRTFS_HANDLE *hHrtf_out /* o : HRTF handle */ ) @@ -183,6 +231,7 @@ static ivas_error ivas_hrtf_open( return IVAS_ERR_OK; } +#endif // IVAS_FLOAT_FIXED /*------------------------------------------------------------------------- @@ -212,15 +261,15 @@ static void ivas_hrtf_close( * Allocate and initialize crend renderer handle *------------------------------------------------------------------------*/ -static ivas_error ivas_rend_initCrend( +static ivas_error ivas_rend_initCrend_fx( CREND_WRAPPER *pCrend, const AUDIO_CONFIG inConfig, const AUDIO_CONFIG outConfig, HRTFS_CREND_HANDLE hSetOfHRTF, - const int32_t output_Fs ) + const Word32 output_Fs ) { - int16_t i, j, tmp; - int16_t nchan_in; + Word16 i, j, tmp; + Word16 nchan_in; IVAS_REND_AudioConfigType inConfigType; HRTFS_HANDLE hHrtf; ivas_error error; @@ -229,813 +278,1070 @@ static ivas_error ivas_rend_initCrend( hHrtf = pCrend->hHrtfCrend; /* Do all error checks up front so that the nested if later is easier */ - if ( inConfigType != IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED && inConfigType != IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + IF( NE_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) && NE_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Encountered unsupported input config in Crend" ); } - if ( outConfig != IVAS_AUDIO_CONFIG_BINAURAL && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) + IF( NE_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL ) && NE_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) && NE_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB ) ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Encountered unsupported output type in Crend" ); } - if ( hHrtf == NULL ) + IF ( hHrtf == NULL ) { - if ( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK ) + IF ( ivas_hrtf_open( &hHrtf ) != IVAS_ERR_OK ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for HRTF handle" ); } } - if ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) + IF ( ( error = getAudioConfigNumChannels( inConfig, &nchan_in ) ) != IVAS_ERR_OK ) { return error; } hHrtf->max_num_ir = nchan_in; + move16(); - if ( hHrtf->max_num_ir <= 0 ) + IF( LE_16( hHrtf->max_num_ir, 0 ) ) { return IVAS_ERR_INTERNAL_FATAL; } - if ( hSetOfHRTF == NULL ) + IF( hSetOfHRTF == NULL ) { - if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { - hHrtf->max_num_ir -= 1; /* subtract LFE */ - hHrtf->gain_lfe = GAIN_LFE; + hHrtf->max_num_ir = sub( hHrtf->max_num_ir, 1 ); /* subtract LFE */ + hHrtf->gain_lfe_fx = GAIN_LFE_FX; + move16(); - if ( output_Fs == 48000 ) + IF( EQ_32( output_Fs, 48000 ) ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_Combined_BRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_48kHz; hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_48kHz; } - else + ELSE { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_Combined_BRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_48kHz; hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_48kHz; } + move32(); + move16(); + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_48kHz[j]; +#if 1 // To be removed later:Floating pointer initialization hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_48kHz_fx[j]; } - else + ELSE { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; +#if 1 // To be removed later:Floating pointer initialization hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_48kHz_fx[j]; } + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 32000 ) + ELSE IF( EQ_32( output_Fs, 32000 ) ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_Combined_BRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_32kHz; hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_32kHz; } - else + ELSE { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_Combined_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_32kHz; hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_32kHz; } + move32(); + move16(); + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_32kHz[j]; +#if 1 /*To be removed later: Floating pointer intializations*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_32kHz_fx[j]; } - else + ELSE { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; +#if 1 /*To be removed later: Floating pointer intializations*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_32kHz_fx[j]; } + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 16000 ) + ELSE IF( EQ_32( output_Fs, 16000 ) ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { - hHrtf->latency_s = CRendBin_Combined_BRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_Combined_BRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_Combined_BRIR_max_num_iterations_16kHz; hHrtf->index_frequency_max_diffuse = CRendBin_Combined_BRIR_index_frequency_max_diffuse_16kHz; } - else + ELSE { - hHrtf->latency_s = CRendBin_Combined_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_Combined_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_Combined_HRIR_max_num_iterations_16kHz; hHrtf->index_frequency_max_diffuse = CRendBin_Combined_HRIR_index_frequency_max_diffuse_16kHz; } + move32(); + move16(); + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_BRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_BRIR_pIndex_frequency_max_diffuse_16kHz[j]; +#if 1 /*To be removed later: Floating pointer intializations*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_BRIR_coeff_diffuse_im_16kHz_fx[j]; } - else + ELSE { hHrtf->num_iterations_diffuse[j] = CRendBin_Combined_HRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_Combined_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; +#if 1 /*To be removed later: Floating pointer intializations*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz_fx[j]; } + move32(); + move32(); + move16(); + move16(); } } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); } - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - if ( inConfig == IVAS_AUDIO_CONFIG_5_1 ) + IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_5_1 ) ) { tmp = channelIndex_CICP6[i]; } - else if ( inConfig == IVAS_AUDIO_CONFIG_7_1 ) + ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_7_1 ) ) { tmp = channelIndex_CICP12[i]; } - else if ( inConfig == IVAS_AUDIO_CONFIG_5_1_2 ) + ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_5_1_2 ) ) { tmp = channelIndex_CICP14[i]; } - else if ( inConfig == IVAS_AUDIO_CONFIG_5_1_4 ) + ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_5_1_4 ) ) { tmp = channelIndex_CICP16[i]; } - else if ( inConfig == IVAS_AUDIO_CONFIG_7_1_4 ) + ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_7_1_4 ) ) { tmp = channelIndex_CICP19[i]; } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" ); } + move16(); - if ( output_Fs == 48000 ) + IF( EQ_32( output_Fs, 48000 ) ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz[tmp]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_48kHz_fx[tmp]; } - else + ELSE { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz[tmp]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_48kHz_fx[tmp]; } + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_48kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_48kHz[tmp][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz[tmp][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_48kHz[tmp][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_48kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_BRIR_coeff_im_48kHz_fx[tmp][j]; } - else + ELSE { hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_48kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_48kHz[tmp][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz[tmp][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_48kHz[tmp][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_48kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_HRIR_coeff_im_48kHz_fx[tmp][j]; } + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 32000 ) + ELSE IF( EQ_32( output_Fs, 32000 ) ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz[tmp]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz_fx[tmp]; } - else + ELSE { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_32kHz[tmp]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_32kHz_fx[tmp]; } + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_32kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_32kHz[tmp][j]; +#if 1 /*To be removed later: Floating pointer intializations*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz[tmp][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_32kHz[tmp][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_32kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_BRIR_coeff_im_32kHz_fx[tmp][j]; } - else + ELSE { hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_32kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_32kHz[tmp][j]; +#if 1 /*To be removed later: Floating pointer intializations*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz[tmp][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_32kHz[tmp][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_32kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_HRIR_coeff_im_32kHz_fx[tmp][j]; } + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 16000 ) + ELSE IF( EQ_32( output_Fs, 16000 ) ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz[tmp]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_Combined_BRIR_inv_diffuse_weight_16kHz_fx[tmp]; } - else + ELSE { - hHrtf->inv_diffuse_weight[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz[tmp]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_Combined_HRIR_inv_diffuse_weight_16kHz_fx[tmp]; } + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { hHrtf->num_iterations[i][j] = CRendBin_Combined_BRIR_num_iterations_16kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_BRIR_pIndex_frequency_max_16kHz[tmp][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz[tmp][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_BRIR_coeff_im_16kHz[tmp][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_BRIR_coeff_re_16kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_BRIR_coeff_im_16kHz_fx[tmp][j]; } - else + ELSE { hHrtf->num_iterations[i][j] = CRendBin_Combined_HRIR_num_iterations_16kHz[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_Combined_HRIR_pIndex_frequency_max_16kHz[tmp][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz[tmp][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_Combined_HRIR_coeff_im_16kHz[tmp][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_Combined_HRIR_coeff_re_16kHz_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_Combined_HRIR_coeff_im_16kHz_fx[tmp][j]; } + move32(); + move32(); + move16(); + move16(); } } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); } } } - else if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + ELSE IF( EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) ) { - if ( inConfig == IVAS_AUDIO_CONFIG_HOA3 ) + IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_HOA3 ) ) { - if ( output_Fs == 48000 ) + IF( EQ_32( output_Fs, 48000 ) ) { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_HOA3_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_48kHz; hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_48kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_48kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_48kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_48kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz[i][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA3_HRIR_coeff_im_48kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_48kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 32000 ) + ELSE IF( EQ_32( output_Fs, 32000 ) ) { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_HOA3_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_32kHz; hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_32kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_32kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_32kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_32kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz[i][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA3_HRIR_coeff_im_32kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_32kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 16000 ) + ELSE IF( EQ_32(output_Fs , 16000) ) { - hHrtf->latency_s = CRendBin_HOA3_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_HOA3_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_HOA3_HRIR_max_num_iterations_16kHz; hHrtf->index_frequency_max_diffuse = CRendBin_HOA3_HRIR_index_frequency_max_diffuse_16kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_HOA3_HRIR_inv_diffuse_weight_16kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_HOA3_HRIR_num_iterations_16kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_16kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz[i][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA3_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA3_HRIR_coeff_im_16kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA3_HRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA3_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); } } - else if ( inConfig == IVAS_AUDIO_CONFIG_HOA2 ) + ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_HOA2 ) ) { - if ( output_Fs == 48000 ) + IF( EQ_32( output_Fs, 48000 ) ) { - hHrtf->latency_s = CRendBin_HOA2_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_HOA2_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_HOA2_HRIR_max_num_iterations_48kHz; hHrtf->index_frequency_max_diffuse = CRendBin_HOA2_HRIR_index_frequency_max_diffuse_48kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_48kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_48kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_48kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_48kHz[i][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA2_HRIR_coeff_im_48kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_48kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 32000 ) + ELSE IF( EQ_32( output_Fs, 32000 ) ) { - hHrtf->latency_s = CRendBin_HOA2_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_HOA2_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_HOA2_HRIR_max_num_iterations_32kHz; hHrtf->index_frequency_max_diffuse = CRendBin_HOA2_HRIR_index_frequency_max_diffuse_32kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_32kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_32kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_32kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_32kHz[i][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA2_HRIR_coeff_im_32kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_32kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 16000 ) + ELSE IF( EQ_32( output_Fs, 16000 ) ) { - hHrtf->latency_s = CRendBin_HOA2_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_HOA2_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_HOA2_HRIR_max_num_iterations_16kHz; hHrtf->index_frequency_max_diffuse = CRendBin_HOA2_HRIR_index_frequency_max_diffuse_16kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_HOA2_HRIR_inv_diffuse_weight_16kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_HOA2_HRIR_num_iterations_16kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_16kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_HOA2_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_HOA2_HRIR_coeff_im_16kHz[i][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_HOA2_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_HOA2_HRIR_coeff_im_16kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_HOA2_HRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_HOA2_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); } } - else if ( inConfig == IVAS_AUDIO_CONFIG_FOA ) + ELSE IF( EQ_16( inConfig, IVAS_AUDIO_CONFIG_FOA ) ) { - if ( output_Fs == 48000 ) + IF( EQ_32( output_Fs, 48000 ) ) { - hHrtf->latency_s = CRendBin_FOA_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_FOA_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_FOA_HRIR_max_num_iterations_48kHz; hHrtf->index_frequency_max_diffuse = CRendBin_FOA_HRIR_index_frequency_max_diffuse_48kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_48kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_48kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_48kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_48kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_48kHz[i][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_48kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_FOA_HRIR_coeff_im_48kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_48kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_48kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_48kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_48kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 32000 ) + ELSE IF( EQ_32( output_Fs, 32000 ) ) { - hHrtf->latency_s = CRendBin_FOA_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_FOA_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_FOA_HRIR_max_num_iterations_32kHz; hHrtf->index_frequency_max_diffuse = CRendBin_FOA_HRIR_index_frequency_max_diffuse_32kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_32kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_32kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_32kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_32kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_32kHz[i][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_32kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_FOA_HRIR_coeff_im_32kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_32kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_32kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_32kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_32kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else if ( output_Fs == 16000 ) + ELSE IF( EQ_32( output_Fs, 16000 ) ) { - hHrtf->latency_s = CRendBin_FOA_HRIR_latency_s; + hHrtf->latency_s_fx = CRendBin_FOA_HRIR_latency_s_fx; hHrtf->max_num_iterations = CRendBin_FOA_HRIR_max_num_iterations_16kHz; hHrtf->index_frequency_max_diffuse = CRendBin_FOA_HRIR_index_frequency_max_diffuse_16kHz; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz[i]; hHrtf->inv_diffuse_weight_fx[i] = CRendBin_FOA_HRIR_inv_diffuse_weight_16kHz_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = CRendBin_FOA_HRIR_num_iterations_16kHz[i][j]; hHrtf->pIndex_frequency_max[i][j] = CRendBin_FOA_HRIR_pIndex_frequency_max_16kHz[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = CRendBin_FOA_HRIR_coeff_re_16kHz[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = CRendBin_FOA_HRIR_coeff_im_16kHz[i][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = CRendBin_FOA_HRIR_coeff_re_16kHz_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = CRendBin_FOA_HRIR_coeff_im_16kHz_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = CRendBin_FOA_HRIR_num_iterations_diffuse_16kHz[j]; hHrtf->pIndex_frequency_max_diffuse[j] = CRendBin_FOA_HRIR_pIndex_frequency_max_diffuse_16kHz[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_re_16kHz_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INVALID_SAMPLING_RATE, "Encountered Unsupported sampling rate in Crend" ); } } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INVALID_INPUT_FORMAT, "Encountered unsupported input config in Crend" ); } } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" ); } } - else + ELSE { - if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) + IF( EQ_16( inConfigType, IVAS_REND_AUDIO_CONFIG_TYPE_CHANNEL_BASED ) ) { hHrtf->max_num_ir -= 1; /* subtract LFE */ - hHrtf->gain_lfe = GAIN_LFE; + hHrtf->gain_lfe_fx = GAIN_LFE_FX; + move16(); - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF( EQ_16( outConfig, IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) ) { - hHrtf->latency_s = hSetOfHRTF->hHRTF_brir_combined->latency_s; + hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_brir_combined->latency_s_fx; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_brir_combined->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_brir_combined->index_frequency_max_diffuse; } - else + ELSE { - hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_combined->latency_s; + hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_hrir_combined->latency_s_fx; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_combined->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_combined->index_frequency_max_diffuse; } + move32(); + move16(); + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) ) { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_brir_combined->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_brir_combined->pIndex_frequency_max_diffuse[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_im[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_diffuse_im_fx[j]; } - else + ELSE { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_hrir_combined->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_hrir_combined->pIndex_frequency_max_diffuse[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_im[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_diffuse_im_fx[j]; } + move32(); + move32(); + move16(); + move16(); } - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR ( i = 0; i < hHrtf->max_num_ir; i++ ) { - if ( inConfig == IVAS_AUDIO_CONFIG_5_1 ) + IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_5_1) ) { tmp = channelIndex_CICP6[i]; } - else if ( inConfig == IVAS_AUDIO_CONFIG_7_1 ) + ELSE IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_7_1) ) { tmp = channelIndex_CICP12[i]; } - else if ( inConfig == IVAS_AUDIO_CONFIG_5_1_2 ) + ELSE IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_5_1_2) ) { tmp = channelIndex_CICP14[i]; } - else if ( inConfig == IVAS_AUDIO_CONFIG_5_1_4 ) + ELSE IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_5_1_4) ) { tmp = channelIndex_CICP16[i]; } - else if ( inConfig == IVAS_AUDIO_CONFIG_7_1_4 ) + ELSE IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_7_1_4) ) { tmp = channelIndex_CICP19[i]; } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Error: Channel configuration not specified!\n\n" ); } + move16(); - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) ) { - hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_brir_combined->inv_diffuse_weight[tmp]; hHrtf->inv_diffuse_weight_fx[i] = hSetOfHRTF->hHRTF_brir_combined->inv_diffuse_weight_fx[tmp]; } - else + ELSE { - hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_hrir_combined->inv_diffuse_weight[tmp]; hHrtf->inv_diffuse_weight_fx[i] = hSetOfHRTF->hHRTF_hrir_combined->inv_diffuse_weight_fx[tmp]; } + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { - if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR ) + IF ( EQ_16(outConfig , IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR) ) { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_brir_combined->num_iterations[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_brir_combined->pIndex_frequency_max[tmp][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_re[tmp][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_re_fx[tmp][j]; hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_im[tmp][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_re_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_brir_combined->pOut_to_bin_im_fx[tmp][j]; } - else + ELSE { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_combined->num_iterations[tmp][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pIndex_frequency_max[tmp][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_re[tmp][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_re_fx[tmp][j]; hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_im[tmp][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_re_fx[tmp][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_hrir_combined->pOut_to_bin_im_fx[tmp][j]; } + move32(); + move32(); + move16(); + move16(); } } } - else if ( inConfigType == IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS ) + ELSE IF( EQ_16( inConfigType , IVAS_REND_AUDIO_CONFIG_TYPE_AMBISONICS) ) { - if ( inConfig == IVAS_AUDIO_CONFIG_HOA3 ) + IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_HOA3) ) { - hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_hoa3->latency_s; + hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_hrir_hoa3->latency_s_fx; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa3->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_hoa3->index_frequency_max_diffuse; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR ( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_hrir_hoa3->inv_diffuse_weight[i]; hHrtf->inv_diffuse_weight_fx[i] = hSetOfHRTF->hHRTF_hrir_hoa3->inv_diffuse_weight_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->num_iterations[i][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pIndex_frequency_max[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_re[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_im[i][j]; +#endif // 1 + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_im_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_hrir_hoa3->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pIndex_frequency_max_diffuse[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_im[j]; +#endif // 1 + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa3->pOut_to_bin_diffuse_im_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else if ( inConfig == IVAS_AUDIO_CONFIG_HOA2 ) + ELSE IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_HOA2) ) { - hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_hoa2->latency_s; + hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_hrir_hoa2->latency_s_fx; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_hoa2->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_hoa2->index_frequency_max_diffuse; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR ( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_hrir_hoa2->inv_diffuse_weight[i]; hHrtf->inv_diffuse_weight_fx[i] = hSetOfHRTF->hHRTF_hrir_hoa2->inv_diffuse_weight_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->num_iterations[i][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pIndex_frequency_max[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_re[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_im[i][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_im_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_hrir_hoa2->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pIndex_frequency_max_diffuse[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_im[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_hrir_hoa2->pOut_to_bin_diffuse_im_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else if ( inConfig == IVAS_AUDIO_CONFIG_FOA ) + ELSE IF ( EQ_16(inConfig , IVAS_AUDIO_CONFIG_FOA) ) { - hHrtf->latency_s = hSetOfHRTF->hHRTF_hrir_foa->latency_s; + hHrtf->latency_s_fx = hSetOfHRTF->hHRTF_hrir_foa->latency_s_fx; hHrtf->max_num_iterations = hSetOfHRTF->hHRTF_hrir_foa->max_num_iterations; hHrtf->index_frequency_max_diffuse = hSetOfHRTF->hHRTF_hrir_foa->index_frequency_max_diffuse; + move32(); + move16(); + move16(); - for ( i = 0; i < hHrtf->max_num_ir; i++ ) + FOR ( i = 0; i < hHrtf->max_num_ir; i++ ) { - hHrtf->inv_diffuse_weight[i] = hSetOfHRTF->hHRTF_hrir_foa->inv_diffuse_weight[i]; hHrtf->inv_diffuse_weight_fx[i] = hSetOfHRTF->hHRTF_hrir_foa->inv_diffuse_weight_fx[i]; + move16(); - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations[i][j] = hSetOfHRTF->hHRTF_hrir_foa->num_iterations[i][j]; hHrtf->pIndex_frequency_max[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pIndex_frequency_max[i][j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_re[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_re[i][j]; - hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_im[i][j]; +#endif + hHrtf->pOut_to_bin_re_fx[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_re_fx[i][j]; hHrtf->pOut_to_bin_im_fx[i][j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_im_fx[i][j]; + move32(); + move32(); + move16(); + move16(); } } - for ( j = 0; j < BINAURAL_CHANNELS; j++ ) + FOR ( j = 0; j < BINAURAL_CHANNELS; j++ ) { hHrtf->num_iterations_diffuse[j] = hSetOfHRTF->hHRTF_hrir_foa->num_iterations_diffuse[j]; hHrtf->pIndex_frequency_max_diffuse[j] = hSetOfHRTF->hHRTF_hrir_foa->pIndex_frequency_max_diffuse[j]; +#if 1 /*To be removed later: Floating pointer initialization*/ hHrtf->pOut_to_bin_diffuse_re[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_re[j]; - hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_im[j]; +#endif + hHrtf->pOut_to_bin_diffuse_re_fx[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_re_fx[j]; hHrtf->pOut_to_bin_diffuse_im_fx[j] = hSetOfHRTF->hHRTF_hrir_foa->pOut_to_bin_diffuse_im_fx[j]; + move32(); + move32(); + move16(); + move16(); } } - else + ELSE { return IVAS_ERROR( IVAS_ERR_INTERNAL, "Unsupported renderer type in Crend" ); } @@ -1047,7 +1353,7 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERR_OK; } -#else +#endif /*------------------------------------------------------------------------- * initCrend_from_rom() * @@ -1789,7 +2095,6 @@ static ivas_error ivas_rend_initCrend( return IVAS_ERR_OK; } -#endif /*------------------------------------------------------------------------- * ivas_shoebox_data_init() * @@ -2020,57 +2325,75 @@ static ivas_error ivas_er_init_handle( ivas_error ivas_rend_initCrendWrapper( CREND_WRAPPER_HANDLE *pCrend ) { - int16_t i; + Word16 i; CREND_HANDLE hCrend; - if ( pCrend == NULL ) + IF ( pCrend == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); } - if ( ( *pCrend = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) + IF ( ( *pCrend = (CREND_WRAPPER_HANDLE) malloc( sizeof( CREND_WRAPPER ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Crend Wrapper\n" ); } ( *pCrend )->binaural_latency_ns = 0; + move32(); ( *pCrend )->hHrtfCrend = NULL; { hCrend = NULL; - if ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) + IF ( ( hCrend = (CREND_HANDLE) malloc( sizeof( CREND_DATA ) ) ) == NULL ) { return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for renderer handle" ); } +#if 1//To be removed later:floating pointer initialization hCrend->lfe_delay_line = NULL; +#endif + hCrend->lfe_delay_line_fx = NULL; - for ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) + FOR ( i = 0; i < MAX_INTERN_CHANNELS; i++ ) { +#if 1//To be removed later:floating pointer initialization hCrend->freq_buffer_re[i] = NULL; hCrend->freq_buffer_im[i] = NULL; +#endif hCrend->freq_buffer_re_fx[i] = NULL; hCrend->freq_buffer_im_fx[i] = NULL; } - for ( i = 0; i < BINAURAL_CHANNELS; i++ ) + FOR ( i = 0; i < BINAURAL_CHANNELS; i++ ) { +#if 1//To be removed later:floating pointer initialization hCrend->prev_out_buffer[i] = NULL; +#endif hCrend->prev_out_buffer_fx[i] = NULL; } +#if 1 hCrend->freq_buffer_re_diffuse = NULL; - hCrend->freq_buffer_re_diffuse_fx = NULL; hCrend->freq_buffer_im_diffuse = NULL; + hCrend->hTrack = NULL; + hCrend->m_fYaw = 0; + hCrend->m_fPitch = 0; + hCrend->m_fRoll = 0; +#endif + hCrend->freq_buffer_re_diffuse_fx = NULL; hCrend->freq_buffer_im_diffuse_fx = NULL; hCrend->hReverb = NULL; hCrend->reflections = NULL; hCrend->delay_line_rw_index = 0; hCrend->diffuse_delay_line_rw_index = 0; - hCrend->hTrack = NULL; - hCrend->m_fYaw = 0; - hCrend->m_fPitch = 0; - hCrend->m_fRoll = 0; + move16(); + move16(); + hCrend->m_fYaw_fx = 0; + hCrend->m_fPitch_fx = 0; + hCrend->m_fRoll_fx = 0; + move32(); + move32(); + move32(); ( *pCrend )->hCrend = hCrend; } @@ -2173,10 +2496,37 @@ ivas_error ivas_rend_openCrend( if ( ( *pCrend )->hHrtfCrend == NULL ) { +#ifdef IVAS_FLOAT_FIXED +#if 1 /*Cleanup changes: float to fixed*/ + IF( hSetOfHRTF ) + { + hSetOfHRTF->hHRTF_brir_combined->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_brir_combined->latency_s, 31 ); + hSetOfHRTF->hHRTF_hrir_foa->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_foa->latency_s, 31 ); + hSetOfHRTF->hHRTF_hrir_combined->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_combined->latency_s, 31 ); + hSetOfHRTF->hHRTF_hrir_hoa3->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa3->latency_s, 31 ); + hSetOfHRTF->hHRTF_hrir_hoa2->latency_s_fx = floatToFixed( hSetOfHRTF->hHRTF_hrir_hoa2->latency_s, 31 ); + floatToFixed_arr( hSetOfHRTF->hHRTF_brir_combined->inv_diffuse_weight, hSetOfHRTF->hHRTF_brir_combined->inv_diffuse_weight_fx, 15, 16 ); + floatToFixed_arr( hSetOfHRTF->hHRTF_hrir_combined->inv_diffuse_weight, hSetOfHRTF->hHRTF_hrir_combined->inv_diffuse_weight_fx, 15, 16 ); + floatToFixed_arr( hSetOfHRTF->hHRTF_hrir_hoa3->inv_diffuse_weight, hSetOfHRTF->hHRTF_hrir_hoa3->inv_diffuse_weight_fx, 15, 16 ); + floatToFixed_arr( hSetOfHRTF->hHRTF_hrir_hoa2->inv_diffuse_weight, hSetOfHRTF->hHRTF_hrir_hoa2->inv_diffuse_weight_fx, 15, 16 ); + floatToFixed_arr( hSetOfHRTF->hHRTF_hrir_foa->inv_diffuse_weight, hSetOfHRTF->hHRTF_hrir_foa->inv_diffuse_weight_fx, 15, 16 ); + } + IF ( ( error = ivas_rend_initCrend_fx( *pCrend, inConfig, outConfig, hSetOfHRTF, output_Fs ) ) != IVAS_ERR_OK ) + { + return error; + } +#if 1/*Cleanup changes: float to fixed*/ + ( *pCrend )->hHrtfCrend->gain_lfe = fixedToFloat( ( *pCrend )->hHrtfCrend->gain_lfe_fx, 14 ); + ( *pCrend )->hHrtfCrend->latency_s = fixedToFloat( ( *pCrend )->hHrtfCrend->latency_s_fx, 31 ); + fixedToFloat_arr( ( *pCrend )->hHrtfCrend->inv_diffuse_weight_fx, ( *pCrend )->hHrtfCrend->inv_diffuse_weight, 15, 16 ); +#endif +#endif // 1 +#else if ( ( error = ivas_rend_initCrend( *pCrend, inConfig, outConfig, hSetOfHRTF, output_Fs ) ) != IVAS_ERR_OK ) { return error; } +#endif } { diff --git a/lib_rend/ivas_reverb.c b/lib_rend/ivas_reverb.c index cbaea7654..62bc18e75 100644 --- a/lib_rend/ivas_reverb.c +++ b/lib_rend/ivas_reverb.c @@ -675,6 +675,36 @@ static float calc_dmx_gain( void ) * Calculate the predelay, taking shortest jot loop delay into account *-----------------------------------------------------------------------------------------*/ +#ifdef IVAS_FLOAT_FIXED +static void calc_predelay_fx( + ivas_reverb_params_t *pParams, + Word32 acoustic_predelay_sec, + const Word32 output_Fs ) +{ + Word16 predelay, fbdelay, output_frame; + predelay = round_fx( L_shl( Mult_32_32( L_shl( output_Fs, 15 ), acoustic_predelay_sec ), 5 ) ); + output_frame = (Word16) Mult_32_16( output_Fs, INV_FRAME_PER_SEC_Q15 ); + fbdelay = pParams->pLoop_delays[sub( pParams->nr_loops, 1 )]; + move16(); + predelay = sub( predelay, fbdelay ); + + IF ( LT_16(predelay , 0) ) + { + predelay = 0; + } + + IF ( LT_16(output_frame , predelay) ) + { + predelay = output_frame; + } + + pParams->pre_delay = predelay; + move16(); + move16(); + move16(); + return; +} +#endif static void calc_predelay( ivas_reverb_params_t *pParams, float acoustic_predelay_sec, @@ -1654,7 +1684,12 @@ ivas_error ivas_reverb_open( pState->dmx_gain_fx = calc_dmx_gain_fx(); /* set up predelay - must be after set_base_config() and before compute_t60_coeffs() */ +#ifdef IVAS_FLOAT_FIXED + hRenderConfig->roomAcoustics.acousticPreDelay_fx = floatToFixed( hRenderConfig->roomAcoustics.acousticPreDelay, 27 ); + calc_predelay_fx( ¶ms, hRenderConfig->roomAcoustics.acousticPreDelay_fx, output_Fs ); +#else calc_predelay( ¶ms, hRenderConfig->roomAcoustics.acousticPreDelay, output_Fs ); +#endif // IVAS_FLOAT_FIXED /* set up jot reverb 60 filters - must be set up after set_reverb_acoustic_data() */ if ( ( error = compute_t60_coeffs( ¶ms, nr_fc_fft_filter, output_Fs ) ) != IVAS_ERR_OK ) diff --git a/lib_rend/ivas_rom_binaural_crend_head.c b/lib_rend/ivas_rom_binaural_crend_head.c index 9231094b4..703993579 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.c +++ b/lib_rend/ivas_rom_binaural_crend_head.c @@ -55,6 +55,9 @@ const float CRendBin_Combined_HRIR_latency_s = 0.000020834f; +#ifdef IVAS_FLOAT_FIXED +const Word32 CRendBin_Combined_HRIR_latency_s_fx = 44741;/*Q-31*/ +#endif // IVAS_FLOAT_FIXED /* Sample Rate = 48000 */ const int16_t CRendBin_Combined_HRIR_max_num_iterations_48kHz = 1; @@ -667,6 +670,9 @@ const Word32 *CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS /********************** CRendBin_FOA_HRIR **********************/ const float CRendBin_FOA_HRIR_latency_s = 0.000020834f; +#ifdef IVAS_FLOAT_FIXED +const Word32 CRendBin_FOA_HRIR_latency_s_fx = 44741; +#endif // IVAS_FLOAT_FIXED /* Sample Rate = 48000 */ @@ -883,6 +889,9 @@ const Word32 *CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={NU /********************** CRendBin_HOA2_HRIR **********************/ const float CRendBin_HOA2_HRIR_latency_s = 0.000020834f; +#ifdef IVAS_FLOAT_FIXED +const Word32 CRendBin_HOA2_HRIR_latency_s_fx = 44741; +#endif // IVAS_FLOAT_FIXED /* Sample Rate = 48000 */ @@ -1280,6 +1289,9 @@ const Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={N const float CRendBin_HOA3_HRIR_latency_s = 0.000020834f; +#ifdef IVAS_FLOAT_FIXED +const float CRendBin_HOA3_HRIR_latency_s_fx = 44741;/*Q-31*/ +#endif /* Sample Rate = 48000 */ const int16_t CRendBin_HOA3_HRIR_max_num_iterations_48kHz = 1; @@ -1928,6 +1940,9 @@ const Word32 *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]={N const float CRendBin_Combined_BRIR_latency_s = 0.000145834f; +#ifdef IVAS_FLOAT_FIXED +const Word32 CRendBin_Combined_BRIR_latency_s_fx = 313176;/*Q-31*/ +#endif /* Sample Rate = 48000 */ const int16_t CRendBin_Combined_BRIR_max_num_iterations_48kHz = 22; diff --git a/lib_rend/ivas_rom_binaural_crend_head.h b/lib_rend/ivas_rom_binaural_crend_head.h index 61b7519b5..5ecc75f2a 100644 --- a/lib_rend/ivas_rom_binaural_crend_head.h +++ b/lib_rend/ivas_rom_binaural_crend_head.h @@ -55,6 +55,9 @@ extern Word32 cosine_table_Q31 [181]; /********************** CRendBin_Combined_HRIR **********************/ extern float CRendBin_Combined_HRIR_latency_s; +#ifdef IVAS_FLOAT_FIXED +extern Word32 CRendBin_Combined_HRIR_latency_s_fx; +#endif // IVAS_FLOAT_FIXED /* Sample Rate = 48000 */ @@ -131,6 +134,9 @@ extern float *CRendBin_Combined_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; /********************** CRendBin_FOA_HRIR **********************/ extern float CRendBin_FOA_HRIR_latency_s; +#ifdef IVAS_FLOAT_FIXED +extern Word32 CRendBin_FOA_HRIR_latency_s_fx; +#endif // IVAS_FLOAT_FIXED /* Sample Rate = 48000 */ @@ -206,6 +212,9 @@ extern float *CRendBin_FOA_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; /********************** CRendBin_HOA2_HRIR **********************/ extern float CRendBin_HOA2_HRIR_latency_s; +#ifdef IVAS_FLOAT_FIXED +extern Word32 CRendBin_HOA2_HRIR_latency_s_fx; +#endif // IVAS_FLOAT_FIXED /* Sample Rate = 48000 */ @@ -281,6 +290,10 @@ extern Word32 *CRendBin_HOA2_HRIR_coeff_diffuse_im_16kHz_fx[BINAURAL_CHANNELS]; /********************** CRendBin_HOA3_HRIR **********************/ extern float CRendBin_HOA3_HRIR_latency_s; +#ifdef IVAS_FLOAT_FIXED +extern Word32 CRendBin_HOA3_HRIR_latency_s_fx; +#endif // IVAS_FLOAT_FIXED + /* Sample Rate = 48000 */ @@ -356,6 +369,9 @@ extern float *CRendBin_HOA3_HRIR_coeff_diffuse_im_16kHz[BINAURAL_CHANNELS]; /********************** CRendBin_Combined_BRIR **********************/ extern float CRendBin_Combined_BRIR_latency_s; +#ifdef IVAS_FLOAT_FIXED +extern Word32 CRendBin_Combined_BRIR_latency_s_fx; +#endif // IVAS_FLOAT_FIXED /* Sample Rate = 48000 */ diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h index cef2c9c67..57d532901 100644 --- a/lib_rend/ivas_stat_rend.h +++ b/lib_rend/ivas_stat_rend.h @@ -1685,6 +1685,10 @@ typedef struct ivas_hrtfs_structure Word16 inv_diffuse_weight_fx[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */ float gain_lfe; +#ifdef IVAS_FLOAT_FIXED + Word32 latency_s_fx; + Word16 gain_lfe_fx; +#endif } HRTFS_DATA, *HRTFS_HANDLE; #else typedef struct ivas_hrtfs_structure @@ -1722,6 +1726,11 @@ typedef struct ivas_crend_state_t Word32 *prev_out_buffer_fx[BINAURAL_CHANNELS]; float *lfe_delay_line; Word32 *lfe_delay_line_fx; +#ifdef IVAS_FLOAT_FIXED + Word32 m_fYaw_fx; + Word32 m_fPitch_fx; + Word32 m_fRoll_fx; +#endif // IVAS_FLOAT_FIXED float m_fYaw; float m_fPitch; float m_fRoll; diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c index 064f4f07d..ec7aacd2a 100644 --- a/lib_rend/lib_rend.c +++ b/lib_rend/lib_rend.c @@ -808,46 +808,47 @@ ivas_error getAudioConfigNumChannels( const AUDIO_CONFIG config, Word16 *numChannels ) { - switch ( config ) + SWITCH ( config ) { case IVAS_AUDIO_CONFIG_MONO: case IVAS_AUDIO_CONFIG_OBA: case IVAS_AUDIO_CONFIG_MASA1: *numChannels = 1; - break; + BREAK; case IVAS_AUDIO_CONFIG_STEREO: case IVAS_AUDIO_CONFIG_BINAURAL: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR: case IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB: case IVAS_AUDIO_CONFIG_MASA2: *numChannels = 2; - break; + BREAK; case IVAS_AUDIO_CONFIG_FOA: *numChannels = 4; - break; + BREAK; case IVAS_AUDIO_CONFIG_5_1: *numChannels = 6; - break; + BREAK; case IVAS_AUDIO_CONFIG_7_1: case IVAS_AUDIO_CONFIG_5_1_2: *numChannels = 8; - break; + BREAK; case IVAS_AUDIO_CONFIG_HOA2: *numChannels = 9; - break; + BREAK; case IVAS_AUDIO_CONFIG_5_1_4: *numChannels = 10; - break; + BREAK; case IVAS_AUDIO_CONFIG_7_1_4: *numChannels = 12; - break; + BREAK; case IVAS_AUDIO_CONFIG_HOA3: *numChannels = 16; - break; + BREAK; default: return IVAS_ERR_NUM_CHANNELS_UNKNOWN; } + move16(); return IVAS_ERR_OK; } #else -- GitLab