diff --git a/lib_com/cnst.h b/lib_com/cnst.h
index 775a8a0e01a5eb7d878e512df72cb26f3b3fa379..3787d63b81896cd24fd22e9c82e909a3b24b154a 100644
--- a/lib_com/cnst.h
+++ b/lib_com/cnst.h
@@ -563,9 +563,7 @@ enum
#define INT_FS_12k8 12800 /* internal sampling frequency */
#define M 16 /* order of the LP filter @ 12.8kHz */
-#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT
#define MAX_LP_FILTER_ORDER 20 /* Max order of an LP filter */
-#endif
#define L_FRAME 256 /* frame size at 12.8kHz */
#define NB_SUBFR 4 /* number of subframes per frame */
diff --git a/lib_com/ivas_cnst.h b/lib_com/ivas_cnst.h
index 4e5d9d8ae5a910470368eab79e75a77b20fa329f..105c0e8057fc08f9b1f63be8e0b0aa4d3fc8771d 100755
--- a/lib_com/ivas_cnst.h
+++ b/lib_com/ivas_cnst.h
@@ -1449,11 +1449,7 @@ typedef enum
/* LFE PLC */
#define LFE_PLC_BUFLEN 240
#define LFE_PLC_FS 1600
-#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT
#define L_FRAME_1k6 ( LFE_PLC_FS / FRAMES_PER_SEC )
-#else
-#define L_FRAME_1k6 ( 20 * LFE_PLC_FS / 1000 )
-#endif
#define LFE_PLC_LENANA LFE_PLC_BUFLEN
#define LFE_PLC_FDEL 300
diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h
index 10d35eab496e8108ad45c19810a012bdb07bf12a..700a9cc75cb2420b0466364d1c2e35169d78cdc8 100755
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -4024,7 +4024,6 @@ void ivas_dirac_dec_output_synthesis_cov_close(
);
void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot(
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
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_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */
@@ -4032,14 +4031,6 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot(
const int16_t param_band, /* i : parameter band */
PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */
const int16_t nchan_in /* i : number of input channels */
-#else
- 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 */
-#endif
);
void ivas_dirac_dec_output_synthesis_cov_param_mc_synthesise_slot(
@@ -5532,11 +5523,7 @@ void ivas_lfe_dec(
void ivas_lfe_tdplc(
LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */
-#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT
float *prevsynth, /* i : previous frame synthesis */
-#else
- double *prevsynth, /* i : previous frame synthesis */
-#endif
float *ytda, /* o : output time-domain buffer */
const int16_t output_frame /* i : output frame length */
);
@@ -5784,11 +5771,7 @@ void ivas_omasa_combine_separate_ism_with_masa(
const int16_t output_frame /* i : output frame length per channel */
);
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
ivas_error ivas_omasa_objects_delay_open(
-#else
-ivas_error ivas_omasa_render_objects_from_mix_open(
-#endif
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
diff --git a/lib_com/ivas_rom_com.c b/lib_com/ivas_rom_com.c
index 12223badd44f97128a17b3e222aaeccb451bce7a..5f81d801f7672a0afadac4453627adf8995636e0 100644
--- a/lib_com/ivas_rom_com.c
+++ b/lib_com/ivas_rom_com.c
@@ -3121,7 +3121,6 @@ const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP] = { 1, 0 };
const float ivas_lfe_lpf_delay[2] = { 0.00175f, 0.0035f };
-#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT
const float hamm_lfe_plc[LFE_PLC_LENANA / 2] =
{
0.08000000000000002f, 0.08015895227847719f, 0.08063569926248770f, 0.08142991147368656f, 0.08254104003450596f, 0.08396831704748331f, 0.08571075612595230f, 0.08776715307573196f,
@@ -3140,26 +3139,6 @@ const float hamm_lfe_plc[LFE_PLC_LENANA / 2] =
0.96233504613317988f, 0.96698111571154954f, 0.97133209998031445f, 0.97538499198789563f, 0.97913699079334116f, 0.98258550340204664f, 0.98572814655776630f, 0.98856274838967395f,
0.99108734991333569f, 0.99330020638455863f, 0.99519978850517732f, 0.99678478347994692f, 0.99805409592381300f, 0.99900684861892730f, 0.99964238312089115f, 0.99996026021380402f
};
-#else
-const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2] =
-{
- 0.08000000000000002, 0.08015895227847719, 0.08063569926248770, 0.08142991147368656, 0.08254104003450596, 0.08396831704748331, 0.08571075612595230, 0.08776715307573196,
- 0.09013608672734141, 0.09281591991816535, 0.09580480062389246, 0.09910066323844335, 0.10270123000150438, 0.10660401257268071, 0.11080631375118072, 0.11530522933984272,
- 0.12009765015221685, 0.12518026416131367, 0.13054955878853602, 0.13620182333121073, 0.14213315152704381, 0.14833944425372619, 0.15481641236182375, 0.16155957963899570,
- 0.16856428590349043, 0.17582569022478273, 0.18333877426912554, 0.19109834576770490, 0.19909904210500018, 0.20733533402487142, 0.21580152945181053, 0.22449177742471671,
- 0.23340007214047787, 0.24252025710456171, 0.25184602938575001, 0.26137094397207467, 0.27108841822494550, 0.28099173642839037, 0.29107405443026624, 0.30132840437223085,
- 0.31174769950520753, 0.32232473908701620, 0.33305221335878232, 0.34392270859668939, 0.35492871223557998, 0.36606261806086549, 0.37731673146515798, 0.38868327476598852,
- 0.40015439258093899, 0.41172215725647360, 0.42337857434671339, 0.43511558813837425, 0.44692508721804453, 0.45879891007795709, 0.47072885075638249, 0.48270666450874267,
- 0.49472407350552849, 0.50677277255308162, 0.51884443483328757, 0.53093071765821398, 0.54302326823571601, 0.55511372944202464, 0.56719374559732838, 0.57925496824035816,
- 0.59128906189798180, 0.60328770984582458, 0.61524261985593010, 0.62714552992749328, 0.63898821399670414, 0.65076248762175315, 0.66246021363907504, 0.67407330778691554,
- 0.68559374429233988, 0.69701356141781945, 0.70832486696356345, 0.71951984372179334, 0.73059075487919101, 0.74152994936378558, 0.75232986713258543, 0.76298304439630038,
- 0.77348211877754336, 0.78381983439894576, 0.79398904689767136, 0.80398272836286389, 0.81379397219261318, 0.82341599786708708, 0.83284215563452701, 0.84206593110687011,
- 0.85108094976182280, 0.85988098134827329, 0.86845994419199846, 0.87681190939868969, 0.88493110495139349, 0.89281191969953333, 0.90044890723675941, 0.90783678966494241,
- 0.91497046124171255, 0.92184499190902180, 0.92845563070029180, 0.93479780902379184, 0.94086714381997805, 0.94665944059061280, 0.95217069629756890, 0.95739710212931617,
- 0.96233504613317988, 0.96698111571154954, 0.97133209998031445, 0.97538499198789563, 0.97913699079334116, 0.98258550340204664, 0.98572814655776630, 0.98856274838967395,
- 0.99108734991333569, 0.99330020638455863, 0.99519978850517732, 0.99678478347994692, 0.99805409592381300, 0.99900684861892730, 0.99964238312089115, 0.99996026021380402
-};
-#endif
/*------------------------------------------------------------------------------------------*
* MDFT/iMDFT ROM tables
diff --git a/lib_com/ivas_rom_com.h b/lib_com/ivas_rom_com.h
index 749ae47b7560b97ba05b89710bf8b9bcf69c4d76..c6c8250b038277d7debc172aad4682a74de35eea 100644
--- a/lib_com/ivas_rom_com.h
+++ b/lib_com/ivas_rom_com.h
@@ -361,11 +361,7 @@ extern const int16_t ivas_lfe_min_shift_tbl[IVAS_LFE_NUM_COEFFS_IN_SUBGRP];
extern const ivas_lfe_freq_models ivas_str_lfe_freq_models;
extern const float ivas_lfe_lpf_delay[2];
-#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT
extern const float hamm_lfe_plc[LFE_PLC_LENANA / 2];
-#else
-extern const double d_hamm_lfe_plc[LFE_PLC_LENANA / 2];
-#endif
extern const float ivas_sin_twiddle_480[IVAS_480_PT_LEN >> 1];
extern const float ivas_cos_twiddle_480[IVAS_480_PT_LEN >> 1];
diff --git a/lib_com/lsf_tools.c b/lib_com/lsf_tools.c
index 89963d1df81c686bdcb882ad19abe4b923513243..ec69cc399c3adfa6591380a4893469a343a9cabf 100644
--- a/lib_com/lsf_tools.c
+++ b/lib_com/lsf_tools.c
@@ -959,22 +959,14 @@ void isp2isf(
*
* Convert from LPC to reflection coeff
*-------------------------------------------------------------------*/
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
-void a2rc(
-#else
/*! r: stability flag */
uint16_t a2rc(
-#endif
const float *a, /* i : LPC coefficients */
float *refl, /* o : Reflection co-efficients */
const int16_t lpcorder /* i : LPC order */
)
{
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- float f[M];
-#else
float f[MAX_LP_FILTER_ORDER];
-#endif
int16_t m, j, n;
float km, denom, x;
@@ -993,11 +985,7 @@ uint16_t a2rc(
{
refl[j] = 0.f;
}
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- return;
-#else
return 0;
-#endif
}
refl[m] = -km;
@@ -1017,11 +1005,7 @@ uint16_t a2rc(
}
}
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- return;
-#else
return 1;
-#endif
}
diff --git a/lib_com/options.h b/lib_com/options.h
index ebce0e4062396c20e29e7915752d1c0a4feb61d5..ff1bc4ed7ac2e0512e86d17fefc9f74901b44859 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -154,7 +154,7 @@
/* ################## Start DEVELOPMENT switches ######################### */
-/*#define OBJ_EDITING_INTERFACE*/ /* Interface for object editing */
+#define OBJ_EDITING_INTERFACE /* Interface for object editing */
#ifdef OBJ_EDITING_INTERFACE
#define OBJ_EDITING_API /* object editing changes related to the API */
#define OBJ_EDITING_EXAMPLE /* obj editing example code in decoder.c */
@@ -167,22 +167,9 @@
/*#define FIX_I4_OL_PITCH*/ /* fix open-loop pitch used for EVS core switching */
-#define FIX_CREND_SIMPLIFY_CODE /* Ora : simplify line code in crend */
#define TMP_FIX_1119_SPLIT_RENDERING_VOIP /* FhG: Add error check for unsupported config: split rendering with VoIP mode */
-#define FIX_POINT_HRTF_FILE_FORMAT /* All: fix point hrtf binary file format */
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
-#define FIX_POINT_ROM_CONST /* Ora: issue #1150 HRTF ROM tables should be defined as 'const'*/
-#define FIX_1123_CREND_16BIT_FMT /* Ora: update CREND binary file format to 16 bit */
-#define FIX_1123_CREND_FLTFX_BE /* Ora: make CREND FLT ROM tables BE to FX file */
-#define FIX_1123_FASTCONV_16BIT_FMT /* FhG: issue 1123: update FastConv binary file format and scripts to 16 bit */
-#define FIX_RETURN /* VA: fix location of function returns */
-#endif
-#define FIX_1135_EXT_RENDERER_HANDLES /* VA: issue 1135: Memory usage reduction in external renderer: Allocate only handles that are really needed. */
#define FIX_1158_FASTCONV_REVERB_HRTF /* Philips: issue 1158: Rendering with FastConv to BINAURAL_ROOM_REVERB uses BRIR convolution instead of HRTF */
-#define FIX_1166_TDREND_DIV0 /* FhG,Eri: issue 1166: potential divide by zero in TD Renderer */
-#define FIX_835_PARAMMC_BUFFER_VALUES /* FhG: BASOP issue 835: wide range of buffer values for cx in ParamMC */
-#define FIX_1161_REDUCE_OMASA_HEAP /* VA: reduction of OMASA heap memory */
/* #################### End BE switches ################################## */
@@ -190,11 +177,8 @@
/* any switch which is non-be wrt selection floating point code */
/* all switches in this category should start with "NONBE_" */
-#define NONBE_FIX_1141_OSBA_ROOM_RENDERING /* FhG: Fix for issue 1141: render objects in OSBA decoder with room effect */
-#define NONE_BE_FIX_816_LFE_PLC_FLOAT /* DLB: issue 816: reduce required precision to float for LFE-PLC*/
-#define NONBE_FIX_1220_OMASA_JBM_EXT_USAN /* Nokia: fix issue 1220 OMASA EXT JBM USAN, also fix similar cases of free to avoid future problems */
#define NONBE_FIX_1174_MCMASA_LBR_LOOP_ERROR /* Nokia: Fix issue 1174 by removing the unnecessary inner loop causing problems. */
/* ##################### End NON-BE switches ########################### */
diff --git a/lib_com/prot.h b/lib_com/prot.h
index 4f4222b2f90fdff3e2ec854ea838154f5be56b92..c8f70bb4fc22ff2de71e2429edccfeb865f51127 100644
--- a/lib_com/prot.h
+++ b/lib_com/prot.h
@@ -2998,12 +2998,8 @@ void a2isf(
const float *old_isf,
const int16_t lpcOrder );
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
-void a2rc(
-#else
/*! r: stability flag */
uint16_t a2rc(
-#endif
const float *a, /* i : LPC coefficients */
float *refl, /* o : Reflection co-efficients */
const int16_t lpcorder /* i : LPC order */
diff --git a/lib_dec/ivas_binRenderer_internal.c b/lib_dec/ivas_binRenderer_internal.c
index 98cf52caf85c6c6b059e286136d4a8c7844c1948..6de77455cc37ccd976c8d1d18605ba590ddd2f55 100644
--- a/lib_dec/ivas_binRenderer_internal.c
+++ b/lib_dec/ivas_binRenderer_internal.c
@@ -167,11 +167,7 @@ static ivas_error ivas_binRenderer_convModuleOpen(
if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
{
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
hBinRenConvModule->numTaps = hHrtf->ntaps_brir;
-#else
- hBinRenConvModule->numTaps = BINAURAL_NTAPS_MAX;
-#endif
/* Use variable order filtering */
bandIdx = 0;
@@ -200,7 +196,6 @@ static ivas_error ivas_binRenderer_convModuleOpen(
{
if ( hBinRenderer->ivas_format == SBA_FORMAT )
{
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
if ( input_config == IVAS_AUDIO_CONFIG_HOA3 )
{
hBinRenConvModule->numTaps = hHrtf->ntaps_hrir_hoa3;
@@ -217,17 +212,10 @@ static ivas_error ivas_binRenderer_convModuleOpen(
{
return IVAS_ERR_INVALID_INPUT_FORMAT;
}
-#else
- hBinRenConvModule->numTaps = BINAURAL_NTAPS_SBA;
-#endif
}
else
{
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
hBinRenConvModule->numTaps = hHrtf->ntaps_hrir;
-#else
- hBinRenConvModule->numTaps = BINAURAL_NTAPS;
-#endif
}
/* Use fixed order filtering */
@@ -492,13 +480,11 @@ void ivas_init_binaural_hrtf(
HrtfFastConv->FASTCONV_FOA_latency_s = 0x00;
HrtfFastConv->allocate_init_flag = 0x00;
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
HrtfFastConv->ntaps_hrir = BINAURAL_NTAPS;
HrtfFastConv->ntaps_hrir_foa = BINAURAL_NTAPS_SBA;
HrtfFastConv->ntaps_hrir_hoa2 = BINAURAL_NTAPS_SBA;
HrtfFastConv->ntaps_hrir_hoa3 = BINAURAL_NTAPS_SBA;
HrtfFastConv->ntaps_brir = BINAURAL_NTAPS_MAX;
-#endif
for ( i = 0; i < CLDFB_NO_CHANNELS_MAX; i++ )
{
@@ -577,7 +563,6 @@ ivas_error ivas_allocate_binaural_hrtf(
}
else
{
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, HrtfFastConv->ntaps_hrir_hoa3, allocate_init_flag ) )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" );
@@ -594,24 +579,6 @@ ivas_error ivas_allocate_binaural_hrtf(
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" );
}
-#else
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA3" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA3" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA3" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_HOA3, BINAURAL_CONVBANDS, HOA3_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA3" );
- }
-#endif
}
}
@@ -623,7 +590,6 @@ ivas_error ivas_allocate_binaural_hrtf(
}
else
{
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, HrtfFastConv->ntaps_hrir_hoa2, allocate_init_flag ) )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" );
@@ -640,24 +606,6 @@ ivas_error ivas_allocate_binaural_hrtf(
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" );
}
-#else
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_HOA2" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_HOA2" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_HOA2" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_HOA2, BINAURAL_CONVBANDS, HOA2_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_HOA2" );
- }
-#endif
}
}
@@ -669,7 +617,6 @@ ivas_error ivas_allocate_binaural_hrtf(
}
else
{
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, HrtfFastConv->ntaps_hrir_foa, allocate_init_flag ) )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" );
@@ -686,36 +633,13 @@ ivas_error ivas_allocate_binaural_hrtf(
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" );
}
-#else
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal_FOA" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag_FOA" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal_FOA" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag_FOA, BINAURAL_CONVBANDS, FOA_CHANNELS, BINAURAL_NTAPS_SBA, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag_FOA" );
- }
-#endif
}
}
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
else if ( ( renderer_type == RENDERER_BINAURAL_FASTCONV && bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) || ( renderer_type == RENDERER_BINAURAL_FASTCONV && input_config != IVAS_AUDIO_CONFIG_INVALID ) )
-#else
- if ( renderer_type == RENDERER_BINAURAL_FASTCONV || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
-#endif
{
if ( ( HrtfFastConv->leftHRIRReal == NULL ) && ( HrtfFastConv->leftHRIRImag == NULL ) && ( HrtfFastConv->rightHRIRReal == NULL ) && ( HrtfFastConv->rightHRIRImag == NULL ) )
{
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, HrtfFastConv->ntaps_hrir, allocate_init_flag ) )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" );
@@ -732,36 +656,13 @@ ivas_error ivas_allocate_binaural_hrtf(
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" );
}
-#else
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRReal" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftHRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftHRIRImag" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRReal" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightHRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightHRIRImag" );
- }
-#endif
}
}
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
else if ( ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED ) || ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && input_config != IVAS_AUDIO_CONFIG_INVALID ) )
-#else
- if ( renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM || bin_input_config == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
-#endif
{
if ( ( HrtfFastConv->leftBRIRReal == NULL ) && ( HrtfFastConv->leftBRIRImag == NULL ) && ( HrtfFastConv->rightBRIRReal == NULL ) && ( HrtfFastConv->rightBRIRImag == NULL ) )
{
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, HrtfFastConv->ntaps_brir, allocate_init_flag ) )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" );
@@ -778,24 +679,6 @@ ivas_error ivas_allocate_binaural_hrtf(
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" );
}
-#else
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRReal" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->leftBRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for leftBRIRImag" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightBRIRReal, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRReal" );
- }
- if ( IVAS_ERR_OK != ivas_alloc_pppMem( &HrtfFastConv->rightBRIRImag, BINAURAL_CONVBANDS, HRTF_LS_CHANNELS, BINAURAL_NTAPS_MAX, allocate_init_flag ) )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for rightBRIRImag" );
- }
-#endif
}
}
@@ -924,13 +807,8 @@ static ivas_error ivas_binaural_hrtf_open(
*hHrtfFastConv = HrtfFastConv;
-#ifdef FIX_RETURN
return IVAS_ERR_OK;
-#endif
}
-#ifndef FIX_RETURN
- return IVAS_ERR_OK;
-#endif
}
diff --git a/lib_dec/ivas_dirac_dec.c b/lib_dec/ivas_dirac_dec.c
index f79bd86ad4acde0e38a879acd91b01999d1aba1e..f28378698fd27c263953bda3d7fe04f7f6bb9326 100644
--- a/lib_dec/ivas_dirac_dec.c
+++ b/lib_dec/ivas_dirac_dec.c
@@ -2231,121 +2231,78 @@ void ivas_dirac_dec_render_sf(
/* render objects in combined format onto the CICP19 channels for BINAURAL_ROOM_IR */
if ( st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC && st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM )
{
-#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- int16_t in_ch;
- for ( in_ch = 0; in_ch < st_ivas->nchan_ism; in_ch++ )
+ int16_t j, k, l;
+ int16_t num_objects, nchan_out_woLFE;
+ int16_t az1, el1;
+ int16_t n_slots_to_render;
+ int16_t n_samples_to_render;
+ float gain, prev_gain;
+
+ num_objects = st_ivas->nchan_ism;
+ nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
+ n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered];
+ n_samples_to_render = hSpatParamRendCom->num_freq_bands * n_slots_to_render;
+
+ if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] )
{
-#endif
- int16_t j, k, l;
-#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- int16_t j2, lfe_index;
-#endif
- int16_t num_objects, nchan_out_woLFE;
- int16_t az1, el1;
- int16_t n_slots_to_render;
- int16_t n_samples_to_render;
-#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- int16_t interp_offset;
-#endif
- float gain, prev_gain;
-
- num_objects = st_ivas->nchan_ism;
- nchan_out_woLFE = st_ivas->hIntSetup.nchan_out_woLFE;
- n_slots_to_render = st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered];
- n_samples_to_render = hSpatParamRendCom->num_freq_bands * n_slots_to_render;
-#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- interp_offset = st_ivas->hTcBuffer->n_samples_rendered;
-#endif
-
- if ( st_ivas->hCombinedOrientationData && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] )
- {
- ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator );
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- st_ivas->hIsmRendererData->interp_offset = 0;
-#else
- interp_offset = 0;
-#endif
- }
+ ivas_jbm_dec_get_adapted_linear_interpolator( n_samples_to_render, n_samples_to_render, st_ivas->hIsmRendererData->interpolator );
+ st_ivas->hIsmRendererData->interp_offset = 0;
+ }
- for ( i = 0; i < num_objects; i++ )
+ for ( i = 0; i < num_objects; i++ )
+ {
+ /* Combined rotation: rotate the object positions depending the head and external orientations */
+ if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
{
- /* Combined rotation: rotate the object positions depending the head and external orientations */
- if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
+ rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &az1, &el1, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup );
+ if ( st_ivas->hEFAPdata != NULL )
{
- rotateAziEle( st_ivas->hIsmMetaData[i]->azimuth, st_ivas->hIsmMetaData[i]->elevation, &az1, &el1, st_ivas->hCombinedOrientationData->Rmat[0], st_ivas->hIntSetup.is_planar_setup );
- if ( st_ivas->hEFAPdata != NULL )
- {
- efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], az1, el1, EFAP_MODE_EFAP );
+ efap_determine_gains( st_ivas->hEFAPdata, st_ivas->hIsmRendererData->gains[i], az1, el1, EFAP_MODE_EFAP );
#ifdef OBJ_EDITING_API
- v_multc( st_ivas->hIsmRendererData->gains[i], st_ivas->hIsmMetaData[i]->edited_gain, st_ivas->hIsmRendererData->gains[i], nchan_out_woLFE );
+ v_multc( st_ivas->hIsmRendererData->gains[i], st_ivas->hIsmMetaData[i]->edited_gain, st_ivas->hIsmRendererData->gains[i], nchan_out_woLFE );
#endif
- }
}
+ }
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- for ( j = 0; j < nchan_out_woLFE; j++ )
-#else
- lfe_index = 0;
- for ( j = 0, j2 = 0; j < nchan_out_woLFE; j++, j2++ )
-#endif
- {
-#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- if ( ( st_ivas->hIntSetup.num_lfe > 0 ) && ( st_ivas->hIntSetup.index_lfe[lfe_index] == j ) )
- {
- ( lfe_index < ( st_ivas->hIntSetup.num_lfe - 1 ) ) ? ( lfe_index++, j2++ ) : j2++;
- }
-#endif
+ for ( j = 0; j < nchan_out_woLFE; j++ )
+ {
- gain = st_ivas->hIsmRendererData->gains[i][j];
- prev_gain = st_ivas->hIsmRendererData->prev_gains[i][j];
- if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f )
- {
- float *tc_re, *tc_im;
- float *w1, w2;
+ gain = st_ivas->hIsmRendererData->gains[i][j];
+ prev_gain = st_ivas->hIsmRendererData->prev_gains[i][j];
+ if ( fabsf( gain ) > 0.0f || fabsf( prev_gain ) > 0.0f )
+ {
+ float *tc_re, *tc_im;
+ float *w1, w2;
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- w1 = &st_ivas->hIsmRendererData->interpolator[st_ivas->hIsmRendererData->interp_offset];
-#else
- w1 = &st_ivas->hIsmRendererData->interpolator[interp_offset];
-#endif
+ w1 = &st_ivas->hIsmRendererData->interpolator[st_ivas->hIsmRendererData->interp_offset];
- tc_re = pppQMfFrame_ts_re[nchan_transport + i][0];
- tc_im = pppQMfFrame_ts_im[nchan_transport + i][0];
+ tc_re = pppQMfFrame_ts_re[nchan_transport + i][0];
+ tc_im = pppQMfFrame_ts_im[nchan_transport + i][0];
- for ( k = 0; k < n_slots_to_render; k++ )
- {
- float g;
+ for ( k = 0; k < n_slots_to_render; k++ )
+ {
+ float g;
- w2 = 1.0f - *w1;
- g = ( *w1 * gain + w2 * prev_gain );
+ w2 = 1.0f - *w1;
+ g = ( *w1 * gain + w2 * prev_gain );
- for ( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ )
- {
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- Cldfb_RealBuffer[j][k][l] += g * *( tc_re++ );
- Cldfb_ImagBuffer[j][k][l] += g * *( tc_im++ );
-#else
- Cldfb_RealBuffer[j2][k][l] += g * *( tc_re++ );
- Cldfb_ImagBuffer[j2][k][l] += g * *( tc_im++ );
-#endif
- }
- w1 += hSpatParamRendCom->num_freq_bands;
+ for ( l = 0; l < hSpatParamRendCom->num_freq_bands; l++ )
+ {
+ Cldfb_RealBuffer[j][k][l] += g * *( tc_re++ );
+ Cldfb_ImagBuffer[j][k][l] += g * *( tc_im++ );
}
+ w1 += hSpatParamRendCom->num_freq_bands;
}
+ }
- /* update here only in case of head rotation */
- if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
- {
- st_ivas->hIsmRendererData->prev_gains[i][j] = gain;
- }
+ /* update here only in case of head rotation */
+ if ( st_ivas->hCombinedOrientationData != NULL && st_ivas->hCombinedOrientationData->enableCombinedOrientation[0] == 1 )
+ {
+ st_ivas->hIsmRendererData->prev_gains[i][j] = gain;
}
}
-#ifndef NONBE_FIX_1141_OSBA_ROOM_RENDERING
}
-#endif
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
st_ivas->hIsmRendererData->interp_offset += hSpatParamRendCom->num_freq_bands * st_ivas->hSpar->subframe_nbslots[st_ivas->hSpar->subframes_rendered];
-#endif
}
if ( st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || st_ivas->hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
diff --git a/lib_dec/ivas_dirac_output_synthesis_cov.c b/lib_dec/ivas_dirac_output_synthesis_cov.c
index 2c95cf32aea13a8d134fb9854a8efff7ebfc3d05..6fec493548f701cd20d6c3762683e6447c744ee1 100644
--- a/lib_dec/ivas_dirac_output_synthesis_cov.c
+++ b/lib_dec/ivas_dirac_output_synthesis_cov.c
@@ -312,7 +312,6 @@ void ivas_dirac_dec_output_synthesis_cov_close(
*-------------------------------------------------------------------*/
void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot(
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
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_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* o : accumulated input covariance (real part) */
@@ -320,65 +319,40 @@ void ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot(
const int16_t param_band, /* i : parameter band */
PARAM_MC_DEC_HANDLE hParamMC, /* i : handle to Parametric MC state */
const int16_t nchan_in /* i : number of input channels */
-#else
- 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 */
-#endif
)
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
int16_t band_idx, ch_idx;
-#else
- int16_t param_band, band_idx, ch_idx;
-#endif
int16_t brange[2];
float real_in_buffer[PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * MAX_TRANSPORT_CHANNELS];
float imag_in_buffer[PARAM_MC_MAX_BANDS_IN_PARAMETER_BAND * MAX_TRANSPORT_CHANNELS];
float real_buffer[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
float imag_buffer[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
-/* estimate input covariance */
-#ifndef FIX_835_PARAMMC_BUFFER_VALUES
- for ( param_band = 0; param_band < hParamMC->num_param_bands_synth; param_band++ )
- {
-#endif
- /* Already stack here instead of in the process_subframe */
+ /* estimate input covariance */
+ /* Already stack here instead of in the process_subframe */
- /* collect input frame */
- int16_t num_bands;
- brange[0] = hParamMC->band_grouping[param_band];
- brange[1] = hParamMC->band_grouping[param_band + 1];
- num_bands = brange[1] - brange[0];
+ /* collect input frame */
+ int16_t num_bands;
+ brange[0] = hParamMC->band_grouping[param_band];
+ brange[1] = hParamMC->band_grouping[param_band + 1];
+ num_bands = brange[1] - brange[0];
- for ( band_idx = 0; band_idx < num_bands; band_idx++ )
+ for ( band_idx = 0; band_idx < num_bands; band_idx++ )
+ {
+ int16_t band = brange[0] + band_idx;
+ for ( ch_idx = 0; ch_idx < nchan_in; ch_idx++ )
{
- int16_t band = brange[0] + band_idx;
- for ( ch_idx = 0; ch_idx < nchan_in; ch_idx++ )
- {
- 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];
- }
+ 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];
}
+ }
- cmplx_matrix_square( real_in_buffer, imag_in_buffer, num_bands, nchan_in, real_buffer, imag_buffer );
-
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
- v_add( cx, real_buffer, cx, nchan_in * nchan_in );
+ cmplx_matrix_square( real_in_buffer, imag_in_buffer, num_bands, nchan_in, real_buffer, imag_buffer );
- v_add( cx_imag, imag_buffer, cx_imag, nchan_in * nchan_in );
-#else
- v_add( cx[param_band], real_buffer, cx[param_band], nchan_in * nchan_in );
+ v_add( cx, real_buffer, cx, nchan_in * nchan_in );
- v_add( cx_imag[param_band], imag_buffer, cx_imag[param_band], nchan_in * nchan_in );
-#endif
+ v_add( cx_imag, imag_buffer, cx_imag, nchan_in * nchan_in );
-#ifndef FIX_835_PARAMMC_BUFFER_VALUES
- }
-#endif
return;
}
diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c
index edd3ed644e8f3425cacc207c792fe5ff5bedb4b1..63f3cc026d327b309d856672f04889041192d474 100644
--- a/lib_dec/ivas_init_dec.c
+++ b/lib_dec/ivas_init_dec.c
@@ -1898,31 +1898,21 @@ ivas_error ivas_init_decoder(
}
}
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
/* Allocate memory for delay buffer within 'hMasaIsmData' */
if ( ( error = ivas_omasa_objects_delay_open( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
}
-#else
- /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
- if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
- {
- return error;
- }
-#endif
}
if ( ( st_ivas->renderer_type == RENDERER_DIRAC ) &&
( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC ) )
{
/* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( ( error = ivas_omasa_objects_delay_open( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
}
-#endif
if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
@@ -1932,11 +1922,7 @@ ivas_error ivas_init_decoder(
if ( st_ivas->renderer_type == RENDERER_OMASA_OBJECT_EXT )
{
/* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( ( error = ivas_omasa_objects_delay_open( st_ivas ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = ivas_omasa_render_objects_from_mix_open( st_ivas ) ) != 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 b4a37dddf609f22008d0f6c241407b05f37f3263..ace799d92e720c2a8967c8293a24420ddea6b1d4 100644
--- a/lib_dec/ivas_ism_param_dec.c
+++ b/lib_dec/ivas_ism_param_dec.c
@@ -711,11 +711,7 @@ void ivas_ism_dec_digest_tc(
if ( st_ivas->renderer_type == RENDERER_SBA_LINEAR_ENC ||
st_ivas->renderer_type == RENDERER_OSBA_AMBI ||
- st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- || ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
-#endif
- )
+ st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV || ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) )
{
st_ivas->hIsmRendererData->interpolator[0] = 0.0f;
for ( i = 1; i < interpolator_length; i++ )
@@ -735,9 +731,7 @@ void ivas_ism_dec_digest_tc(
{
ivas_jbm_dec_get_adapted_linear_interpolator( (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC ), st_ivas->hTcBuffer->n_samples_available, st_ivas->hIsmRendererData->interpolator );
}
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
st_ivas->hIsmRendererData->interp_offset = 0;
-#endif
/* also get the gains here */
for ( i = 0; i < st_ivas->nchan_ism; i++ )
@@ -766,11 +760,7 @@ void ivas_ism_dec_digest_tc(
if ( ( st_ivas->renderer_type == RENDERER_TD_PANNING ||
st_ivas->renderer_type == RENDERER_OSBA_LS ||
- st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
- || ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC )
-#endif
- ) &&
+ st_ivas->renderer_type == RENDERER_BINAURAL_MIXER_CONV_ROOM || ( st_ivas->renderer_type == RENDERER_BINAURAL_FASTCONV_ROOM && st_ivas->ivas_format == SBA_ISM_FORMAT && st_ivas->ism_mode == ISM_SBA_MODE_DISC ) ) &&
st_ivas->hCombinedOrientationData == NULL )
{
if ( st_ivas->hIntSetup.is_planar_setup )
diff --git a/lib_dec/ivas_ism_renderer.c b/lib_dec/ivas_ism_renderer.c
index daefbfbdccb484dec6dcabcccc5406385853a294..9b882089b15dfef4ccfe335236defb1b4ce842ce 100644
--- a/lib_dec/ivas_ism_renderer.c
+++ b/lib_dec/ivas_ism_renderer.c
@@ -379,14 +379,10 @@ ivas_error ivas_omasa_separate_object_renderer_open(
init_interpolator_length = (int16_t) ( st_ivas->hDecoderConfig->output_Fs / FRAMES_PER_SEC / MAX_PARAM_SPATIAL_SUBFRAMES );
interpolator_length = init_interpolator_length;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( ( st_ivas->hIsmRendererData->interpolator = (float *) malloc( sizeof( float ) * init_interpolator_length ) ) == NULL )
{
return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM renderer interpolator \n" ) );
}
-#else
- st_ivas->hIsmRendererData->interpolator = (float *) malloc( sizeof( float ) * init_interpolator_length );
-#endif
for ( i = 0; i < interpolator_length; i++ )
{
@@ -394,33 +390,6 @@ ivas_error ivas_omasa_separate_object_renderer_open(
}
st_ivas->hIsmRendererData->interpolator_length = interpolator_length;
-#ifndef FIX_1161_REDUCE_OMASA_HEAP
- st_ivas->hMasaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES );
-
- if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
- {
- st_ivas->hMasaIsmData->delayBuffer_nchan = 1;
- }
- else
- {
- st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism;
- }
-
- if ( ( st_ivas->hMasaIsmData->delayBuffer = (float **) malloc( st_ivas->hMasaIsmData->delayBuffer_nchan * sizeof( float * ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) );
- }
-
- for ( i = 0; i < st_ivas->hMasaIsmData->delayBuffer_nchan; i++ )
- {
- if ( ( st_ivas->hMasaIsmData->delayBuffer[i] = (float *) malloc( st_ivas->hMasaIsmData->delayBuffer_size * sizeof( float ) ) ) == NULL )
- {
- return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Cannot allocate memory for MASA ISM delay buffer \n" ) );
- }
- set_zero( st_ivas->hMasaIsmData->delayBuffer[i], st_ivas->hMasaIsmData->delayBuffer_size );
- }
-
-#endif
return IVAS_ERR_OK;
}
diff --git a/lib_dec/ivas_jbm_dec.c b/lib_dec/ivas_jbm_dec.c
index 6eea0419a29f31a65394034831ec423ed42af106..29b2cd140379307b64145cbcc49e58f3a2c17567 100644
--- a/lib_dec/ivas_jbm_dec.c
+++ b/lib_dec/ivas_jbm_dec.c
@@ -792,7 +792,7 @@ void ivas_jbm_dec_feed_tc_to_renderer(
float *p_data_f[MAX_CLDFB_DIGEST_CHANNELS];
int16_t n, n_render_timeslots;
- push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" );
+ push_wmops( "ivas_jbm_dec_feed_tc_to_renderer" );
for ( n = 0; n < MAX_CLDFB_DIGEST_CHANNELS; n++ )
{
p_data_f[n] = &data_f[n][0];
@@ -3012,7 +3012,7 @@ void ivas_jbm_dec_prepare_renderer(
{
int16_t n, n_render_timeslots;
- push_wmops( "ivas_jbm_dec_feed_tc_to_rendererer" );
+ push_wmops( "ivas_jbm_dec_prepare_renderer" );
n_render_timeslots = st_ivas->hTcBuffer->n_samples_available / st_ivas->hTcBuffer->n_samples_granularity;
diff --git a/lib_dec/ivas_lfe_plc.c b/lib_dec/ivas_lfe_plc.c
index 99509970cb4f005f550a02fbf6eebb859c1f0e2c..91b90891d77773b9cae87de698d5a0c498b4ebb4 100644
--- a/lib_dec/ivas_lfe_plc.c
+++ b/lib_dec/ivas_lfe_plc.c
@@ -45,202 +45,15 @@
* Local constants
*------------------------------------------------------------------------------------------*/
-#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS )
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
-#define LFE_PLC_LPCORD ( 20 )
-#else
-#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER )
-#endif
+#define LFE_PLC_DSF ( 48000 / LFE_PLC_FS )
+#define LFE_PLC_LPCORD ( MAX_LP_FILTER_ORDER )
#define POW_THR ( 1.0e-8f )
#define LFE_PLC_RECLEN_48K ( ( IVAS_LFE_NUM_COEFFS_IN_SUBGRP + 1 ) * L_FRAME48k / IVAS_LFE_NUM_COEFFS_IN_SUBGRP + LFE_PLC_FDEL )
#define LFE_PLC_RECLEN ( ( LFE_PLC_RECLEN_48K / LFE_PLC_DSF ) )
#define LFE_PLC_MUTE_THR ( 10 )
-#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT
-#define LFE_PLC_BURST_ATT ( powf( powf( 10.0f, -3.0f / 20.0f ), 1.0f / ( LFE_PLC_FS * 20 / 1000 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */
-#define EPS_STOP 1e-5f
-#else
-#define LFE_PLC_BURST_ATT ( pow( pow( 10.0, -3.0 / 20.0 ), 1.0 / ( LFE_PLC_FS * 0.02 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */
-#define MAX_LEN_LP 960
-#define EPS_STOP 1e-5
-#endif
-
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
-/*------------------------------------------------------------------------------------------*
- * Static function declarations
- *
- * Note (DLB): the local double precision functions defined below are replica of corresponding
- * float functions defined in tools.c, lpc_tools.c and syn_filt.c.
- * Double precision arithmetic is required for proper functioning of the lfe_plc.
- *------------------------------------------------------------------------------------------*/
-
-static void mvr2d(
- const float x[], /* i : input vector */
- double y[], /* o : output vector */
- const int16_t n /* i : vector size */
-)
-{
- int16_t i;
-
- if ( n <= 0 )
- {
- /* cannot transfer vectors with size 0 */
- return;
- }
-
- for ( i = n - 1; i >= 0; i-- )
- {
- y[i] = x[i];
- }
-
- return;
-}
-
+#define LFE_PLC_BURST_ATT ( powf( powf( 10.0f, -3.0f / 20.0f ), 1.0f / ( LFE_PLC_FS * 20 / 1000 ) ) ) /* attenuate 3dB per frame starting with 10th consecutive loss */
+#define EPS_STOP 1e-5f
-/*---------------------------------------------------------------------*
- * autocorr()
- *
- * Compute autocorrelations of input signal
- *---------------------------------------------------------------------*/
-
-static void d_autocorr(
- const double *x, /* i : input signal */
- double *r, /* o : autocorrelations vector */
- const int16_t m, /* i : order of LP filter */
- const int16_t len, /* i : window size */
- const double *wind, /* i : window */
- const int16_t rev_flag, /* i : flag to reverse window */
- const int16_t sym_flag, /* i : symmetric window flag */
- const int16_t no_thr /* i : flag to avoid thresholding */
-)
-{
- double t[MAX_LEN_LP];
- double s;
- int16_t i, j;
-
- /* Windowing of signal */
- if ( rev_flag == 1 )
- {
- /* time reversed window */
- for ( i = 0; i < len; i++ )
- {
- t[i] = x[i] * wind[len - i - 1];
- }
- }
- else if ( sym_flag == 1 )
- {
- /* symmetric window of even length */
- for ( i = 0; i < len / 2; i++ )
- {
- t[i] = x[i] * wind[i];
- }
-
- for ( ; i < len; i++ )
- {
- t[i] = x[i] * wind[len - 1 - i];
- }
- }
- else /* assymetric window */
- {
- for ( i = 0; i < len; i++ )
- {
- t[i] = x[i] * wind[i];
- }
- }
-
- /* Compute r[1] to r[m] */
- for ( i = 0; i <= m; i++ )
- {
- s = t[0] * t[i];
- for ( j = 1; j < len - i; j++ )
- {
- s += t[j] * t[i + j];
- }
- r[i] = s;
- }
-
- if ( r[0] < 100.0f && no_thr == 0 )
- {
- r[0] = 100.0f;
- }
-
- return;
-}
-
-
-/*---------------------------------------------------------------------*
- * lev_dur()
- *
- * Wiener-Levinson-Durbin algorithm to compute LP parameters from the autocorrelations
- * of input signal
- *---------------------------------------------------------------------*/
-
-/*! r: energy of prediction error */
-static int16_t d_lev_dur(
- double *a, /* o : LP coefficients (a[0] = 1.0) */
- const double *r, /* i : vector of autocorrelations */
- const int16_t m, /* i : order of LP filter */
- double epsP[] /* o : prediction error energy */
-)
-{
- int16_t i, j, l;
- double buf[TCXLTP_LTP_ORDER];
- double *rc; /* reflection coefficients 0,...,m-1 */
- double s, at, err;
- int16_t flag = 0;
-
- rc = &buf[0];
- rc[0] = ( -r[1] ) / r[0];
- a[0] = 1.0;
- a[1] = rc[0];
- err = r[0] + r[1] * rc[0];
-
- if ( epsP != NULL )
- {
- epsP[0] = r[0];
- epsP[1] = err;
- }
-
- for ( i = 2; i <= m; i++ )
- {
- s = 0.0;
- for ( j = 0; j < i; j++ )
- {
- s += r[i - j] * a[j];
- }
-
- rc[i - 1] = ( -s ) / err;
-
- if ( fabs( rc[i - 1] ) > 0.99945f )
- {
- flag = 1; /* Test for unstable filter. If unstable keep old A(z) */
- }
-
- for ( j = 1; j <= i / 2; j++ )
- {
- l = i - j;
- at = a[j] + rc[i - 1] * a[l];
- a[l] += rc[i - 1] * a[j];
- a[j] = at;
- }
-
- a[i] = rc[i - 1];
-
- err += rc[i - 1] * s;
-
- if ( err <= 0.0f )
- {
- err = 0.01f;
- }
-
- if ( epsP != NULL )
- {
- epsP[i] = err;
- }
- }
-
- return ( flag );
-}
-#else
/*---------------------------------------------------------------------*
* lfeplc_lev_dur()
*
@@ -308,104 +121,6 @@ static int16_t lfeplc_lev_dur(
return 0;
}
-#endif
-
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
-/*-------------------------------------------------------------------*
- * a2rc()
- *
- * Convert from LPC to reflection coeff
- *-------------------------------------------------------------------*/
-static uint16_t d_a2rc(
- const double *a, /* i : LPC coefficients */
- double *refl, /* o : Reflection co-efficients */
- const int16_t lpcorder /* i : LPC order */
-)
-{
- double ff[LFE_PLC_LPCORD];
- double km, denom, x;
- int16_t m, j, n;
-
- for ( m = 0; m < lpcorder; m++ )
- {
- ff[m] = -a[m];
- }
-
- /* Initialization */
- for ( m = lpcorder - 1; m >= 0; m-- )
- {
- km = ff[m];
- if ( km <= -1.0 || km >= 1.0 )
- {
- for ( j = 0; j < lpcorder; j++ )
- {
- refl[j] = 0.0;
- }
-
- return 0;
- }
-
- refl[m] = -km;
- denom = 1.0 / ( 1.0 - km * km );
- for ( j = 0; j < m / 2; j++ )
- {
- n = m - 1 - j;
- x = denom * ff[j] + km * denom * ff[n];
- ff[n] = denom * ff[n] + km * denom * ff[j];
- ff[j] = x;
- }
-
- if ( m & 1 )
- {
- ff[j] = denom * ff[j] + km * denom * ff[j];
- }
- }
-
- return 1;
-}
-
-static void d_syn_filt(
- const double a[], /* i : LP filter coefficients */
- const int16_t m, /* i : order of LP filter */
- const float x[], /* i : input signal */
- float y[], /* o : output signal */
- const int16_t l, /* i : size of filtering */
- const float mem[] /* i : initial filter states */
-)
-{
- int16_t i, j;
- double buf[LFE_PLC_LPCORD + LFE_PLC_RECLEN]; /* temporary synthesis buffer */
- double s, *yy;
-
- yy = &buf[0];
-
- /*------------------------------------------------------------------*
- * copy initial filter states into synthesis buffer and do synthesis
- *------------------------------------------------------------------*/
- for ( i = 0; i < m; i++ )
- {
- *yy++ = mem[i];
- }
-
- /*-----------------------------------------------------------------------*
- * Do the filtering
- *-----------------------------------------------------------------------*/
-
- for ( i = 0; i < l; i++ )
- {
- s = x[i];
- for ( j = 1; j <= m; j++ )
- {
- s -= a[j] * yy[i - j];
- }
-
- yy[i] = s;
- y[i] = (float) s;
- }
-
- return;
-}
-#endif
/*-----------------------------------------------------------------------------------------*
* Function check_stab()
@@ -413,15 +128,6 @@ static void d_syn_filt(
* LPC filter stability check applying given sharpening value delta
*-----------------------------------------------------------------------------------------*/
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
-static uint16_t check_stab(
- const double *a,
- double delta )
-{
- double amod[LFE_PLC_LPCORD], refl[LFE_PLC_LPCORD];
- double fac;
- double fac1;
-#else
static uint16_t check_stab(
const float *a,
const float delta )
@@ -429,15 +135,10 @@ static uint16_t check_stab(
float amod[LFE_PLC_LPCORD], refl[LFE_PLC_LPCORD];
float fac;
float fac1;
-#endif
int16_t i;
uint16_t stable;
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- fac = 1.0 + delta;
-#else
fac = 1.0f + delta;
-#endif
fac1 = fac;
for ( i = 0; i < LFE_PLC_LPCORD; i++ )
@@ -446,11 +147,7 @@ static uint16_t check_stab(
fac *= fac1;
}
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- stable = d_a2rc( amod, refl, LFE_PLC_LPCORD );
-#else
stable = a2rc( amod, refl, LFE_PLC_LPCORD );
-#endif
return stable;
}
@@ -462,30 +159,16 @@ static uint16_t check_stab(
* Find maximum LPC filter sharpening by iteration to get a filter that is almost instable
*-----------------------------------------------------------------------------------------*/
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
-static double find_max_delta(
- double *a )
-{
- double delta;
- double eps;
- double fac;
-#else
static float find_max_delta(
float *a )
{
float delta;
float eps;
float fac;
-#endif
uint16_t stable;
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- delta = 0.0;
- eps = 0.01;
-#else
delta = 0.0f;
eps = 0.01f;
-#endif
fac = 2;
stable = FALSE;
@@ -495,11 +178,7 @@ static float find_max_delta(
eps *= fac;
stable = TRUE;
}
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- fac = 0.5;
-#else
fac = 0.5f;
-#endif
if ( stable )
{
@@ -521,27 +200,6 @@ static float find_max_delta(
delta += eps;
stable = check_stab( a, delta );
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- if ( !stable )
- {
- if ( fabs( eps ) > EPS_STOP )
- {
- eps = -fabs( eps ) * fac;
- }
- else
- {
- eps = -fabs( eps );
- }
- }
- else
- {
- if ( fabs( eps ) < EPS_STOP )
- {
- break;
- }
- eps = fabs( eps ) * fac;
- }
-#else
if ( !stable )
{
if ( fabsf( eps ) > EPS_STOP )
@@ -561,7 +219,6 @@ static float find_max_delta(
}
eps = fabsf( eps ) * fac;
}
-#endif
}
return delta;
@@ -576,54 +233,28 @@ static float find_max_delta(
static void recover_samples(
const int16_t bfi_count,
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- const float *outbuf,
-#else
float *outbuf,
-#endif
float *rec_frame )
{
int16_t i;
float zeroes[LFE_PLC_RECLEN];
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- double delta, fac, att;
- double d_outbuf[LFE_PLC_BUFLEN], d_r[LFE_PLC_LPCORD + 1], d_a[LFE_PLC_LPCORD + 1], d_pee[LFE_PLC_LPCORD + 1];
-
-
- mvr2d( outbuf, d_outbuf, LFE_PLC_BUFLEN );
- d_autocorr( d_outbuf, d_r, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, d_hamm_lfe_plc, 0, 1, 1 );
-#else
float delta, fac, att;
float r[LFE_PLC_LPCORD + 1], a[LFE_PLC_LPCORD + 1];
autocorr( outbuf, r, LFE_PLC_LPCORD, LFE_PLC_BUFLEN, hamm_lfe_plc, 0, 1, 1 );
-#endif
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- if ( d_r[0] < POW_THR * LFE_PLC_BUFLEN )
-#else
if ( r[0] < POW_THR * LFE_PLC_BUFLEN )
-#endif
{
set_zero( rec_frame, LFE_PLC_RECLEN );
return;
}
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- d_lev_dur( d_a, d_r, LFE_PLC_LPCORD, d_pee );
-
- delta = find_max_delta( d_a + 1 );
-
- fac = 1.0 + delta;
- att = 1.0;
-#else
lfeplc_lev_dur( a, r, LFE_PLC_LPCORD );
delta = find_max_delta( a + 1 );
fac = 1.0f + delta;
att = 1.0f;
-#endif
if ( bfi_count >= LFE_PLC_MUTE_THR )
{
@@ -633,22 +264,13 @@ static void recover_samples(
for ( i = 1; i <= LFE_PLC_LPCORD; i++ )
{
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- d_a[i] = d_a[i] * fac;
- fac *= att * ( 1.0 + delta );
-#else
a[i] = a[i] * fac;
fac *= att * ( 1.0f + delta );
-#endif
}
set_zero( zeroes, LFE_PLC_RECLEN );
-#ifndef NONE_BE_FIX_816_LFE_PLC_FLOAT
- d_syn_filt( d_a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD );
-#else
syn_filt( a, LFE_PLC_LPCORD, zeroes, rec_frame, LFE_PLC_RECLEN, outbuf + LFE_PLC_BUFLEN - LFE_PLC_LPCORD, 0 );
-#endif
return;
}
@@ -661,12 +283,8 @@ static void recover_samples(
*-----------------------------------------------------------------------------------------*/
void ivas_lfe_tdplc(
- LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */
-#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT
- float *prevsynth, /* i : previous frame synthesis */
-#else
- double *prevsynth, /* i : previous frame synthesis */
-#endif
+ LFE_DEC_HANDLE hLFE, /* i/o: LFE decoder handle */
+ float *prevsynth, /* i : previous frame synthesis */
float *ytda, /* o : output time-domain buffer */
const int16_t output_frame /* i : output frame length */
)
diff --git a/lib_dec/ivas_masa_dec.c b/lib_dec/ivas_masa_dec.c
index c18369d1f675d18e8eb762e61f1e2db7ed5befb7..2335f14147dfc7019f32222f4530f52878485daa 100644
--- a/lib_dec/ivas_masa_dec.c
+++ b/lib_dec/ivas_masa_dec.c
@@ -869,11 +869,7 @@ static ivas_error ivas_masa_dec_config(
for ( i = 0; i < st_ivas->hQMetaData->no_directions; i++ )
{
st_ivas->hQMetaData->q_direction[i].cfg.nbands = hMasa->config.numCodingBands;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
st_ivas->hQMetaData->q_direction[i].cfg.nblocks = hMasa->config.joinedSubframes == TRUE ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES;
-#else
- st_ivas->hQMetaData->q_direction[i].cfg.nblocks = hMasa->config.joinedSubframes == TRUE ? 1 : 4;
-#endif
if ( st_ivas->ivas_format == MC_FORMAT && st_ivas->mc_mode == MC_MODE_MCMASA )
{
@@ -1330,12 +1326,8 @@ ivas_error ivas_masa_dec_reconfigure(
ivas_total_brate = st_ivas->hDecoderConfig->ivas_total_brate;
last_ivas_total_brate = st_ivas->hDecoderConfig->last_ivas_total_brate;
-#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
/* Copy state to TC buffer if granularity matches and we are not in OMASA EXT rendering mode */
if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity && st_ivas->hDecoderConfig->output_config != IVAS_AUDIO_CONFIG_EXTERNAL )
-#else
- if ( st_ivas->hSpatParamRendCom != NULL && st_ivas->hSpatParamRendCom->slot_size == st_ivas->hTcBuffer->n_samples_granularity )
-#endif
{
mvs2s( st_ivas->hSpatParamRendCom->subframe_nbslots, st_ivas->hTcBuffer->subframe_nbslots, MAX_JBM_SUBFRAMES_5MS );
st_ivas->hTcBuffer->nb_subframes = st_ivas->hSpatParamRendCom->nb_subframes;
@@ -1356,7 +1348,6 @@ ivas_error ivas_masa_dec_reconfigure(
return error;
}
}
-#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
else if ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX || st_ivas->renderer_type == RENDERER_OMASA_MIX_EXT )
{
/* close all unnecessary parametric decoding and rendering */
@@ -1365,19 +1356,6 @@ ivas_error ivas_masa_dec_reconfigure(
ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) );
ivas_dirac_dec_close( &( st_ivas->hDirAC ) );
}
-#else
- else if ( st_ivas->renderer_type == RENDERER_DISABLE || st_ivas->renderer_type == RENDERER_MONO_DOWNMIX )
- {
- if ( st_ivas->hDirAC != NULL )
- {
- /* close all unnecessary parametric decoding and rendering */
- ivas_dirac_dec_close_binaural_data( st_ivas->hDiracDecBin );
- ivas_dirac_rend_close( &( st_ivas->hDirACRend ) );
- ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) );
- ivas_dirac_dec_close( &( st_ivas->hDirAC ) );
- }
- }
-#endif
/* possible reconfigure is done later */
/*-----------------------------------------------------------------*
diff --git a/lib_dec/ivas_mc_param_dec.c b/lib_dec/ivas_mc_param_dec.c
index 8b26bfbaba485b9f980f2123af87104567aa4c4c..934fc6fac24e34dd8e54f9ef6cbf3fb46ec3b090 100644
--- a/lib_dec/ivas_mc_param_dec.c
+++ b/lib_dec/ivas_mc_param_dec.c
@@ -86,11 +86,7 @@ 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 FIX_835_PARAMMC_BUFFER_VALUES
static void ivas_param_mc_get_mixing_matrices( PARAM_MC_DEC_HANDLE hParamMC, IVAS_OUTPUT_SETUP *hSynthesisOutputSetup, float Cx_in[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], const int16_t param_band_idx, 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 );
-#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[], float *mixing_matrix_res[], const int16_t nY_int, const PARAM_MC_SYNTHESIS_CONF synth_conf, const int16_t nX, const int16_t nY );
-#endif
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 );
@@ -1336,9 +1332,7 @@ void ivas_param_mc_dec_digest_tc(
int16_t nchan_transport;
#else
int16_t i, ch;
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
int16_t is_next_band, skip_next_band;
-#endif
int16_t slot_idx, param_band_idx;
int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb;
int16_t nchan_out_cov;
@@ -1346,16 +1340,11 @@ void ivas_param_mc_dec_digest_tc(
#ifndef OBJ_EDITING_API
/*CLDFB*/
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
float *pCx, *pCx_imag;
float cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
float cx_imag[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
float cx_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
float cx_imag_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
-#else
- 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];
-#endif
float real_part, imag_part;
/* format converter */
int16_t channel_active[MAX_OUTPUT_CHANNELS];
@@ -1418,7 +1407,6 @@ void ivas_param_mc_dec_digest_tc(
ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator );
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
/* loop over two bands at a time */
for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 )
{
@@ -1429,13 +1417,6 @@ void ivas_param_mc_dec_digest_tc(
set_zero( cx_imag, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
set_zero( cx_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
set_zero( cx_imag_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
-#else
- 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 );
- }
-#endif
#endif
/* slot loop for gathering the input data */
@@ -1443,7 +1424,7 @@ void ivas_param_mc_dec_digest_tc(
{
if ( st_ivas->hDecoderConfig->Opt_tsm )
{
-#if defined( FIX_835_PARAMMC_BUFFER_VALUES ) && !defined( OBJ_EDITING_API )
+#if !defined( OBJ_EDITING_API )
if ( param_band_idx == 0 ) /* only run cldfbAna once */
{
#endif
@@ -1458,84 +1439,55 @@ void ivas_param_mc_dec_digest_tc(
mvr2r( RealBuffer, &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands );
mvr2r( ImagBuffer, &hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport + ch * hParamMC->num_freq_bands], hParamMC->num_freq_bands );
}
-#if defined( FIX_835_PARAMMC_BUFFER_VALUES ) && !defined( OBJ_EDITING_API )
+#if !defined( OBJ_EDITING_API )
}
#endif
}
#ifndef OBJ_EDITING_API
if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex )
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
{
if ( is_next_band && skip_next_band )
{
continue;
}
-#endif
ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport],
&hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport],
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
is_next_band ? cx_next_band : cx,
is_next_band ? cx_imag_next_band : cx_imag,
param_band_idx + is_next_band,
-#else
- cx,
- cx_imag,
-#endif
hParamMC,
nchan_transport );
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
}
-#endif
}
#endif
}
#ifndef OBJ_EDITING_API
/* map from complex input covariance to real values */
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
{
if ( is_next_band && skip_next_band )
{
continue;
}
-#else
- for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ )
- {
-#endif
/* Cx for transport channels */
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
pCx = is_next_band ? &cx_next_band[0] : &cx[0];
pCx_imag = is_next_band ? &cx_imag_next_band[0] : &cx_imag[0];
-#endif
for ( i = 0; i < nchan_transport * nchan_transport; i++ )
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
real_part = pCx[i];
imag_part = pCx_imag[i];
-#else
- real_part = cx[param_band_idx][i];
- imag_part = cx_imag[param_band_idx][i];
-#endif
/* (a-ib)(c+id) = ac + bd + i(ad-bc) */
if ( param_band_idx < hParamMC->max_param_band_abs_cov )
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
pCx[i] = sqrtf( real_part * real_part + imag_part * imag_part );
-#else
- cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part );
-#endif
}
else
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
pCx[i] = real_part;
-#else
- cx[param_band_idx][i] = real_part;
-#endif
}
}
}
@@ -1543,45 +1495,29 @@ void ivas_param_mc_dec_digest_tc(
/* 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 ) )
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
v_add( cx, cx_next_band, cx, nchan_transport * nchan_transport );
mvr2r( cx, cx_next_band, nchan_transport * nchan_transport );
-#else
- 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 );
- }
-#endif
}
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
{
if ( is_next_band && skip_next_band )
{
continue;
}
-#endif
/* generate mixing matrices */
ivas_param_mc_get_mixing_matrices( hParamMC,
hSynthesisOutputSetup,
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
is_next_band ? cx_next_band : cx,
param_band_idx + is_next_band,
-#else
- cx,
-#endif
hParamMC->h_output_synthesis_cov_state.mixing_matrix,
hParamMC->h_output_synthesis_cov_state.mixing_matrix_res,
nchan_out_transport,
hParamMC->synthesis_conf,
nchan_transport,
nchan_out_cov );
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
}
}
-#endif
#endif
pop_wmops();
@@ -1602,23 +1538,16 @@ void ivas_param_mc_dec_prepare_renderer(
{
PARAM_MC_DEC_HANDLE hParamMC;
int16_t i;
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
int16_t is_next_band, skip_next_band;
-#endif
int16_t slot_idx, param_band_idx;
int16_t nchan_transport, nchan_out_transport, nchan_out_cldfb;
int16_t nchan_out_cov;
/*CLDFB*/
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
float *pCx, *pCx_imag;
float cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
float cx_imag[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
float cx_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
float cx_imag_next_band[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
-#else
- 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];
-#endif
float real_part, imag_part;
/* format converter */
int16_t channel_active[MAX_OUTPUT_CHANNELS];
@@ -1677,7 +1606,6 @@ void ivas_param_mc_dec_prepare_renderer(
ivas_param_mc_dec_compute_interpolator( hParamMC->hMetadataPMC->bAttackPresent, hParamMC->hMetadataPMC->attackIndex, nCldfbSlots, hParamMC->h_output_synthesis_params.interpolator );
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
/* loop over two bands at a time */
for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx += 2 )
{
@@ -1688,88 +1616,52 @@ void ivas_param_mc_dec_prepare_renderer(
set_zero( cx_imag, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
set_zero( cx_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
set_zero( cx_imag_next_band, PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS );
-#else
- 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 );
- }
-#endif
/* slot loop for gathering the input data */
for ( slot_idx = 0; slot_idx < nCldfbSlots; slot_idx++ )
{
if ( slot_idx >= 2 * hParamMC->hMetadataPMC->attackIndex )
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
{
if ( is_next_band && skip_next_band )
{
continue;
}
-#endif
ivas_dirac_dec_output_synthesis_cov_param_mc_collect_slot( &hParamMC->Cldfb_RealBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport],
&hParamMC->Cldfb_ImagBuffer_tc[slot_idx * hParamMC->num_freq_bands * nchan_transport],
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
is_next_band ? cx_next_band : cx,
is_next_band ? cx_imag_next_band : cx_imag,
param_band_idx + is_next_band,
-#else
- cx,
- cx_imag,
-#endif
hParamMC,
nchan_transport );
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
}
-#endif
}
}
/* map from complex input covariance to real values */
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
{
if ( is_next_band && skip_next_band )
{
continue;
}
-#else
- for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ )
- {
-#endif
/* Cx for transport channels */
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
pCx = is_next_band ? &cx_next_band[0] : &cx[0];
pCx_imag = is_next_band ? &cx_imag_next_band[0] : &cx_imag[0];
-#endif
for ( i = 0; i < nchan_transport * nchan_transport; i++ )
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
real_part = pCx[i];
imag_part = pCx_imag[i];
-#else
- real_part = cx[param_band_idx][i];
- imag_part = cx_imag[param_band_idx][i];
-#endif
/* (a-ib)(c+id) = ac + bd + i(ad-bc) */
if ( param_band_idx < hParamMC->max_param_band_abs_cov )
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
pCx[i] = sqrtf( real_part * real_part + imag_part * imag_part );
-#else
- cx[param_band_idx][i] = sqrtf( real_part * real_part + imag_part * imag_part );
-#endif
}
else
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
pCx[i] = real_part;
-#else
- cx[param_band_idx][i] = real_part;
-#endif
}
}
}
@@ -1777,46 +1669,30 @@ void ivas_param_mc_dec_prepare_renderer(
/* 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 ) )
{
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
v_add( cx, cx_next_band, cx, nchan_transport * nchan_transport );
mvr2r( cx, cx_next_band, nchan_transport * nchan_transport );
-#else
- 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 );
- }
-#endif
}
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
for ( is_next_band = 0; is_next_band < 2; is_next_band++ )
{
if ( is_next_band && skip_next_band )
{
continue;
}
-#endif
/* generate mixing matrices */
ivas_param_mc_get_mixing_matrices( hParamMC,
hSynthesisOutputSetup,
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
is_next_band ? cx_next_band : cx,
param_band_idx + is_next_band,
-#else
- cx,
-#endif
hParamMC->h_output_synthesis_cov_state.mixing_matrix,
hParamMC->h_output_synthesis_cov_state.mixing_matrix_res,
nchan_out_transport,
hParamMC->synthesis_conf,
nchan_transport,
nchan_out_cov );
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
}
}
-#endif
pop_wmops();
@@ -2499,7 +2375,6 @@ static void remove_lfe_from_cy(
*------------------------------------------------------------------------*/
static void ivas_param_mc_get_mixing_matrices(
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
PARAM_MC_DEC_HANDLE hParamMC, /* i : Parametric MC handle */
IVAS_OUTPUT_SETUP *hSynthesisOutputSetup,
float Cx_in[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS], /* i : input covariance for all parameter bands */
@@ -2510,22 +2385,8 @@ static void ivas_param_mc_get_mixing_matrices(
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 */
-#else
- 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 */
- 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 */
-#endif
)
{
-#ifndef FIX_835_PARAMMC_BUFFER_VALUES
- int16_t param_band_idx;
-#endif
float Cx[PARAM_MC_MAX_TRANSPORT_CHANS * PARAM_MC_MAX_TRANSPORT_CHANS];
float Cy[MAX_CICP_CHANNELS * MAX_CICP_CHANNELS];
float Cy_diag[MAX_CICP_CHANNELS];
@@ -2595,175 +2456,164 @@ static void ivas_param_mc_get_mixing_matrices(
num_lfe_bands = PARAM_MC_MAX_BAND_LFE;
}
-#ifndef FIX_835_PARAMMC_BUFFER_VALUES
- for ( param_band_idx = 0; param_band_idx < hParamMC->num_param_bands_synth; param_band_idx++ )
+ if ( hSynthesisOutputSetup->num_lfe > 0 && param_band_idx >= num_lfe_bands )
{
-#endif
- if ( hSynthesisOutputSetup->num_lfe > 0 && param_band_idx >= num_lfe_bands )
- {
- remove_lfe = 1;
- nY_band = nY_cov - hSynthesisOutputSetup->num_lfe;
- proto_matrix_ptr = proto_matrix_noLFE;
- }
- else
- {
- proto_matrix_ptr = hParamMC->h_output_synthesis_params.proto_matrix;
- }
+ remove_lfe = 1;
+ nY_band = nY_cov - hSynthesisOutputSetup->num_lfe;
+ proto_matrix_ptr = proto_matrix_noLFE;
+ }
+ else
+ {
+ proto_matrix_ptr = hParamMC->h_output_synthesis_params.proto_matrix;
+ }
- brange[0] = hParamMC->band_grouping[param_band_idx];
- brange[1] = hParamMC->band_grouping[param_band_idx + 1];
+ brange[0] = hParamMC->band_grouping[param_band_idx];
+ brange[1] = hParamMC->band_grouping[param_band_idx + 1];
-#ifdef FIX_835_PARAMMC_BUFFER_VALUES
- Cx_state = Cx_in;
-#else
- Cx_state = Cx_in[param_band_idx];
-#endif
- Cx_old_state = hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx];
- Cy_old_state = hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx];
+ Cx_state = Cx_in;
+ Cx_old_state = hParamMC->h_output_synthesis_cov_state.cx_old[param_band_idx];
+ Cy_old_state = hParamMC->h_output_synthesis_cov_state.cy_old[param_band_idx];
- /* Getting mixing mtx */
- /* estimate target cov from input cov and proto_matrix */
- matrix_product( hParamMC->proto_matrix_int, nY_intern, nX, 0, Cx_state, nX, nX, 0, mat_mult_buffer1 );
+ /* Getting mixing mtx */
+ /* estimate target cov from input cov and proto_matrix */
+ matrix_product( hParamMC->proto_matrix_int, nY_intern, nX, 0, Cx_state, nX, nX, 0, mat_mult_buffer1 );
- matrix_product( mat_mult_buffer1, nY_intern, nX, 0, hParamMC->proto_matrix_int, nY_intern, nX, 1, Cproto );
+ matrix_product( mat_mult_buffer1, nY_intern, nX, 0, hParamMC->proto_matrix_int, nY_intern, nX, 1, Cproto );
- for ( ch_idx1 = 0; ch_idx1 < nY_intern; ch_idx1++ )
+ for ( ch_idx1 = 0; ch_idx1 < nY_intern; ch_idx1++ )
+ {
+ if ( Cproto[ch_idx1 + ch_idx1 * nY_intern] < 0.0f )
{
- if ( Cproto[ch_idx1 + ch_idx1 * nY_intern] < 0.0f )
- {
- Cproto[ch_idx1 + ch_idx1 * nY_intern] = 0.0f;
- }
+ Cproto[ch_idx1 + ch_idx1 * nY_intern] = 0.0f;
}
+ }
- ivas_param_mc_dequantize_cov( hParamMC,
- hParamMC->icld_q + param_band_idx * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe,
- hParamMC->icc_q + param_band_idx * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe,
- param_band_idx, nY_cov,
- synth_config,
- nY_intern,
- nX, Cx_state, Cproto, Cy_state );
+ ivas_param_mc_dequantize_cov( hParamMC,
+ hParamMC->icld_q + param_band_idx * hParamMC->hMetadataPMC->ild_mapping_conf->ild_map_size_lfe,
+ hParamMC->icc_q + param_band_idx * hParamMC->hMetadataPMC->icc_mapping_conf->icc_map_size_lfe,
+ param_band_idx, nY_cov,
+ synth_config,
+ nY_intern,
+ nX, Cx_state, Cproto, Cy_state );
- /* Smoothing: Sum over two buffers */
- if ( hParamMC->hMetadataPMC->bAttackPresent )
- {
- /* no smoothing on attacks */
- mvr2r( Cx_state, Cx, nX * nX );
- mvr2r( Cy_state, Cy_full, nY_cov * nY_cov );
- }
- else
- {
- /* smoothing gains are now identical to one, simply add up */
- v_add( Cx_state, Cx_old_state, Cx, nX * nX );
- v_add( Cy_state, Cy_old_state, Cy_full, nY_cov * nY_cov );
- }
+ /* Smoothing: Sum over two buffers */
+ if ( hParamMC->hMetadataPMC->bAttackPresent )
+ {
+ /* no smoothing on attacks */
+ mvr2r( Cx_state, Cx, nX * nX );
+ mvr2r( Cy_state, Cy_full, nY_cov * nY_cov );
+ }
+ else
+ {
+ /* smoothing gains are now identical to one, simply add up */
+ v_add( Cx_state, Cx_old_state, Cx, nX * nX );
+ v_add( Cy_state, Cy_old_state, Cy_full, nY_cov * nY_cov );
+ }
- /* cov buffer update */
- mvr2r( Cx_state, Cx_old_state, nX * nX );
- mvr2r( Cy_state, Cy_old_state, nY_cov * nY_cov );
+ /* cov buffer update */
+ mvr2r( Cx_state, Cx_old_state, nX * nX );
+ mvr2r( Cy_state, Cy_old_state, nY_cov * nY_cov );
- /* remove LFE if necessary */
- if ( remove_lfe )
- {
- remove_lfe_from_cy( nY_cov, lfe_indices, hSynthesisOutputSetup->num_lfe, Cy_full, Cy );
- }
- else
- {
- mvr2r( Cy_full, Cy, nY_band * nY_band );
- }
+ /* remove LFE if necessary */
+ if ( remove_lfe )
+ {
+ remove_lfe_from_cy( nY_cov, lfe_indices, hSynthesisOutputSetup->num_lfe, Cy_full, Cy );
+ }
+ else
+ {
+ mvr2r( Cy_full, Cy, nY_band * nY_band );
+ }
- matrix_product( proto_matrix_ptr, nY_band, nX, 0, Cx, nX, nX, 0, mat_mult_buffer1 );
+ matrix_product( proto_matrix_ptr, nY_band, nX, 0, Cx, nX, nX, 0, mat_mult_buffer1 );
- matrix_product_diag( mat_mult_buffer1, nY_band, nX, 0, proto_matrix_ptr, nY_band, nX, 1, Cproto_diag );
+ matrix_product_diag( mat_mult_buffer1, nY_band, nX, 0, proto_matrix_ptr, nY_band, nX, 1, Cproto_diag );
- /* make sure we have no negative entries in Cproto_diag due to rounding errors */
- for ( ch_idx1 = 0; ch_idx1 < nY_band; ch_idx1++ )
+ /* make sure we have no negative entries in Cproto_diag due to rounding errors */
+ for ( ch_idx1 = 0; ch_idx1 < nY_band; ch_idx1++ )
+ {
+ if ( Cproto_diag[ch_idx1] < 0.0f )
{
- if ( Cproto_diag[ch_idx1] < 0.0f )
- {
- Cproto_diag[ch_idx1] = 0.0f;
- }
+ Cproto_diag[ch_idx1] = 0.0f;
}
+ }
- /* Computing the mixing matrices */
+ /* Computing the mixing matrices */
- /* bands with decorr */
- if ( brange[0] < hParamMC->h_output_synthesis_params.max_band_decorr )
- {
- computeMixingMatrices( nX, nY_band, Cx, Cy, proto_matrix_ptr, 0, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_local, Cr );
+ /* bands with decorr */
+ if ( brange[0] < hParamMC->h_output_synthesis_params.max_band_decorr )
+ {
+ computeMixingMatrices( nX, nY_band, Cx, Cy, proto_matrix_ptr, 0, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_local, Cr );
- /* Compute mixing matrix for residual */
- computeMixingMatricesResidual( nY_band, Cproto_diag, Cr, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_res_local );
+ /* Compute mixing matrix for residual */
+ computeMixingMatricesResidual( nY_band, Cproto_diag, Cr, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_res_local );
- if ( remove_lfe )
- {
- set_zero( mixing_matrix_res[param_band_idx], nY_cov * nY_cov );
+ if ( remove_lfe )
+ {
+ set_zero( mixing_matrix_res[param_band_idx], nY_cov * nY_cov );
- ptrMM = mixing_matrix_res_local;
- ptrMM_out = mixing_matrix_res[param_band_idx];
- for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx1++ )
+ ptrMM = mixing_matrix_res_local;
+ ptrMM_out = mixing_matrix_res[param_band_idx];
+ for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx1++ )
+ {
+ for ( ch_idx1 = lfe_indices[lfe_idx1] + 1; ch_idx1 < lfe_indices[lfe_idx1 + 1]; ch_idx1++ )
{
- for ( ch_idx1 = lfe_indices[lfe_idx1] + 1; ch_idx1 < lfe_indices[lfe_idx1 + 1]; ch_idx1++ )
+ for ( lfe_idx2 = 0; lfe_idx2 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx2++ )
{
- for ( lfe_idx2 = 0; lfe_idx2 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx2++ )
+ for ( ch_idx2 = lfe_indices[lfe_idx2] + 1; ch_idx2 < lfe_indices[lfe_idx2 + 1]; ch_idx2++ )
{
- for ( ch_idx2 = lfe_indices[lfe_idx2] + 1; ch_idx2 < lfe_indices[lfe_idx2 + 1]; ch_idx2++ )
- {
- *( ptrMM_out++ ) = *( ptrMM++ );
- }
- ptrMM_out++;
+ *( ptrMM_out++ ) = *( ptrMM++ );
}
- ptrMM_out--;
+ ptrMM_out++;
}
- ptrMM_out += nY_cov;
+ ptrMM_out--;
}
- }
- else
- {
- mvr2r( mixing_matrix_res_local, mixing_matrix_res[param_band_idx], nY_cov * nY_cov );
+ ptrMM_out += nY_cov;
}
}
- else if ( brange[0] < hParamMC->max_band_energy_compensation )
- {
- /* Compute mixing matrices (energy compensation only) */
- computeMixingMatrices( nX, nY_band, Cx, Cy, proto_matrix_ptr, 1, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_local, Cr );
- }
else
{
- /*if neither decorrelation nor energy compensation is applied*/
- for ( i = 0; i < nY_band; i++ )
- {
- Cy_diag[i] = Cy[i + nY_band * i];
- Cy_diag[i] = sqrtf( Cy_diag[i] / ( Cproto_diag[i] + EPSILON ) );
- }
-
- diag_matrix_product( Cy_diag, nY_band, proto_matrix_ptr, nY_band, nX, 0, mixing_matrix_local );
+ mvr2r( mixing_matrix_res_local, mixing_matrix_res[param_band_idx], nY_cov * nY_cov );
}
- if ( remove_lfe )
+ }
+ else if ( brange[0] < hParamMC->max_band_energy_compensation )
+ {
+ /* Compute mixing matrices (energy compensation only) */
+ computeMixingMatrices( nX, nY_band, Cx, Cy, proto_matrix_ptr, 1, PARAM_MC_REG_SX, PARAM_MC_REG_GHAT, mixing_matrix_local, Cr );
+ }
+ else
+ {
+ /*if neither decorrelation nor energy compensation is applied*/
+ for ( i = 0; i < nY_band; i++ )
{
- set_zero( mixing_matrix[param_band_idx], nX * nY_cov );
+ Cy_diag[i] = Cy[i + nY_band * i];
+ Cy_diag[i] = sqrtf( Cy_diag[i] / ( Cproto_diag[i] + EPSILON ) );
+ }
+
+ diag_matrix_product( Cy_diag, nY_band, proto_matrix_ptr, nY_band, nX, 0, mixing_matrix_local );
+ }
+ if ( remove_lfe )
+ {
+ set_zero( mixing_matrix[param_band_idx], nX * nY_cov );
- ptrMM = mixing_matrix_local;
- ptrMM_out = mixing_matrix[param_band_idx];
- for ( ch_idx1 = 0; ch_idx1 < nX; ch_idx1++ )
+ ptrMM = mixing_matrix_local;
+ ptrMM_out = mixing_matrix[param_band_idx];
+ for ( ch_idx1 = 0; ch_idx1 < nX; ch_idx1++ )
+ {
+ for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx1++ )
{
- for ( lfe_idx1 = 0; lfe_idx1 < hSynthesisOutputSetup->num_lfe + 1; lfe_idx1++ )
+ for ( ch_idx2 = lfe_indices[lfe_idx1] + 1; ch_idx2 < lfe_indices[lfe_idx1 + 1]; ch_idx2++ )
{
- for ( ch_idx2 = lfe_indices[lfe_idx1] + 1; ch_idx2 < lfe_indices[lfe_idx1 + 1]; ch_idx2++ )
- {
- *( ptrMM_out++ ) = *( ptrMM++ );
- }
- ptrMM_out++;
+ *( ptrMM_out++ ) = *( ptrMM++ );
}
- ptrMM_out--;
+ ptrMM_out++;
}
+ ptrMM_out--;
}
- else
- {
- mvr2r( mixing_matrix_local, mixing_matrix[param_band_idx], nY_cov * nX );
- }
-#ifndef FIX_835_PARAMMC_BUFFER_VALUES
}
-#endif
+ else
+ {
+ mvr2r( mixing_matrix_local, mixing_matrix[param_band_idx], nY_cov * nX );
+ }
return;
}
diff --git a/lib_dec/ivas_mct_dec.c b/lib_dec/ivas_mct_dec.c
index 81b800de8eeadd3f9454e054a3e04a2694caec8e..08e2de73cd7cefff2f6e4d5c872d5550a2127888 100644
--- a/lib_dec/ivas_mct_dec.c
+++ b/lib_dec/ivas_mct_dec.c
@@ -849,17 +849,10 @@ static ivas_error ivas_mc_dec_reconfig(
ivas_masa_dec_close( &( st_ivas->hMasa ) );
ivas_qmetadata_close( &st_ivas->hQMetaData );
-#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
- if ( st_ivas->hDirAC != NULL )
- {
-#endif
- ivas_dirac_rend_close( &( st_ivas->hDirACRend ) );
- ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) );
- ivas_dirac_dec_close( &( st_ivas->hDirAC ) );
- vbap_free_data( &( st_ivas->hVBAPdata ) );
-#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
- }
-#endif
+ ivas_dirac_rend_close( &( st_ivas->hDirACRend ) );
+ ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) );
+ ivas_dirac_dec_close( &( st_ivas->hDirAC ) );
+ vbap_free_data( &( st_ivas->hVBAPdata ) );
/* init LS conversion if the renderer type asks for it */
if ( st_ivas->renderer_type == RENDERER_MC && st_ivas->hLsSetUpConversion == NULL )
@@ -939,18 +932,11 @@ static ivas_error ivas_mc_dec_reconfig(
ivas_masa_dec_close( &( st_ivas->hMasa ) );
ivas_qmetadata_close( &st_ivas->hQMetaData );
-#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
- if ( st_ivas->hDirAC != NULL )
- {
-#endif
- ivas_dirac_rend_close( &( st_ivas->hDirACRend ) );
- ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) );
- ivas_dirac_dec_close( &( st_ivas->hDirAC ) );
+ ivas_dirac_rend_close( &( st_ivas->hDirACRend ) );
+ ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) );
+ ivas_dirac_dec_close( &( st_ivas->hDirAC ) );
- vbap_free_data( &( st_ivas->hVBAPdata ) );
-#ifndef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
- }
-#endif
+ vbap_free_data( &( st_ivas->hVBAPdata ) );
if ( last_mc_mode == MC_MODE_MCT )
{
@@ -1185,11 +1171,7 @@ static ivas_error ivas_mc_dec_reconfig(
}
}
}
-#ifdef NONBE_FIX_1220_OMASA_JBM_EXT_USAN
else if ( st_ivas->renderer_type == RENDERER_DISABLE )
-#else
- else if ( st_ivas->renderer_type == RENDERER_DISABLE && st_ivas->hDirAC != NULL )
-#endif
{
ivas_dirac_rend_close( &( st_ivas->hDirACRend ) );
ivas_spat_hSpatParamRendCom_close( &( st_ivas->hSpatParamRendCom ) );
diff --git a/lib_dec/ivas_omasa_dec.c b/lib_dec/ivas_omasa_dec.c
index c38f9bc174b1c29eb3687224815f76b760cc68ae..3ab3757688f1aa611fda0a3bd3719ad0c06c9973 100644
--- a/lib_dec/ivas_omasa_dec.c
+++ b/lib_dec/ivas_omasa_dec.c
@@ -445,19 +445,11 @@ ivas_error ivas_omasa_dec_config(
}
}
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
/* Allocate memory for delay buffer within 'hMasaIsmData' */
if ( ( error = ivas_omasa_objects_delay_open( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
}
-#else
- /* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
- if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
- {
- return error;
- }
-#endif
}
else
{
@@ -481,12 +473,10 @@ ivas_error ivas_omasa_dec_config(
if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_DISC )
{
/* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( ( error = ivas_omasa_objects_delay_open( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
}
-#endif
if ( ( error = ivas_omasa_separate_object_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
{
return error;
@@ -513,11 +503,7 @@ ivas_error ivas_omasa_dec_config(
DIRAC_CONFIG_FLAG common_rend_config_flag = st_ivas->hSpatParamRendCom == NULL ? DIRAC_OPEN : DIRAC_RECONFIGURE;
/* Allocate 'hIsmRendererData' handle and memory for delay buffer within 'hMasaIsmData' */
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( ( error = ivas_omasa_objects_delay_open( st_ivas ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = ivas_omasa_render_objects_from_mix_open( st_ivas ) ) != IVAS_ERR_OK )
-#endif
{
return error;
}
@@ -1120,7 +1106,6 @@ void ivas_omasa_combine_separate_ism_with_masa(
}
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
/*-------------------------------------------------------------------------*
* ivas_omasa_objects_delay_open()
*
@@ -1128,21 +1113,11 @@ void ivas_omasa_combine_separate_ism_with_masa(
*-------------------------------------------------------------------------*/
ivas_error ivas_omasa_objects_delay_open(
-#else
-/*-------------------------------------------------------------------------*
- * ivas_omasa_render_objects_from_mix_open()
- *
- * Open structures, reserve memory, and init values.
- *-------------------------------------------------------------------------*/
-
-ivas_error ivas_omasa_render_objects_from_mix_open(
-#endif
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
)
{
int16_t i;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( st_ivas->ism_mode == ISM_MASA_MODE_MASA_ONE_OBJ || st_ivas->ism_mode == ISM_MASA_MODE_PARAM_ONE_OBJ )
{
st_ivas->hMasaIsmData->delayBuffer_nchan = 1;
@@ -1151,9 +1126,6 @@ ivas_error ivas_omasa_render_objects_from_mix_open(
{
st_ivas->hMasaIsmData->delayBuffer_nchan = st_ivas->nchan_ism;
}
-#else
- st_ivas->hMasaIsmData->delayBuffer_nchan = 1;
-#endif
st_ivas->hMasaIsmData->delayBuffer_size = (int16_t) ( ( st_ivas->hDecoderConfig->output_Fs / 50 ) / MAX_PARAM_SPATIAL_SUBFRAMES );
diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h
index c7d03b3fc272f8d65ffe2dd27cd93ca4e0c402fe..2515b1cc99cd3610a05685511cb51fd1e86fe1cf 100644
--- a/lib_dec/ivas_stat_dec.h
+++ b/lib_dec/ivas_stat_dec.h
@@ -815,9 +815,7 @@ typedef struct renderer_struct
float prev_gains[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS];
float *interpolator;
int16_t interpolator_length;
-#ifdef NONBE_FIX_1141_OSBA_ROOM_RENDERING
int16_t interp_offset;
-#endif
float gains[MAX_NUM_OBJECTS][MAX_OUTPUT_CHANNELS];
} ISM_RENDERER_DATA, *ISM_RENDERER_HANDLE;
diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c
index 61ba65f590ba14418ab94a8b1e8fe9faa05d5b65..a3d3c7492a650c8a1bd9f0e5362e8b94480f2708 100644
--- a/lib_dec/lib_dec.c
+++ b/lib_dec/lib_dec.c
@@ -510,13 +510,6 @@ ivas_error IVAS_DEC_Configure(
hDecoderConfig->render_framesize = renderFramesize;
}
-#ifndef FIX_1135_EXT_RENDERER_HANDLES
- if ( hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hDecoderConfig->output_config == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
- {
- hDecoderConfig->Opt_Headrotation = TRUE;
- }
-
-#endif
/* Set decoder parameters to initial values */
if ( ( error = ivas_init_decoder_front( st_ivas ) ) != IVAS_ERR_OK )
{
@@ -895,7 +888,6 @@ ivas_error IVAS_DEC_FeedFrame_Serial(
bfi = 2;
}
}
-
if ( ( error = read_indices( hIvasDec->st_ivas, serial, num_bits, &hIvasDec->prev_ft_speech, &hIvasDec->CNG, bfi ) ) != IVAS_ERR_OK )
{
return error;
@@ -918,9 +910,11 @@ ivas_error IVAS_DEC_FeedFrame_Serial(
hIvasDec->nSamplesAvailableNext = hIvasDec->nSamplesFrame;
#ifdef OBJ_EDITING_API
- /* decode TCs, do TSM and feed to renderer */
- /* setup */
- if ( hIvasDec->hasBeenFedFirstGoodFrame )
+ /* Decode TCs, do TSM and feed to renderer.
+ If TSM is generally enabled, we have to wait for the first good frame.
+ Otherwise, we directly decode the first frame in any case.
+ */
+ if ( ( hIvasDec->st_ivas->hDecoderConfig->Opt_tsm && hIvasDec->hasBeenFedFirstGoodFrame ) || !hIvasDec->st_ivas->hDecoderConfig->Opt_tsm )
{
uint16_t l_ts, nTimeScalerOutSamples;
uint8_t nTransportChannels, nOutChannels;
@@ -989,6 +983,7 @@ ivas_error IVAS_DEC_FeedFrame_Serial(
return IVAS_ERR_UNKNOWN;
}
}
+ hIvasDec->hasBeenFedFrame = false;
}
hIvasDec->hasBeenPreparedRendering = false;
@@ -1388,7 +1383,7 @@ ivas_error IVAS_DEC_SetEditableParameters(
/*---------------------------------------------------------------------*
* IVAS_DEC_PrepareRenderer( )
*
- * Main function to decode to PCM data
+ * prepare IVAS JBM renderer
*---------------------------------------------------------------------*/
ivas_error IVAS_DEC_PrepareRenderer(
IVAS_DEC_HANDLE hIvasDec )
@@ -1605,7 +1600,7 @@ ivas_error IVAS_DEC_GetSamples(
#ifdef DEBUGGING
else
{
- assert( 0 & "wrong PCM type for the flush buffer!" );
+ assert( 0 && "wrong PCM type for the flush buffer!" );
}
#endif
nSamplesRendered += hIvasDec->nSamplesFlushed;
diff --git a/lib_enc/ivas_lfe_enc.c b/lib_enc/ivas_lfe_enc.c
index 18e68b709d0f268ddf418211d7f0dcdecc6119ce..f2fb1fde9a6085657b2a1451fe19c7e1983a862b 100644
--- a/lib_enc/ivas_lfe_enc.c
+++ b/lib_enc/ivas_lfe_enc.c
@@ -164,11 +164,7 @@ static void ivas_lfe_enc_quant(
}
else
{
-#ifdef NONE_BE_FIX_816_LFE_PLC_FLOAT
shift = (int16_t) floorf( IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f( max_value / lfe_abs_sum ) );
-#else
- shift = (int16_t) floor( IVAS_LFE_SHIFTS_PER_DOUBLE * log2_f( max_value / lfe_abs_sum ) );
-#endif
}
shift = max( min_shift * IVAS_LFE_SHIFTS_PER_DOUBLE, min( max_shift, shift ) );
diff --git a/lib_enc/ivas_masa_enc.c b/lib_enc/ivas_masa_enc.c
index 54d61abc559474336dca74c3b6b2be900185d170..fcaad77e88476102acab2be2cd1423fec1c154a1 100644
--- a/lib_enc/ivas_masa_enc.c
+++ b/lib_enc/ivas_masa_enc.c
@@ -174,7 +174,6 @@ ivas_error ivas_masa_enc_open(
hOmasaData->lp_noise_CPE = -1;
hOmasaData->omasa_stereo_sw_cnt = OMASA_STEREO_SW_CNT_MAX;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC )
{
if ( ( hOmasaData->hOmasaEnergy = (OMASA_ENCODER_ENERGY_HANDLE) malloc( sizeof( OMASA_ENCODER_ENERGY_STATE ) ) ) == NULL )
@@ -186,7 +185,6 @@ ivas_error ivas_masa_enc_open(
{
hOmasaData->hOmasaEnergy = NULL;
}
-#endif
hMasa->data.hOmasaData = hOmasaData;
}
@@ -225,14 +223,12 @@ void ivas_masa_enc_close(
if ( ( *hMasa )->data.hOmasaData != NULL )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( ( *hMasa )->data.hOmasaData->hOmasaEnergy != NULL )
{
free( ( *hMasa )->data.hOmasaData->hOmasaEnergy );
( *hMasa )->data.hOmasaData->hOmasaEnergy = NULL;
}
-#endif
free( ( *hMasa )->data.hOmasaData );
( *hMasa )->data.hOmasaData = NULL;
}
@@ -838,11 +834,7 @@ ivas_error ivas_masa_enc_config(
for ( i = 0; i < hQMetaData->no_directions; i++ )
{
hQMetaData->q_direction[i].cfg.nbands = hMasa->config.numCodingBands;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hQMetaData->q_direction[i].cfg.nblocks = hMasa->config.joinedSubframes == TRUE ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES;
-#else
- hQMetaData->q_direction[i].cfg.nblocks = hMasa->config.joinedSubframes == TRUE ? 1 : 4;
-#endif
if ( ivas_format == MC_FORMAT )
{
@@ -1355,11 +1347,7 @@ static void move_metadata_to_qmetadata(
numCodingBands = hMasa->config.numCodingBands;
numDirections = hMasa->config.numberOfDirections;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
numSf = hMasa->config.joinedSubframes == TRUE ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES;
-#else
- numSf = hMasa->config.joinedSubframes == TRUE ? 1 : 4;
-#endif
hMeta = &( hMasa->masaMetadata );
for ( dir = 0; dir < numDirections; dir++ )
@@ -2655,17 +2643,11 @@ void ivas_merge_masa_metadata(
float total_diff_nrg;
float eneBand;
float energyMerged[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hMasa->data.hOmasaData->hOmasaEnergy;
-#endif
numCodingBands = hMasa->config.numCodingBands;
numDirections = hMasa->config.numberOfDirections;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
numSf = hMasa->config.joinedSubframes == TRUE ? 1 : MAX_PARAM_SPATIAL_SUBFRAMES;
-#else
- numSf = hMasa->config.joinedSubframes == TRUE ? 1 : 4;
-#endif
hMeta = &( hMasa->masaMetadata );
for ( sf = 0; sf < numSf; sf++ )
@@ -2686,11 +2668,7 @@ void ivas_merge_masa_metadata(
/* Compute energies */
eneBand = hMasa->data.energy[sf][band];
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
energyMerged[sf][band] = eneBand + hOmasaEnergy->energy_ism[sf][band];
-#else
- energyMerged[sf][band] = eneBand + hMasa->data.hOmasaData->energy_ism[sf][band];
-#endif
/* Compute weights */
energyTimesRatioMASA[0] = eneBand * hMeta->directional_meta[0].energy_ratio[sf][band];
@@ -2707,11 +2685,7 @@ void ivas_merge_masa_metadata(
total_diff_nrg = eneBand * hMeta->common_meta.diffuse_to_total_ratio[sf][band];
/* criterion is mean of ISM ratio and new ratio */
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ) ) ) / 2.0f * hMasa->data.hOmasaData->hOmasaEnergy->energy_ism[sf][band];
-#else
- energyTimesRatioISM = ( hOMasaMeta->directional_meta[0].energy_ratio[sf][band] + ( 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] ) ) ) / 2.0f * hMasa->data.hOmasaData->energy_ism[sf][band];
-#endif
/* Determine combined metadata based on the weights */
merge_dest = -1;
@@ -2733,11 +2707,7 @@ void ivas_merge_masa_metadata(
hMeta->directional_meta[merge_dest].elevation[sf][band] = hOMasaMeta->directional_meta[0].elevation[sf][band];
/* limit with the earlier direct-energy ratio */
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
- dir_sum = 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ); /* new dir ratio */
-#else
- dir_sum = 1.0f - total_diff_nrg / ( EPSILON + eneBand + hMasa->data.hOmasaData->energy_ism[sf][band] ); /* new dir ratio */
-#endif
+ dir_sum = 1.0f - total_diff_nrg / ( EPSILON + eneBand + hOmasaEnergy->energy_ism[sf][band] ); /* new dir ratio */
hMeta->directional_meta[merge_dest].energy_ratio[sf][band] = min( dir_sum, hOMasaMeta->directional_meta[0].energy_ratio[sf][band] ); /* clip with original ISM dir */
hMeta->common_meta.diffuse_to_total_ratio[sf][band] = 1.0f - hMeta->directional_meta[merge_dest].energy_ratio[sf][band];
@@ -3452,9 +3422,7 @@ static void ivas_encode_masaism_metadata(
int16_t tmp, rotate;
int16_t n_ism_tmp, i;
OMASA_ENCODER_DATA_HANDLE hOmasaData = hMasa->data.hOmasaData;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy;
-#endif
int16_t nbands_work;
/* use the values from hQMetaData */
@@ -3465,11 +3433,7 @@ static void ivas_encode_masaism_metadata(
{
for ( sf = 0; sf < numSf; sf++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( sum_f( hOmasaEnergy->energy_ism[sf], omasa_nbands ) == 0.0f )
-#else
- if ( sum_f( hOmasaData->energy_ism[sf], omasa_nbands ) == 0.0f )
-#endif
{
hOmasaData->masa_to_total_energy_ratio[sf][0] = 1.0f;
}
@@ -3491,28 +3455,16 @@ static void ivas_encode_masaism_metadata(
for ( band = 0; band < omasa_nbands; band++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
energy_ism += hOmasaEnergy->energy_ism[sf][band];
-#else
- energy_ism += hOmasaData->energy_ism[sf][band];
-#endif
for ( obj = 0; obj < nchan_ism; obj++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
energy_ism_ind[obj] += hOmasaEnergy->energy_ism[sf][band] * hOmasaEnergy->energy_ratio_ism[sf][band][obj];
-#else
- energy_ism_ind[obj] += hOmasaData->energy_ism[sf][band] * hOmasaData->energy_ratio_ism[sf][band][obj];
-#endif
}
}
for ( obj = 0; obj < nchan_ism; obj++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaEnergy->energy_ratio_ism[sf][0][obj] = energy_ism_ind[obj] / energy_ism;
-#else
- hOmasaData->energy_ratio_ism[sf][0][obj] = energy_ism_ind[obj] / energy_ism;
-#endif
}
hOmasaData->masa_to_total_energy_ratio[sf][0] = eneBand / ( eneBand + energy_ism + EPSILON );
}
@@ -3529,18 +3481,10 @@ static void ivas_encode_masaism_metadata(
}
for ( sf = 0; sf < omasa_nblocks; sf++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
energy_ism += hOmasaEnergy->energy_ism[sf][band];
-#else
- energy_ism += hOmasaData->energy_ism[sf][band];
-#endif
for ( obj = 0; obj < nchan_ism; obj++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
energy_ism_ind[obj] += hOmasaEnergy->energy_ism[sf][band] * hOmasaEnergy->energy_ratio_ism[sf][band][obj];
-#else
- energy_ism_ind[obj] += hOmasaData->energy_ism[sf][band] * hOmasaData->energy_ratio_ism[sf][band][obj];
-#endif
}
}
@@ -3552,11 +3496,7 @@ static void ivas_encode_masaism_metadata(
{
for ( obj = 0; obj < nchan_ism; obj++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaEnergy->energy_ratio_ism[0][band][obj] = energy_ism_ind[obj] / energy_ism;
-#else
- hOmasaData->energy_ratio_ism[0][band][obj] = energy_ism_ind[obj] / energy_ism;
-#endif
}
brange[0] = hMasa->data.band_mapping[band];
brange[1] = hMasa->data.band_mapping[band + 1];
@@ -3578,11 +3518,7 @@ static void ivas_encode_masaism_metadata(
for ( obj = 0; obj < nchan_ism; obj++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaEnergy->energy_ratio_ism[0][band][obj] = hOmasaEnergy->energy_ratio_ism[0][nbands_work - 1][obj];
-#else
- hOmasaData->energy_ratio_ism[0][band][obj] = hOmasaData->energy_ratio_ism[0][nbands_work - 1][obj];
-#endif
}
}
}
@@ -3592,11 +3528,7 @@ static void ivas_encode_masaism_metadata(
{
for ( band = 0; band < nbands_work; band++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
if ( hOmasaEnergy->energy_ism[sf][band] == 0.0f )
-#else
- if ( hOmasaData->energy_ism[sf][band] == 0.0f )
-#endif
{
hOmasaData->masa_to_total_energy_ratio[sf][band] = 1.0f;
}
@@ -3610,11 +3542,7 @@ static void ivas_encode_masaism_metadata(
{
eneBand += hMasa->data.energy[sf][bin];
}
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaData->masa_to_total_energy_ratio[sf][band] = eneBand / ( eneBand + hOmasaEnergy->energy_ism[sf][band] + EPSILON );
-#else
- hOmasaData->masa_to_total_energy_ratio[sf][band] = eneBand / ( eneBand + hOmasaData->energy_ism[sf][band] + EPSILON );
-#endif
}
}
for ( band = nbands_work; band < numCodingBands; band++ )
@@ -3623,11 +3551,7 @@ static void ivas_encode_masaism_metadata(
for ( obj = 0; obj < nchan_ism; obj++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaEnergy->energy_ratio_ism[sf][band][obj] = hOmasaEnergy->energy_ratio_ism[sf][nbands_work - 1][obj];
-#else
- hOmasaData->energy_ratio_ism[sf][band][obj] = hOmasaData->energy_ratio_ism[sf][nbands_work - 1][obj];
-#endif
}
}
}
@@ -3649,13 +3573,8 @@ static void ivas_encode_masaism_metadata(
{
for ( obj = 0; obj < nchan_ism; obj++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
assert( ( hOmasaEnergy->energy_ratio_ism[sf][band][obj] >= 0 ) && ( hOmasaEnergy->energy_ratio_ism[sf][band][obj] <= 1 ) );
ratio_ism[band][obj] = hOmasaEnergy->energy_ratio_ism[sf][band][obj];
-#else
- assert( ( hOmasaData->energy_ratio_ism[sf][band][obj] >= 0 ) && ( hOmasaData->energy_ratio_ism[sf][band][obj] <= 1 ) );
- ratio_ism[band][obj] = hOmasaData->energy_ratio_ism[sf][band][obj];
-#endif
}
/* Quantize ISM ratios */
@@ -3679,11 +3598,7 @@ static void ivas_encode_masaism_metadata(
}
/* reconstructed values */
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
reconstruct_ism_ratios( ratio_ism_idx[band], nchan_ism, step, hOmasaEnergy->q_energy_ratio_ism[sf][band] );
-#else
- reconstruct_ism_ratios( ratio_ism_idx[band], nchan_ism, step, hMasa->data.hOmasaData->q_energy_ratio_ism[sf][band] );
-#endif
}
if ( ( nchan_ism > 2 ) && ( idx_separated_object == nchan_ism - 1 ) )
@@ -3758,11 +3673,7 @@ static void ivas_encode_masaism_metadata(
}
}
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
calculate_nbits_meta( nchan_ism, hOmasaEnergy->q_energy_ratio_ism, hOmasaData->masa_to_total_energy_ratio, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp );
-#else
- calculate_nbits_meta( nchan_ism, hOmasaData->q_energy_ratio_ism, hOmasaData->masa_to_total_energy_ratio, numSf, numCodingBands, bits_ism, idx_separated_object, ism_imp );
-#endif
/* quantize directions */
for ( obj = 0; obj < nchan_ism; obj++ )
diff --git a/lib_enc/ivas_omasa_enc.c b/lib_enc/ivas_omasa_enc.c
index 4e184d59a5de505bf34f9617161b5778d101a2af..a8c793d8f9ba259d2c2d53f0d4027aa74b0083f9 100644
--- a/lib_enc/ivas_omasa_enc.c
+++ b/lib_enc/ivas_omasa_enc.c
@@ -290,7 +290,6 @@ ivas_error ivas_omasa_enc_config(
st_ivas->hOMasa = NULL;
}
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
/* OMASA energy handle */
if ( st_ivas->ism_mode != ISM_MASA_MODE_DISC && st_ivas->hMasa->data.hOmasaData->hOmasaEnergy == NULL )
{
@@ -305,7 +304,6 @@ ivas_error ivas_omasa_enc_config(
st_ivas->hMasa->data.hOmasaData->hOmasaEnergy = NULL;
}
-#endif
st_ivas->hCPE[0]->element_brate = ivas_total_brate - ism_total_brate;
if ( ivas_total_brate - ism_total_brate >= MIN_BRATE_MDCT_STEREO )
@@ -839,9 +837,7 @@ static void ivas_omasa_param_est_enc(
float renormalization_factor_diff[MASA_FREQUENCY_BANDS];
float norm_tmp;
int16_t mrange[2], brange[2];
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy;
-#endif
num_freq_bins = hOMasa->cldfbAnaEnc[0]->no_channels;
num_freq_bands = hOMasa->nbands;
@@ -873,11 +869,7 @@ static void ivas_omasa_param_est_enc(
hOMasa->direction_vector_m[2][block_m_idx][band_m_idx] = 0.0f;
}
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
set_zero( hOmasaEnergy->energy_ism[block_m_idx], num_freq_bands );
-#else
- set_zero( hOmasaData->energy_ism[block_m_idx], num_freq_bands );
-#endif
for ( ts = mrange[0]; ts < mrange[1]; ts++ )
{
@@ -895,11 +887,7 @@ static void ivas_omasa_param_est_enc(
{
for ( k = 0; k < nchan_ism; k++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaEnergy->energy_ism[block_m_idx][i] += Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j];
-#else
- hOmasaData->energy_ism[block_m_idx][i] += Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j];
-#endif
}
}
}
@@ -1027,9 +1015,7 @@ static void ivas_omasa_energy_and_ratio_est(
int16_t mrange[2], brange[2];
float tftile_energy;
float ism_ratio_sum;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy = hOmasaData->hOmasaEnergy;
-#endif
num_freq_bands = hOMasa->nbands;
l_ts = input_frame / CLDFB_NO_COL_MAX;
@@ -1043,17 +1029,9 @@ static void ivas_omasa_energy_and_ratio_est(
/* Reset variable */
for ( i = 0; i < hOMasa->nbands; i++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
set_zero( hOmasaEnergy->energy_ratio_ism[block_m_idx][i], nchan_ism );
-#else
- set_zero( hOmasaData->energy_ratio_ism[block_m_idx][i], nchan_ism );
-#endif
}
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
set_zero( hOmasaEnergy->energy_ism[block_m_idx], num_freq_bands );
-#else
- set_zero( hOmasaData->energy_ism[block_m_idx], num_freq_bands );
-#endif
/* Compute CLDFB */
for ( ts = mrange[0]; ts < mrange[1]; ts++ )
@@ -1073,14 +1051,8 @@ static void ivas_omasa_energy_and_ratio_est(
for ( k = 0; k < nchan_ism; k++ )
{
tftile_energy = Chnl_RealBuffer[k][j] * Chnl_RealBuffer[k][j] + Chnl_ImagBuffer[k][j] * Chnl_ImagBuffer[k][j];
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaEnergy->energy_ism[block_m_idx][i] += tftile_energy;
hOmasaEnergy->energy_ratio_ism[block_m_idx][i][k] += tftile_energy;
-
-#else
- hOmasaData->energy_ism[block_m_idx][i] += tftile_energy;
- hOmasaData->energy_ratio_ism[block_m_idx][i][k] += tftile_energy;
-#endif
}
}
}
@@ -1092,13 +1064,8 @@ static void ivas_omasa_energy_and_ratio_est(
ism_ratio_sum = 0.0f;
for ( j = 0; j < nchan_ism; j++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaEnergy->energy_ratio_ism[block_m_idx][i][j] /= ( hOmasaEnergy->energy_ism[block_m_idx][i] + EPSILON );
ism_ratio_sum += hOmasaEnergy->energy_ratio_ism[block_m_idx][i][j];
-#else
- hOmasaData->energy_ratio_ism[block_m_idx][i][j] /= ( hOmasaData->energy_ism[block_m_idx][i] + EPSILON );
- ism_ratio_sum += hOmasaData->energy_ratio_ism[block_m_idx][i][j];
-#endif
}
if ( ism_ratio_sum == 0.0f )
@@ -1106,11 +1073,7 @@ static void ivas_omasa_energy_and_ratio_est(
float temp_ism_ratio = 1.0f / ( (float) nchan_ism );
for ( j = 0; j < nchan_ism; j++ )
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
hOmasaEnergy->energy_ratio_ism[block_m_idx][i][j] = temp_ism_ratio;
-#else
- hOmasaData->energy_ratio_ism[block_m_idx][i][j] = temp_ism_ratio;
-#endif
}
}
}
diff --git a/lib_enc/ivas_stat_enc.h b/lib_enc/ivas_stat_enc.h
index f0284ff7882568f3d1242f71e0e79b0a6378447d..4bb9a5f417688a732afcf8b227b81c76c1ba9035 100644
--- a/lib_enc/ivas_stat_enc.h
+++ b/lib_enc/ivas_stat_enc.h
@@ -794,7 +794,6 @@ typedef struct ivas_omasa_enc_state_structure
} OMASA_ENC_STATE, *OMASA_ENC_HANDLE;
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
typedef struct ivas_omasa_encoder_energy_struct
{
float energy_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
@@ -803,16 +802,9 @@ typedef struct ivas_omasa_encoder_energy_struct
} OMASA_ENCODER_ENERGY_STATE, *OMASA_ENCODER_ENERGY_HANDLE;
-#endif
typedef struct ivas_omasa_encoder_data_struct
{
-#ifdef FIX_1161_REDUCE_OMASA_HEAP
OMASA_ENCODER_ENERGY_HANDLE hOmasaEnergy;
-#else
- float energy_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
- float energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS];
- float q_energy_ratio_ism[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS][MAX_NUM_OBJECTS];
-#endif
float masa_to_total_energy_ratio[MAX_PARAM_SPATIAL_SUBFRAMES][MASA_FREQUENCY_BANDS];
float lp_noise_CPE; /* LP filtered total noise estimation */
int16_t omasa_stereo_sw_cnt;
diff --git a/lib_rend/ivas_crend.c b/lib_rend/ivas_crend.c
index 232e478be6749c583d48a20bc5d81aba6adeac25..87215cd2bf9346ed4acd17c8a767c7ae2c668d5e 100644
--- a/lib_rend/ivas_crend.c
+++ b/lib_rend/ivas_crend.c
@@ -1566,15 +1566,9 @@ static ivas_error ivas_rend_crendConvolver(
int32_t offset, offset_in, offset_diffuse;
int16_t nchan_in, nchan_out;
const float *pIn;
-#ifdef FIX_CREND_SIMPLIFY_CODE
const float *pFreq_filt_re, *pFreq_filt_im;
float *pFreq_buf_re = NULL, *pFreq_buf_im = NULL;
float *pFreq_buf2_re = NULL, *pFreq_buf2_im = NULL;
-#else
- float *pFreq_buf_re, *pFreq_buf_im;
- float *pFreq_buf2_re, *pFreq_buf2_im;
- const float *pFreq_filt_re, *pFreq_filt_im;
-#endif
float pOut[L_FRAME48k * 2];
float tmp_out_re[L_FRAME48k], tmp_out_im[L_FRAME48k];
CREND_HANDLE hCrend;
@@ -1621,7 +1615,6 @@ static ivas_error ivas_rend_crendConvolver(
}
}
-#ifdef FIX_CREND_SIMPLIFY_CODE
if ( pCrend->hHrtfCrend->num_iterations_diffuse[0] > 0 )
{
if ( pCrend->hHrtfCrend->same_inv_diffuse_weight )
@@ -1637,7 +1630,6 @@ static ivas_error ivas_rend_crendConvolver(
pFreq_buf2_im = &hCrend->freq_buffer_im_diffuse[1][offset_diffuse];
}
}
-#endif
i = 0;
for ( idx_in = 0; idx_in < nchan_in; idx_in++ )
@@ -1649,10 +1641,6 @@ static ivas_error ivas_rend_crendConvolver(
{
if ( pCrend->hHrtfCrend->same_inv_diffuse_weight )
{
-#ifndef FIX_CREND_SIMPLIFY_CODE
- pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[0][offset_diffuse];
- pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[0][offset_diffuse];
-#endif
pFreq_filt_re = &hCrend->freq_buffer_re[i][offset];
pFreq_filt_im = &hCrend->freq_buffer_im[i][offset];
@@ -1664,12 +1652,6 @@ static ivas_error ivas_rend_crendConvolver(
}
else
{
-#ifndef FIX_CREND_SIMPLIFY_CODE
- pFreq_buf_re = &hCrend->freq_buffer_re_diffuse[0][offset_diffuse];
- pFreq_buf_im = &hCrend->freq_buffer_im_diffuse[0][offset_diffuse];
- pFreq_buf2_re = &hCrend->freq_buffer_re_diffuse[1][offset_diffuse];
- pFreq_buf2_im = &hCrend->freq_buffer_im_diffuse[1][offset_diffuse];
-#endif
pFreq_filt_re = &hCrend->freq_buffer_re[i][offset];
pFreq_filt_im = &hCrend->freq_buffer_im[i][offset];
@@ -1683,14 +1665,7 @@ static ivas_error ivas_rend_crendConvolver(
}
}
-#ifdef FIX_CREND_SIMPLIFY_CODE
ivas_mdft( pIn, &hCrend->freq_buffer_re[i][offset], &hCrend->freq_buffer_im[i][offset], subframe_length, subframe_length );
-#else
- pFreq_buf_re = &hCrend->freq_buffer_re[i][offset];
- pFreq_buf_im = &hCrend->freq_buffer_im[i][offset];
-
- ivas_mdft( pIn, pFreq_buf_re, pFreq_buf_im, subframe_length, subframe_length );
-#endif
i++;
}
}
diff --git a/lib_rend/ivas_dirac_dec_binaural_functions.c b/lib_rend/ivas_dirac_dec_binaural_functions.c
index 19f6c7e5540bc60f457cdc551b387749f86b5e43..1d63b23d09e6e03dffc49e53410ab204e6bd04a3 100644
--- a/lib_rend/ivas_dirac_dec_binaural_functions.c
+++ b/lib_rend/ivas_dirac_dec_binaural_functions.c
@@ -412,13 +412,8 @@ ivas_error ivas_dirac_dec_binaural_copy_hrtfs(
*hHrtfParambin = hrtfParambin;
-#ifdef FIX_RETURN
return IVAS_ERR_OK;
-#endif
}
-#ifndef FIX_RETURN
- return IVAS_ERR_OK;
-#endif
}
diff --git a/lib_rend/ivas_objectRenderer_hrFilt.c b/lib_rend/ivas_objectRenderer_hrFilt.c
index 386415afe4cfabd8b8d23ff3c9b558fd27ce05ab..b1f7f11636c8206c3fdab367c37f256d6914719d 100644
--- a/lib_rend/ivas_objectRenderer_hrFilt.c
+++ b/lib_rend/ivas_objectRenderer_hrFilt.c
@@ -218,13 +218,8 @@ static void GenerateFilter(
ESynL += modelEval->BMEnergiesL[modelEval->UseIndsL[i]].val;
ESynR += modelEval->BMEnergiesR[modelEval->UseIndsR[i]].val;
}
-#ifdef FIX_1166_TDREND_DIV0
ScaleL = sqrtf( ETotL / ( ESynL + EPSILON ) );
ScaleR = sqrtf( ETotR / ( ESynR + EPSILON ) );
-#else
- ScaleL = sqrtf( ETotL / ESynL );
- ScaleR = sqrtf( ETotR / ESynR );
-#endif
/* Build using only the most energetic components. */
for ( k = model->iSecFirst[iSec]; k <= model->iSecLast[iSec]; k++ )
diff --git a/lib_rend/ivas_stat_rend.h b/lib_rend/ivas_stat_rend.h
index 22bd0d277e8c1ac1d226451f11ea4fee821929e6..f1d777699c83a970215f125106add0b5ba8d14d0 100644
--- a/lib_rend/ivas_stat_rend.h
+++ b/lib_rend/ivas_stat_rend.h
@@ -1175,14 +1175,12 @@ typedef struct ivas_hrtfs_structure
float inv_diffuse_weight[BINAURAL_CHANNELS][MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */
int16_t same_inv_diffuse_weight;
float gain_lfe;
-#ifdef FIX_POINT_ROM_CONST
float *pOut_to_bin_re_dyn[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];
float *pOut_to_bin_im_dyn[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];
float *pOut_to_bin_diffuse_re_dyn[BINAURAL_CHANNELS];
float *pOut_to_bin_diffuse_im_dyn[BINAURAL_CHANNELS];
uint16_t *pIndex_frequency_max_dyn[MAX_INTERN_CHANNELS][BINAURAL_CHANNELS];
uint16_t *pIndex_frequency_max_diffuse_dyn[BINAURAL_CHANNELS];
-#endif
} HRTFS_DATA, *HRTFS_HANDLE;
@@ -1260,17 +1258,12 @@ typedef struct ivas_hrtfs_crend_structure
typedef struct ivas_hrtfs_fastconv_struct
{
float FASTCONV_HOA3_latency_s;
-#ifndef FIX_1123_FASTCONV_16BIT_FMT
- float FASTCONV_HRIR_latency_s;
-#endif
float ***leftHRIRReal_HOA3;
float ***leftHRIRImag_HOA3;
float ***rightHRIRReal_HOA3;
float ***rightHRIRImag_HOA3;
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
float FASTCONV_HRIR_latency_s;
-#endif
float ***leftHRIRReal;
float ***leftHRIRImag;
float ***rightHRIRReal;
@@ -1295,13 +1288,11 @@ typedef struct ivas_hrtfs_fastconv_struct
float FASTCONV_FOA_latency_s;
int16_t allocate_init_flag; /*Memory allocation flag 0: if the hrtf pointers are allocated at application level , 1: of allocated at ivas_binaural_hrtf_open() */
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
uint16_t ntaps_hrir;
uint16_t ntaps_hrir_hoa3;
uint16_t ntaps_hrir_hoa2;
uint16_t ntaps_hrir_foa;
uint16_t ntaps_brir;
-#endif
float fastconvReverberationTimes[CLDFB_NO_CHANNELS_MAX];
float fastconvReverberationEneCorrections[CLDFB_NO_CHANNELS_MAX];
@@ -1314,11 +1305,9 @@ typedef struct ivas_hrtfs_statistics_struct
const float *average_energy_l;
const float *average_energy_r;
const float *inter_aural_coherence;
-#ifdef FIX_POINT_ROM_CONST
float *average_energy_l_dyn;
float *average_energy_r_dyn;
float *inter_aural_coherence_dyn;
-#endif
int16_t fromROM; /* Flag that indicates that the pointers point to tables in ROM (controls init/dealloc).*/
} HRTFS_STATISTICS, *HRTFS_STATISTICS_HANDLE;
diff --git a/lib_rend/lib_rend.c b/lib_rend/lib_rend.c
index 3efafb6a291a24d443dbad63b44b779044c84e39..e3538025eca02a194e18b07ae216d5e7a91da5c9 100644
--- a/lib_rend/lib_rend.c
+++ b/lib_rend/lib_rend.c
@@ -204,11 +204,7 @@ struct IVAS_REND
AUDIO_CONFIG outputConfig;
EFAP_WRAPPER efapOutWrapper;
IVAS_LSSETUP_CUSTOM_STRUCT customLsOut;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
SPLIT_REND_WRAPPER *splitRendWrapper;
-#else
- SPLIT_REND_WRAPPER splitRendWrapper;
-#endif
IVAS_REND_AudioBuffer splitRendEncBuffer;
IVAS_REND_HeadRotData headRotData;
@@ -1112,11 +1108,7 @@ static ivas_error initHeadRotation(
static void closeHeadRotation(
IVAS_REND_HANDLE hIvasRend )
{
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( hIvasRend != NULL && hIvasRend->headRotData.headRotEnabled && hIvasRend->headRotData.hOrientationTracker != NULL )
-#else
- if ( ( hIvasRend != NULL ) && ( hIvasRend->headRotData.hOrientationTracker != NULL ) )
-#endif
{
free( hIvasRend->headRotData.hOrientationTracker );
}
@@ -1225,11 +1217,7 @@ static rendering_context getRendCtx(
ctx.pHeadRotData = &hIvasRend->headRotData;
ctx.hhRendererConfig = &hIvasRend->hRendererConfig;
ctx.pSplitRendBFI = &hIvasRend->splitRendBFI;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ctx.pSplitRendWrapper = hIvasRend->splitRendWrapper;
-#else
- ctx.pSplitRendWrapper = &hIvasRend->splitRendWrapper;
-#endif
ctx.pCombinedOrientationData = &hIvasRend->hCombinedOrientationData;
return ctx;
@@ -1275,11 +1263,7 @@ static ivas_error initIsmMasaRendering(
ivas_td_binaural_close( &inputIsm->tdRendWrapper.hBinRendererTd );
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
-#else
- ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
-#endif
ivas_reverb_close( &inputIsm->hReverb );
@@ -1383,11 +1367,7 @@ static ivas_error setRendInputActiveIsm(
}
else if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_IR )
{
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = ivas_rend_openCrend( &inputIsm->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hrtfs->hSetOfHRTF, hrtfs->hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
-#endif
{
return error;
}
@@ -1410,11 +1390,7 @@ static void clearInputIsm(
initRendInputBase( &inputIsm->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 );
/* Free input's internal handles */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper != NULL ? inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
-#else
- ivas_rend_closeCrend( &inputIsm->crendWrapper, inputIsm->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
-#endif
ivas_reverb_close( &inputIsm->hReverb );
@@ -2112,11 +2088,7 @@ static ivas_error initMcBinauralRendering(
/* if we need to use TD renderer and CREND was open, close it */
if ( useTDRend )
{
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
-#else
- ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
-#endif
}
if ( !reconfigureFlag || ( !useTDRend && outConfig != IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB && inputMc->hReverb != NULL ) )
@@ -2208,11 +2180,7 @@ static ivas_error initMcMasaRendering(
ivas_td_binaural_close( &inputMc->tdRendWrapper.hBinRendererTd );
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
-#else
- ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
-#endif
ivas_reverb_close( &inputMc->hReverb );
@@ -2397,11 +2365,7 @@ static void clearInputMc(
efap_free_data( &inputMc->efapInWrapper.hEfap );
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper != NULL ? inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
-#else
- ivas_rend_closeCrend( &inputMc->crendWrapper, inputMc->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
-#endif
ivas_reverb_close( &inputMc->hReverb );
@@ -2574,11 +2538,7 @@ static ivas_error updateSbaPanGains(
}
else
{
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, inConfig, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
-#endif
{
return error;
}
@@ -2590,11 +2550,7 @@ static ivas_error updateSbaPanGains(
return error;
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = ivas_rend_openCrend( &inputSba->crendWrapper, IVAS_AUDIO_CONFIG_7_1_4, outConfig, hRendCfg, hMixconv, hHrtfStatistics, *rendCtx.pOutSampleRate, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses ) ) != IVAS_ERR_OK )
-#endif
{
return error;
}
@@ -2626,11 +2582,7 @@ static ivas_error initSbaMasaRendering(
{
ivas_error error;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper != NULL ? inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
-#else
- ivas_rend_closeCrend( &inputSba->crendWrapper, inputSba->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses );
-#endif
if ( ( error = ivas_dirac_ana_open( &inputSba->hDirAC, inSampleRate ) ) != IVAS_ERR_OK )
{
@@ -2708,11 +2660,7 @@ static void clearInputSba(
initRendInputBase( &inputSba->base, IVAS_AUDIO_CONFIG_INVALID, 0, rendCtx, NULL, 0 );
/* Free input's internal handles */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper != NULL ? rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses : 1 );
-#else
- ivas_rend_closeCrend( &inputSba->crendWrapper, rendCtx.pSplitRendWrapper->multiBinPoseData.num_poses );
-#endif
if ( inputSba->cldfbRendWrapper.hCldfbRend != NULL )
{
@@ -2804,17 +2752,15 @@ static void clearInputMasa(
*------------------------------------------------------------------------*/
ivas_error IVAS_REND_Open(
- IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */
- const int32_t outputSampleRate, /* i : output sampling rate */
- const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */
- const bool asHrtfBinary, /* i : load hrtf binary file */
- const int16_t nonDiegeticPan, /* i : non-diegetic object flag */
- const float nonDiegeticPanGain, /* i : non-diegetic panning gain */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
+ IVAS_REND_HANDLE *phIvasRend, /* i/o: Pointer to renderer handle */
+ const int32_t outputSampleRate, /* i : output sampling rate */
+ const IVAS_AUDIO_CONFIG outConfig, /* i : output audio config */
+ const bool asHrtfBinary, /* i : load hrtf binary file */
+ const int16_t nonDiegeticPan, /* i : non-diegetic object flag */
+ const float nonDiegeticPanGain, /* i : non-diegetic panning gain */
const int16_t Opt_Headrotation, /* i : indicates whether head-rotation is used */
const int16_t Opt_ExternalOrientation, /* i : indicates whether external orientations are used */
-#endif
- const int16_t num_subframes /* i : number of subframes */
+ const int16_t num_subframes /* i : number of subframes */
)
{
int16_t i;
@@ -2869,46 +2815,34 @@ ivas_error IVAS_REND_Open(
}
/* Initialize headrotation data */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
hIvasRend->headRotData.headRotEnabled = 0;
if ( Opt_Headrotation )
{
-#endif
if ( ( error = initHeadRotation( hIvasRend ) ) != IVAS_ERR_OK )
{
return error;
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
}
-#endif
/* Initialize external orientation data */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
hIvasRend->hExternalOrientationData = NULL;
if ( Opt_ExternalOrientation )
{
-#endif
if ( ( error = ivas_external_orientation_open( &( hIvasRend->hExternalOrientationData ), num_subframes ) ) != IVAS_ERR_OK )
{
return error;
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
}
-#endif
/* Initilize combined orientation data */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
hIvasRend->hCombinedOrientationData = NULL;
if ( Opt_Headrotation || Opt_ExternalOrientation )
{
-#endif
if ( ( error = ivas_combined_orientation_open( &( hIvasRend->hCombinedOrientationData ), outputSampleRate, num_subframes ) ) != IVAS_ERR_OK )
{
return error;
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
}
-#endif
/* Initialize EFAP */
if ( ( error = initEfap( &hIvasRend->efapOutWrapper, outConfig, &hIvasRend->customLsOut ) ) != IVAS_ERR_OK )
@@ -2918,7 +2852,6 @@ ivas_error IVAS_REND_Open(
/* Initialize inputs */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
hIvasRend->splitRendWrapper = NULL;
if ( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_CODED || hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM )
{
@@ -2929,9 +2862,6 @@ ivas_error IVAS_REND_Open(
isar_init_split_rend_handles( hIvasRend->splitRendWrapper );
}
-#else
- isar_init_split_rend_handles( &hIvasRend->splitRendWrapper );
-#endif
hIvasRend->splitRendEncBuffer.data = NULL;
for ( i = 0; i < RENDERER_MAX_ISM_INPUTS; ++i )
@@ -3023,17 +2953,13 @@ ivas_error IVAS_REND_Open(
}
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( outConfig == IVAS_AUDIO_CONFIG_BINAURAL_ROOM_REVERB )
{
-#endif
if ( ( error = ivas_HRTF_statistics_init( &( hIvasRend->hHrtfs.hHrtfStatistics ), hIvasRend->sampleRateOut ) ) != IVAS_ERR_OK )
{
return error;
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
}
-#endif
return IVAS_ERR_OK;
}
@@ -3546,11 +3472,7 @@ ivas_error IVAS_REND_AddInput(
int16_t cldfb_in_flag;
cldfb_in_flag = getCldfbRendFlag( hIvasRend, getAudioConfigType( inConfig ) );
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( ( error = ivas_pre_rend_init( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = ivas_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK )
-#endif
{
return error;
}
@@ -3968,11 +3890,7 @@ ivas_error IVAS_REND_GetDelay(
{
if ( hIvasRend->inputsSba[i].base.inConfig != IVAS_AUDIO_CONFIG_INVALID )
{
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( hIvasRend->splitRendWrapper != NULL && hIvasRend->splitRendWrapper->hBinHrSplitPreRend != NULL )
-#else
- if ( hIvasRend->splitRendWrapper.hBinHrSplitPreRend != NULL )
-#endif
{
if ( hIvasRend->hRendererConfig->split_rend_config.rendererSelection == ISAR_SPLIT_REND_RENDERER_SELECTION_FASTCONV )
{
@@ -4474,22 +4392,14 @@ ivas_error IVAS_REND_FeedRenderConfig(
{
int16_t cldfb_in_flag;
cldfb_in_flag = getCldfbRendFlag( hIvasRend, IVAS_REND_AUDIO_CONFIG_TYPE_UNKNOWN );
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( hIvasRend->splitRendWrapper != NULL )
{
ISAR_PRE_REND_close( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
free( hIvasRend->splitRendWrapper );
hIvasRend->splitRendWrapper = NULL;
}
-#else
- ISAR_PRE_REND_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
-#endif
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( ( error = ivas_pre_rend_init( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK )
-#else
- if ( ( error = ivas_pre_rend_init( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer, &hIvasRend->hRendererConfig->split_rend_config, hIvasRend->headRotData, hIvasRend->sampleRateOut, hIvasRend->outputConfig, cldfb_in_flag, hIvasRend->num_subframes ) ) != IVAS_ERR_OK )
-#endif
{
return error;
}
@@ -4646,12 +4556,10 @@ ivas_error IVAS_REND_SetOrientationTrackingMode(
const IVAS_HEAD_ORIENT_TRK_T orientation_tracking /* i : Head orientation tracking type */
)
{
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( hIvasRend->headRotData.headRotEnabled == 0 )
{
return IVAS_ERR_OK;
}
-#endif
return ivas_orient_trk_SetTrackingType( hIvasRend->headRotData.hOrientationTracker, orientation_tracking );
}
@@ -5285,11 +5193,7 @@ static ivas_error renderIsmToBinauralRoom(
hCombinedOrientationData = ismInput->base.ctx.pCombinedOrientationData;
combinedOrientationEnabled = 0;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( *hCombinedOrientationData != NULL )
-#else
- if ( hCombinedOrientationData != NULL )
-#endif
{
for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
{
@@ -5903,11 +5807,7 @@ static ivas_error renderMcToBinaural(
hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
combinedOrientationEnabled = 0;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( *hCombinedOrientationData != NULL )
-#else
- if ( hCombinedOrientationData != NULL )
-#endif
{
for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
{
@@ -5996,11 +5896,7 @@ static ivas_error renderMcToBinauralRoom(
hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
combinedOrientationEnabled = 0;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( *hCombinedOrientationData != NULL )
-#else
- if ( hCombinedOrientationData != NULL )
-#endif
{
for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
{
@@ -6091,11 +5987,7 @@ static ivas_error renderMcCustomLsToBinauralRoom(
hCombinedOrientationData = mcInput->base.ctx.pCombinedOrientationData;
combinedOrientationEnabled = 0;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( *hCombinedOrientationData != NULL )
-#else
- if ( hCombinedOrientationData != NULL )
-#endif
{
for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
{
@@ -6701,11 +6593,7 @@ static ivas_error renderSbaToBinaural(
hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
combinedOrientationEnabled = 0;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( *hCombinedOrientationData != NULL )
-#else
- if ( hCombinedOrientationData != NULL )
-#endif
{
for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
{
@@ -6782,11 +6670,7 @@ static ivas_error renderSbaToBinauralRoom(
hCombinedOrientationData = sbaInput->base.ctx.pCombinedOrientationData;
combinedOrientationEnabled = 0;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( *hCombinedOrientationData != NULL )
-#else
- if ( hCombinedOrientationData != NULL )
-#endif
{
for ( subframe_idx = 0; subframe_idx < ( *hCombinedOrientationData )->num_subframes; subframe_idx++ )
{
@@ -7527,19 +7411,10 @@ static ivas_error getSamplesInternal(
( hIvasRend->outputConfig == IVAS_AUDIO_CONFIG_BINAURAL_SPLIT_PCM ) )
{
int16_t num_poses_orig;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
num_poses_orig = hIvasRend->splitRendWrapper->multiBinPoseData.num_poses;
-#else
- num_poses_orig = hIvasRend->splitRendWrapper.multiBinPoseData.num_poses;
-#endif
outAudio = hIvasRend->splitRendEncBuffer;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
ISAR_PRE_REND_GetMultiBinPoseData( &hIvasRend->hRendererConfig->split_rend_config, &hIvasRend->splitRendWrapper->multiBinPoseData, hIvasRend->headRotData.sr_pose_pred_axis );
assert( num_poses_orig == hIvasRend->splitRendWrapper->multiBinPoseData.num_poses && "number of poses should not change dynamically" );
-#else
- ISAR_PRE_REND_GetMultiBinPoseData( &hIvasRend->hRendererConfig->split_rend_config, &hIvasRend->splitRendWrapper.multiBinPoseData, hIvasRend->headRotData.sr_pose_pred_axis );
- assert( num_poses_orig == hIvasRend->splitRendWrapper.multiBinPoseData.num_poses && "number of poses should not change dynamically" );
-#endif
/* Clear output buffer for split rendering bitstream */
set_zero( outAudio.data, outAudio.config.numChannels * outAudio.config.numSamplesPerChannel );
@@ -7604,11 +7479,7 @@ static ivas_error getSamplesInternal(
}
}
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( hIvasRend->splitRendWrapper,
-#else
- if ( ( error = ISAR_PRE_REND_MultiBinToSplitBinaural( &hIvasRend->splitRendWrapper,
-#endif
hIvasRend->headRotData.headPositions[0],
hIvasRend->hRendererConfig->split_rend_config.splitRendBitRate,
hIvasRend->hRendererConfig->split_rend_config.codec,
@@ -7780,16 +7651,12 @@ void IVAS_REND_Close(
ivas_limiter_close( &hIvasRend->hLimiter );
/* Split binaural rendering */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
if ( hIvasRend->splitRendWrapper != NULL )
{
ISAR_PRE_REND_close( hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
free( hIvasRend->splitRendWrapper );
hIvasRend->splitRendWrapper = NULL;
}
-#else
- ISAR_PRE_REND_close( &hIvasRend->splitRendWrapper, &hIvasRend->splitRendEncBuffer );
-#endif
closeHeadRotation( hIvasRend );
@@ -8437,9 +8304,7 @@ static ivas_error ivas_masa_ext_rend_parambin_init(
int32_t output_Fs;
RENDERER_TYPE renderer_type;
int16_t j, k, bin;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
int16_t num_poses;
-#endif
float binCenterFreq, tmpFloat;
ivas_error error;
float frequency_axis[CLDFB_NO_CHANNELS_MAX];
@@ -8454,7 +8319,6 @@ static ivas_error ivas_masa_ext_rend_parambin_init(
nBins = inputMasa->hMasaExtRend->hSpatParamRendCom->num_freq_bands;
renderer_type = inputMasa->hMasaExtRend->renderer_type;
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
num_poses = 1;
if ( inputMasa->base.ctx.pSplitRendWrapper != NULL )
{
@@ -8462,9 +8326,6 @@ static ivas_error ivas_masa_ext_rend_parambin_init(
}
for ( pos_idx = 0; pos_idx < num_poses; pos_idx++ )
-#else
- for ( pos_idx = 0; pos_idx < inputMasa->base.ctx.pSplitRendWrapper->multiBinPoseData.num_poses; pos_idx++ )
-#endif
{
hDiracDecBin = inputMasa->hMasaExtRend->hDiracDecBin[pos_idx];
diff --git a/lib_rend/lib_rend.h b/lib_rend/lib_rend.h
index 299e4ede26fbe5b9992f4a3749a9d204d1dccca1..5886ad769c74bbcc70ef9953b4105db705ae53d0 100644
--- a/lib_rend/lib_rend.h
+++ b/lib_rend/lib_rend.h
@@ -113,10 +113,8 @@ ivas_error IVAS_REND_Open(
const bool asHrtfBinary, /* i : load hrtf binary file */
const int16_t nonDiegeticPan, /* i : non-diegetic object flag */
const float nonDiegeticPanGain, /* i : non-diegetic panning gain */
-#ifdef FIX_1135_EXT_RENDERER_HANDLES
const int16_t Opt_Headrotation, /* i : indicates whether head-rotation is used */
const int16_t Opt_ExternalOrientation, /* i : indicates whether external orientations are used */
-#endif
const int16_t num_subframes /* i : number of subframes */
);
diff --git a/lib_util/hrtf_file_reader.c b/lib_util/hrtf_file_reader.c
index d893c1d7dec5dd6a4b43bdcba1c98a8be0c6f815..640f2721e68a61972fa020f2ec9b6e009ed2949c 100644
--- a/lib_util/hrtf_file_reader.c
+++ b/lib_util/hrtf_file_reader.c
@@ -32,9 +32,7 @@
#include "hrtf_file_reader.h"
#include
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
#include
-#endif
#include
#include "ivas_prot_rend.h"
#include "ivas_prot.h"
@@ -58,13 +56,6 @@ typedef struct ivas_hrtfs_file_header_t
} ivas_hrtfs_file_header_t;
-#ifndef FIX_POINT_HRTF_FILE_FORMAT
-/*---------------------------------------------------------------------*
- * Local function declarations
- *---------------------------------------------------------------------*/
-
-static void HRTF_energy_sections_precalc( ModelParams_t *model );
-#endif
/*---------------------------------------------------------------------*
* hrtfFileReader_open()
@@ -195,11 +186,7 @@ static ivas_error check_hrtf_binary_header(
/* Check the renderer type */
if ( ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_MIXER_CONV ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM ) &&
( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_FASTCONV ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ) &&
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC ) &&
-#else
- ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM ) &&
-#endif
( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD ) && ( hrtf_header->rend_type != HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ) )
{
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "Header of HRTF binary file not compliant (renderer type)" );
@@ -251,7 +238,6 @@ static ivas_error read_hrtf_binary_header(
return IVAS_ERR_END_OF_FILE;
}
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
/*-------------------------------------------------------------------*
* LoadBSplineBinaryITD()
@@ -407,71 +393,6 @@ static ivas_error LoadBSplineBinaryITD(
return IVAS_ERR_OK;
}
-#else
-/*-------------------------------------------------------------------*
- * LoadBSplineBinaryITD()
- *
- * Loads the B Spline HR filter model ITD data from file.
- --------------------------------------------------------------------*/
-
-static void LoadBSplineBinaryITD(
- ModelParamsITD_t *modelITD, /* i/o: ITD model parameter structure */
- FILE *f_hrtf /* i : HR filter data file handle */
-)
-{
- int16_t tmp;
- fread( &modelITD->elevDim3, sizeof( int16_t ), 1, f_hrtf );
- modelITD->elevKSeq_dyn = (float *) malloc( ( modelITD->elevDim3 - 2 ) * sizeof( float ) );
- fread( modelITD->elevKSeq_dyn, sizeof( float ), modelITD->elevDim3 - 2, f_hrtf );
-
- fread( &modelITD->azimDim3, sizeof( int16_t ), 1, f_hrtf );
- modelITD->azimKSeq_dyn = (float *) malloc( ( ( modelITD->azimDim3 + 1 ) / 2 - 2 ) * sizeof( float ) ); /* basis functions are flipped around 180 deg, number of basis functions above/below is (N+1)/2 */
- fread( modelITD->azimKSeq_dyn, sizeof( float ), ( modelITD->azimDim3 + 1 ) / 2 - 2, f_hrtf );
-
- fread( &tmp, sizeof( int16_t ), 1, f_hrtf );
- modelITD->W_dyn = (float *) malloc( tmp * sizeof( float ) );
- fread( modelITD->W_dyn, sizeof( float ), tmp, f_hrtf );
-
- /* azimuth */
- modelITD->azimBsLen_dyn = (int16_t *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( int16_t ) );
- fread( modelITD->azimBsLen_dyn, sizeof( int16_t ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf );
- modelITD->azimBsStart_dyn = (int16_t *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( int16_t ) );
- fread( modelITD->azimBsStart_dyn, sizeof( int16_t ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf );
-
- fread( &tmp, sizeof( int16_t ), 1, f_hrtf );
-
- modelITD->azimBsShape_dyn = (float *) malloc( tmp * sizeof( float ) );
- fread( modelITD->azimBsShape_dyn, sizeof( float ), tmp, f_hrtf );
-
- fread( &modelITD->azimSegSamples, sizeof( int16_t ), 1, f_hrtf );
-
- /* elevation */
- modelITD->elevBsLen_dyn = (int16_t *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( int16_t ) );
- fread( modelITD->elevBsLen_dyn, sizeof( int16_t ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf );
- modelITD->elevBsStart_dyn = (int16_t *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( int16_t ) );
- fread( modelITD->elevBsStart_dyn, sizeof( int16_t ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf );
-
- fread( &tmp, sizeof( int16_t ), 1, f_hrtf );
-
- modelITD->elevBsShape_dyn = (float *) malloc( tmp * sizeof( float ) );
- fread( modelITD->elevBsShape_dyn, sizeof( float ), tmp, f_hrtf );
-
- fread( &modelITD->elevSegSamples, sizeof( int16_t ), 1, f_hrtf );
-
- modelITD->elevKSeq = (const float *) modelITD->elevKSeq_dyn;
- modelITD->azimKSeq = (const float *) modelITD->azimKSeq_dyn;
- modelITD->W = (const float *) modelITD->W_dyn;
- modelITD->azimBsShape = (const float *) modelITD->azimBsShape_dyn;
- modelITD->elevBsShape = (const float *) modelITD->elevBsShape_dyn;
- modelITD->azimBsLen = (const int16_t *) modelITD->azimBsLen_dyn;
- modelITD->azimBsStart = (const int16_t *) modelITD->azimBsStart_dyn;
- modelITD->elevBsLen = (const int16_t *) modelITD->elevBsLen_dyn;
- modelITD->elevBsStart = (const int16_t *) modelITD->elevBsStart_dyn;
-
- return;
-}
-#endif
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
/*-------------------------------------------------------------------*
* LoadBSplineBinary()
@@ -759,144 +680,6 @@ static ivas_error LoadBSplineBinary(
return IVAS_ERR_OK;
}
-#else
-/*-------------------------------------------------------------------*
- * LoadBSplineBinary()
- *
- * Loads the B Spline HR filter model data from file.
- --------------------------------------------------------------------*/
-
-static ivas_error LoadBSplineBinary(
- IVAS_DEC_HRTF_HANDLE HrFiltSet_p, /* i/o: HR filter model parameter structure */
- FILE *f_hrtf /* i : HR filter data file handle */
-)
-{
- ModelParams_t *model;
- int16_t i, tmp;
-
- fread( &HrFiltSet_p->latency_s, sizeof( float ), 1, f_hrtf );
-
- model = &( HrFiltSet_p->ModelParams );
-
- /* Set ROM flag for correct deallocation */
- model->modelROM = FALSE;
-
- fread( &model->UseItdModel, sizeof( int16_t ), 1, f_hrtf ); /* Indicates if ITD model is active */
- fread( &tmp, sizeof( int16_t ), 1, f_hrtf );
-
- switch ( tmp )
- {
- case 16:
- HrFiltSet_p->SampleRate = 16000;
- if ( HrFiltSet_p->ModelParams.UseItdModel )
- {
- HrFiltSet_p->ModelParamsITD.resamp_factor = RESAMPLE_FACTOR_16_48;
- }
- break;
- case 32:
- HrFiltSet_p->SampleRate = 32000;
- if ( HrFiltSet_p->ModelParams.UseItdModel )
- {
- HrFiltSet_p->ModelParamsITD.resamp_factor = RESAMPLE_FACTOR_32_48;
- }
- break;
- case 48:
- HrFiltSet_p->SampleRate = 48000;
- if ( HrFiltSet_p->ModelParams.UseItdModel )
- {
- HrFiltSet_p->ModelParamsITD.resamp_factor = 1.0f;
- }
- break;
- default:
- return IVAS_ERROR( IVAS_ERR_INVALID_HRTF, "Error: HR filter file had an unsupported sampling rate (%d kHz)", tmp );
- }
-
- fread( &model->K, sizeof( int16_t ), 1, f_hrtf );
- fread( &model->elevDim3, sizeof( int16_t ), 1, f_hrtf );
- model->elevKSeq_dyn = (float *) malloc( ( model->elevDim3 - 2 ) * sizeof( float ) );
- fread( model->elevKSeq_dyn, sizeof( float ), model->elevDim3 - 2, f_hrtf );
- model->azimDim3_dyn = (int16_t *) malloc( model->elevDim3 * sizeof( int16_t ) );
- model->azim_start_idx_dyn = (int16_t *) malloc( model->elevDim3 * sizeof( int16_t ) );
- model->azimKSeq = (float **) malloc( model->elevDim3 * sizeof( float * ) );
- for ( i = 0; i < model->elevDim3; i++ )
- {
- fread( &model->azimDim3_dyn[i], sizeof( int16_t ), 1, f_hrtf );
- fread( &model->azim_start_idx_dyn[i], sizeof( int16_t ), 1, f_hrtf );
- model->azimKSeq[i] = (float *) malloc( ( model->azimDim3_dyn[i] + 1 ) * sizeof( float ) );
- fread( model->azimKSeq[i], sizeof( float ), ( model->azimDim3_dyn[i] + 1 ), f_hrtf );
- }
- fread( &model->AlphaN, sizeof( int16_t ), 1, f_hrtf );
-
- model->AlphaL_dyn = (float *) malloc( model->AlphaN * model->K * sizeof( float ) );
- fread( model->AlphaL_dyn, sizeof( float ), model->AlphaN * model->K, f_hrtf );
-
- model->AlphaR_dyn = (float *) malloc( model->AlphaN * model->K * sizeof( float ) );
- fread( model->AlphaR_dyn, sizeof( float ), model->AlphaN * model->K, f_hrtf );
-
- /* azimuth */
- fread( &model->num_unique_azim_splines, sizeof( int16_t ), 1, f_hrtf );
- model->azimBsShape = (const float **) malloc( model->num_unique_azim_splines * sizeof( float * ) );
- model->azimBsShape_dyn = (float **) malloc( model->num_unique_azim_splines * sizeof( float * ) );
- model->azimSegSamples_dyn = (int16_t *) malloc( model->num_unique_azim_splines * sizeof( int16_t ) );
- for ( i = 0; i < model->num_unique_azim_splines; i++ )
- {
- fread( &tmp, sizeof( int16_t ), 1, f_hrtf );
- model->azimBsShape_dyn[i] = (float *) malloc( tmp * sizeof( float ) );
- fread( model->azimBsShape_dyn[i], sizeof( float ), tmp, f_hrtf );
- fread( &model->azimSegSamples_dyn[i], sizeof( int16_t ), 1, f_hrtf );
- }
-
- model->azimShapeIdx_dyn = (int16_t *) malloc( model->elevDim3 * sizeof( int16_t ) );
- fread( model->azimShapeIdx_dyn, sizeof( int16_t ), model->elevDim3, f_hrtf );
- model->azimShapeSampFactor_dyn = (int16_t *) malloc( model->elevDim3 * sizeof( int16_t ) );
- fread( model->azimShapeSampFactor_dyn, sizeof( int16_t ), model->elevDim3, f_hrtf );
-
- /* elevation */
- model->elevBsLen_dyn = (int16_t *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( int16_t ) );
- fread( model->elevBsLen_dyn, sizeof( int16_t ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf );
- model->elevBsStart_dyn = (int16_t *) malloc( HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( int16_t ) );
- fread( model->elevBsStart_dyn, sizeof( int16_t ), HRTF_MODEL_BSPLINE_NUM_COEFFS, f_hrtf );
- fread( &tmp, sizeof( int16_t ), 1, f_hrtf );
- model->elevBsShape_dyn = (float *) malloc( tmp * sizeof( float ) );
- fread( model->elevBsShape_dyn, sizeof( float ), tmp, f_hrtf );
-
- fread( &model->elevSegSamples, sizeof( int16_t ), 1, f_hrtf );
-
- /* Set const pointers */
- model->AlphaL = (const float *) model->AlphaL_dyn;
- model->AlphaR = (const float *) model->AlphaR_dyn;
- model->EL = (const float *) model->EL_dyn;
- model->ER = (const float *) model->ER_dyn;
- model->elevBsLen = (const int16_t *) model->elevBsLen_dyn;
- model->elevBsStart = (const int16_t *) model->elevBsStart_dyn;
- model->elevBsShape = (const float *) model->elevBsShape_dyn;
- model->elevKSeq = (const float *) model->elevKSeq_dyn;
- model->azimDim3 = (const int16_t *) model->azimDim3_dyn;
- model->azim_start_idx = (const int16_t *) model->azim_start_idx_dyn;
- model->azimSegSamples = (const int16_t *) model->azimSegSamples_dyn;
- model->azimShapeIdx = (const int16_t *) model->azimShapeIdx_dyn;
- model->azimShapeSampFactor = (const int16_t *) model->azimShapeSampFactor_dyn;
-
- for ( i = 0; i < model->num_unique_azim_splines; i++ )
- {
- model->azimBsShape[i] = (const float *) model->azimBsShape_dyn[i];
- }
-
- HRTF_model_precalc( model );
- HRTF_energy_sections_precalc( model );
- HrFiltSet_p->FiltLength = HrFiltSet_p->ModelParams.K;
-
- HrFiltSet_p->ModelEval.hrfModL = (float *) malloc( model->K * sizeof( float ) );
- HrFiltSet_p->ModelEval.hrfModR = (float *) malloc( model->K * sizeof( float ) );
-
- if ( HrFiltSet_p->ModelParams.UseItdModel )
- {
- LoadBSplineBinaryITD( &HrFiltSet_p->ModelParamsITD, f_hrtf );
- }
-
- return IVAS_ERR_OK;
-}
-#endif
/*-------------------------------------------------------------------*
@@ -919,15 +702,10 @@ static ivas_error load_reverb_from_binary(
int32_t hrtf_data_size_max;
char *hrtf_data;
int16_t lr_iac_len;
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
int16_t ind;
Word16 factorQ;
Word16 tmp16;
float factorQ_f;
-#ifndef FIX_POINT_ROM_CONST
- float average_energy;
-#endif
-#endif
if ( hHrtfStatistics == NULL || f_hrtf == NULL )
{
@@ -992,7 +770,6 @@ static ivas_error load_reverb_from_binary(
if ( is_reverb )
{
-#ifdef FIX_POINT_ROM_CONST
hHrtfStatistics->average_energy_l_dyn = (float *) malloc( lr_iac_len * sizeof( float ) );
hHrtfStatistics->average_energy_r_dyn = (float *) malloc( lr_iac_len * sizeof( float ) );
hHrtfStatistics->inter_aural_coherence_dyn = (float *) malloc( lr_iac_len * sizeof( float ) );
@@ -1004,54 +781,23 @@ static ivas_error load_reverb_from_binary(
hHrtfStatistics->average_energy_l = hHrtfStatistics->average_energy_l_dyn;
hHrtfStatistics->average_energy_r = hHrtfStatistics->average_energy_r_dyn;
hHrtfStatistics->inter_aural_coherence = hHrtfStatistics->inter_aural_coherence_dyn;
-#else
- hHrtfStatistics->average_energy_l = (float *) malloc( lr_iac_len * sizeof( float ) );
- hHrtfStatistics->average_energy_r = (float *) malloc( lr_iac_len * sizeof( float ) );
- hHrtfStatistics->inter_aural_coherence = (float *) malloc( lr_iac_len * sizeof( float ) );
-
- if ( hHrtfStatistics->average_energy_l == NULL || hHrtfStatistics->average_energy_r == NULL || hHrtfStatistics->inter_aural_coherence == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" );
- }
-#endif
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
fread( &factorQ, sizeof( Word16 ), 1, f_hrtf );
factorQ_f = powf( 2.f, -1.f * factorQ );
for ( ind = 0; ind < lr_iac_len; ind++ )
{
fread( &tmp16, sizeof( Word16 ), 1, f_hrtf );
-#ifdef FIX_POINT_ROM_CONST
hHrtfStatistics->average_energy_l_dyn[ind] = factorQ_f * tmp16;
-#else
- average_energy = factorQ_f * tmp16;
- memcpy( (float *) &hHrtfStatistics->average_energy_l[ind], &average_energy, sizeof( float ) );
-#endif
}
for ( ind = 0; ind < lr_iac_len; ind++ )
{
fread( &tmp16, sizeof( Word16 ), 1, f_hrtf );
-#ifdef FIX_POINT_ROM_CONST
hHrtfStatistics->average_energy_r_dyn[ind] = factorQ_f * tmp16;
-#else
- average_energy = factorQ_f * tmp16;
- memcpy( (float *) &hHrtfStatistics->average_energy_r[ind], &average_energy, sizeof( float ) );
-#endif
}
for ( ind = 0; ind < lr_iac_len; ind++ )
{
fread( &tmp16, sizeof( Word16 ), 1, f_hrtf );
-#ifdef FIX_POINT_ROM_CONST
hHrtfStatistics->inter_aural_coherence_dyn[ind] = factorQ_f * tmp16;
-#else
- average_energy = factorQ_f * tmp16;
- memcpy( (float *) &hHrtfStatistics->inter_aural_coherence[ind], &average_energy, sizeof( float ) );
-#endif
}
-#else
- fread( hHrtfStatistics->average_energy_l, sizeof( const float ), lr_iac_len, f_hrtf );
- fread( hHrtfStatistics->average_energy_r, sizeof( const float ), lr_iac_len, f_hrtf );
- fread( hHrtfStatistics->inter_aural_coherence, sizeof( const float ), lr_iac_len, f_hrtf );
-#endif
hHrtfStatistics->fromROM = FALSE;
}
@@ -1226,64 +972,6 @@ ivas_error load_HRTF_binary(
return TDREND_MIX_LoadHRTF( hrtfReader->file, hHrtf );
}
-#ifndef FIX_POINT_HRTF_FILE_FORMAT
-/*---------------------------------------------------------------------*
- * HRTF_energy_sections_precalc()
- *
- * Calculate energies of each section and store in model->EL/model->ER
- *---------------------------------------------------------------------*/
-static void HRTF_energy_sections_precalc(
- ModelParams_t *model /* i/o: HRTF model parameters */
-)
-{
- int16_t i, k, j;
- float *pEL;
- float *pER;
- const float *pAlphaL;
- const float *pAlphaR;
- float tmp;
- int16_t AlphaN;
-
- if ( !model->modelROM )
- {
- AlphaN = model->AlphaN;
-
- /* Precalculated energies for each section and each row of the alpha matrices */
- model->EL_dyn = (float *) malloc( HRTF_MODEL_N_SECTIONS * AlphaN * sizeof( float ) );
- model->ER_dyn = (float *) malloc( HRTF_MODEL_N_SECTIONS * AlphaN * sizeof( float ) );
- pEL = model->EL_dyn;
- pER = model->ER_dyn;
- for ( i = 0; i < HRTF_MODEL_N_SECTIONS; i++ )
- {
- for ( j = 0; j < AlphaN; j++ ) /* rows of Alpha matrices */
- {
- *pEL = 0.0f;
- *pER = 0.0f;
-
- pAlphaL = &model->AlphaL[model->iSecFirst[i] * AlphaN + j];
- pAlphaR = &model->AlphaR[model->iSecFirst[i] * AlphaN + j];
-
- for ( k = model->iSecFirst[i]; k < model->iSecLast[i]; k++ ) /* k within the sections */
- {
- /* Energy calculation */
- tmp = *pAlphaL;
- *pEL += tmp * tmp;
- tmp = *pAlphaR;
- *pER += tmp * tmp;
- pAlphaL += AlphaN;
- pAlphaR += AlphaN;
- }
- pEL++;
- pER++;
- }
- }
- model->EL = (const float *) model->EL_dyn;
- model->ER = (const float *) model->ER_dyn;
- }
-
- return;
-}
-#endif
/*---------------------------------------------------------------------*
* destroy_td_hrtf()
@@ -1354,7 +1042,6 @@ void destroy_td_hrtf(
return;
}
-#ifndef FIX_POINT_HRTF_FILE_FORMAT
/*---------------------------------------------------------------------*
* create_HRTF_from_rawdata()
@@ -1369,15 +1056,12 @@ static ivas_error create_HRTF_from_rawdata(
{
int16_t i, j, k;
int16_t max_num_iterations_diffuse;
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
uint32_t max_total_num_fsamp_per_iteration, max_total_num_fsamp_per_iteration_diff;
-#else
- uint16_t max_total_num_fsamp_per_iteration, max_total_num_fsamp_per_iteration_diff;
-#endif
- uint32_t mem_size;
+ uint32_t mem_size, l;
char *hrtf_data_rptr;
float *pOut_to_bin_wptr;
ivas_error error;
+ Word16 factorQ;
if ( *hHRTF == NULL )
{
@@ -1396,12 +1080,21 @@ static ivas_error create_HRTF_from_rawdata(
return IVAS_ERR_INTERNAL;
}
+ if ( hrtf_data == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
( *hHRTF )->init_from_rom = 0;
hrtf_data_rptr = hrtf_data;
+ /* latency_s Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+
/* latency_s */
- ( *hHRTF )->latency_s = *( (float *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( float );
+ ( *hHRTF )->latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
+ hrtf_data_rptr += sizeof( Word32 );
/* max_num_ir */
( *hHRTF )->max_num_ir = *( (uint16_t *) ( hrtf_data_rptr ) );
@@ -1434,12 +1127,13 @@ static ivas_error create_HRTF_from_rawdata(
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
mem_size = ( *hHRTF )->max_num_iterations * sizeof( uint16_t );
- ( *hHRTF )->pIndex_frequency_max[i][j] = (uint16_t *) malloc( mem_size );
- if ( ( *hHRTF )->pIndex_frequency_max[i][j] == NULL )
+ ( *hHRTF )->pIndex_frequency_max_dyn[i][j] = (uint16_t *) malloc( mem_size );
+ if ( ( *hHRTF )->pIndex_frequency_max_dyn[i][j] == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max" );
}
- memcpy( ( *hHRTF )->pIndex_frequency_max[i][j], hrtf_data_rptr, mem_size );
+ memcpy( ( *hHRTF )->pIndex_frequency_max_dyn[i][j], hrtf_data_rptr, mem_size );
+ ( *hHRTF )->pIndex_frequency_max[i][j] = ( *hHRTF )->pIndex_frequency_max_dyn[i][j];
hrtf_data_rptr += mem_size;
}
}
@@ -1461,12 +1155,13 @@ static ivas_error create_HRTF_from_rawdata(
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
mem_size = ( *hHRTF )->num_iterations_diffuse[j] * sizeof( uint16_t );
- ( *hHRTF )->pIndex_frequency_max_diffuse[j] = (uint16_t *) malloc( mem_size );
- if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] == NULL )
+ ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j] = (uint16_t *) malloc( mem_size );
+ if ( ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j] == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max_diffuse" );
}
- memcpy( ( *hHRTF )->pIndex_frequency_max_diffuse[j], hrtf_data_rptr, mem_size );
+ memcpy( ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j], hrtf_data_rptr, mem_size );
+ ( *hHRTF )->pIndex_frequency_max_diffuse[j] = ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j];
hrtf_data_rptr += mem_size;
}
}
@@ -1475,26 +1170,28 @@ static ivas_error create_HRTF_from_rawdata(
( *hHRTF )->index_frequency_max_diffuse = *( (uint16_t *) ( hrtf_data_rptr ) );
hrtf_data_rptr += sizeof( uint16_t );
+ /* inv_diffuse_weight Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+
/* inv_diffuse_weight */
for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
{
- ( *hHRTF )->inv_diffuse_weight[0][i] = *( (float *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( float );
+ ( *hHRTF )->inv_diffuse_weight[0][i] = ( *( (Word16 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
+ hrtf_data_rptr += sizeof( Word16 );
}
+
for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
{
- ( *hHRTF )->inv_diffuse_weight[1][i] = *( (float *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( float );
+ ( *hHRTF )->inv_diffuse_weight[1][i] = ( *( (Word16 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
+ hrtf_data_rptr += sizeof( Word16 );
}
/* max_total_num_fsamp_per_iteration */
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
max_total_num_fsamp_per_iteration = *( (uint32_t *) ( hrtf_data_rptr ) );
hrtf_data_rptr += sizeof( uint32_t );
-#else
- max_total_num_fsamp_per_iteration = *( (uint16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint16_t );
-#endif
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
/* coeff_re (the size depends on pIndex_frequency_max) */
for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
@@ -1502,18 +1199,23 @@ static ivas_error create_HRTF_from_rawdata(
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
mem_size = max_total_num_fsamp_per_iteration * sizeof( float );
- ( *hHRTF )->pOut_to_bin_re[i][j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_re[i][j] == NULL )
+ ( *hHRTF )->pOut_to_bin_re_dyn[i][j] = (float *) malloc( mem_size );
+ if ( ( *hHRTF )->pOut_to_bin_re_dyn[i][j] == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_re" );
}
- memset( ( *hHRTF )->pOut_to_bin_re[i][j], 0x00, mem_size );
+ memset( ( *hHRTF )->pOut_to_bin_re_dyn[i][j], 0x00, mem_size );
+ ( *hHRTF )->pOut_to_bin_re[i][j] = ( *hHRTF )->pOut_to_bin_re_dyn[i][j];
+ pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_re_dyn[i][j];
- pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_re[i][j];
for ( k = 0; k < ( *hHRTF )->num_iterations[i][j]; k++ )
{
- mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( float );
- memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size );
+ mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( int16_t );
+ Word16 *ptW = (Word16 *) hrtf_data_rptr;
+ for ( l = 0; l < ( *hHRTF )->pIndex_frequency_max[i][j][k]; l++ )
+ {
+ pOut_to_bin_wptr[l] = ptW[l] * powf( 2.f, -1.f * factorQ );
+ }
hrtf_data_rptr += mem_size;
pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max[i][j][k];
}
@@ -1526,18 +1228,23 @@ static ivas_error create_HRTF_from_rawdata(
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
mem_size = max_total_num_fsamp_per_iteration * sizeof( float );
- ( *hHRTF )->pOut_to_bin_im[i][j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_im[i][j] == NULL )
+ ( *hHRTF )->pOut_to_bin_im_dyn[i][j] = (float *) malloc( mem_size );
+ if ( ( *hHRTF )->pOut_to_bin_im_dyn[i][j] == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_im" );
}
- memset( ( *hHRTF )->pOut_to_bin_im[i][j], 0x00, mem_size );
+ memset( ( *hHRTF )->pOut_to_bin_im_dyn[i][j], 0x00, mem_size );
+ ( *hHRTF )->pOut_to_bin_im[i][j] = ( *hHRTF )->pOut_to_bin_im_dyn[i][j];
- pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_im[i][j];
+ pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_im_dyn[i][j];
for ( k = 0; k < ( *hHRTF )->num_iterations[i][j]; k++ )
{
- mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( float );
- memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size );
+ mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( int16_t );
+ Word16 *ptW = (Word16 *) hrtf_data_rptr;
+ for ( l = 0; l < ( *hHRTF )->pIndex_frequency_max[i][j][k]; l++ )
+ {
+ pOut_to_bin_wptr[l] = ptW[l] * powf( 2.f, -1.f * factorQ );
+ }
hrtf_data_rptr += mem_size;
pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max[i][j][k];
}
@@ -1545,1414 +1252,76 @@ static ivas_error create_HRTF_from_rawdata(
}
/* max_total_num_fsamp_per_iteration_diff */
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
max_total_num_fsamp_per_iteration_diff = *( (uint32_t *) ( hrtf_data_rptr ) );
hrtf_data_rptr += sizeof( uint32_t );
-#else
- max_total_num_fsamp_per_iteration_diff = *( (uint16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint16_t );
-#endif
if ( max_total_num_fsamp_per_iteration_diff != 0 )
{
+ /* factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); */
+ /* hrtf_data_rptr += sizeof( Word16 ); */
/* coeff_diffuse_re : The size depends on pIndex_frequency_max_diffuse */
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float );
- ( *hHRTF )->pOut_to_bin_diffuse_re[j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] == NULL )
+ ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j] = (float *) malloc( mem_size );
+ if ( ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j] == NULL )
{
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_re" );
}
- memset( ( *hHRTF )->pOut_to_bin_diffuse_re[j], 0x00, mem_size );
-
- pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_re[j];
- for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ )
- {
- mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( float );
- memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size );
- hrtf_data_rptr += mem_size;
- pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k];
- }
- }
+ memset( ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j], 0x00, mem_size );
+ ( *hHRTF )->pOut_to_bin_diffuse_re[j] = ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j];
- /* coeff_diffuse_im : The size depends on pIndex_frequency_max_diffuse */
- for ( j = 0; j < BINAURAL_CHANNELS; j++ )
- {
- mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float );
- ( *hHRTF )->pOut_to_bin_diffuse_im[j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_im" );
- }
- memset( ( *hHRTF )->pOut_to_bin_diffuse_im[j], 0x00, mem_size );
+ pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j];
- pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_im[j];
for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ )
{
- mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( float );
- memcpy( pOut_to_bin_wptr, hrtf_data_rptr, mem_size );
- hrtf_data_rptr += mem_size;
- pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k];
- }
- }
- }
-
- return IVAS_ERR_OK;
-}
-
-#else
-
-/*---------------------------------------------------------------------*
- * create_HRTF_from_rawdata()
- *
- * Create HRTF from the raw data (to the HRTF CRend handle)
- *---------------------------------------------------------------------*/
-
-static ivas_error create_HRTF_from_rawdata(
- HRTFS_HANDLE *hHRTF, /* i/o: HRTF CRend handle */
- char *hrtf_data /* i : pointer to binary file */
-)
-{
- int16_t i, j, k;
- int16_t max_num_iterations_diffuse;
- uint32_t max_total_num_fsamp_per_iteration, max_total_num_fsamp_per_iteration_diff;
- uint32_t mem_size, l;
- char *hrtf_data_rptr;
- float *pOut_to_bin_wptr;
- ivas_error error;
- Word16 factorQ;
-
- if ( *hHRTF == NULL )
- {
- if ( ( ( *hHRTF ) = (HRTFS_HANDLE) malloc( sizeof( HRTFS_DATA ) ) ) == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for HRTF binary data\n" );
- }
-
- if ( ( error = ivas_hrtf_init( *hHRTF ) ) != IVAS_ERR_OK )
- {
- return error;
- }
- }
- else
- {
- return IVAS_ERR_INTERNAL;
- }
-
- if ( hrtf_data == NULL )
- {
- return IVAS_ERR_UNEXPECTED_NULL_POINTER;
- }
-
- ( *hHRTF )->init_from_rom = 0;
- hrtf_data_rptr = hrtf_data;
-
- /* latency_s Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* latency_s */
- ( *hHRTF )->latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word32 );
-
- /* max_num_ir */
- ( *hHRTF )->max_num_ir = *( (uint16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* BINAURAL_CHANNELS */
- if ( BINAURAL_CHANNELS != *( (int16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file format not compliant (BINAURAL_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* max_num_iterations */
- ( *hHRTF )->max_num_iterations = *( (int16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( int16_t );
-
- /* num_iterations */
- for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
- {
- for ( j = 0; j < BINAURAL_CHANNELS; j++ )
- {
- ( *hHRTF )->num_iterations[i][j] = *( (uint16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint16_t );
- }
- }
-
- /* pIndex_frequency_max */
- for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
- {
- for ( j = 0; j < BINAURAL_CHANNELS; j++ )
- {
- mem_size = ( *hHRTF )->max_num_iterations * sizeof( uint16_t );
-#ifdef FIX_POINT_ROM_CONST
- ( *hHRTF )->pIndex_frequency_max_dyn[i][j] = (uint16_t *) malloc( mem_size );
- if ( ( *hHRTF )->pIndex_frequency_max_dyn[i][j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max" );
- }
- memcpy( ( *hHRTF )->pIndex_frequency_max_dyn[i][j], hrtf_data_rptr, mem_size );
- ( *hHRTF )->pIndex_frequency_max[i][j] = ( *hHRTF )->pIndex_frequency_max_dyn[i][j];
-#else
- ( *hHRTF )->pIndex_frequency_max[i][j] = (uint16_t *) malloc( mem_size );
- if ( ( *hHRTF )->pIndex_frequency_max[i][j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max" );
- }
- memcpy( (uint16_t *) ( *hHRTF )->pIndex_frequency_max[i][j], hrtf_data_rptr, mem_size );
-#endif
- hrtf_data_rptr += mem_size;
- }
- }
-
- /* max_num_iterations_diffuse */
- max_num_iterations_diffuse = *( (int16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( int16_t );
-
- if ( max_num_iterations_diffuse != 0 )
- {
- /* num_iterations_diffuse */
- for ( j = 0; j < BINAURAL_CHANNELS; j++ )
- {
- ( *hHRTF )->num_iterations_diffuse[j] = *( (uint16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint16_t );
- }
-
- /* pIndex_frequency_max_diffuse (the size depends on num_iterations_diffuse) */
- for ( j = 0; j < BINAURAL_CHANNELS; j++ )
- {
- mem_size = ( *hHRTF )->num_iterations_diffuse[j] * sizeof( uint16_t );
-#ifdef FIX_POINT_ROM_CONST
- ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j] = (uint16_t *) malloc( mem_size );
- if ( ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max_diffuse" );
- }
- memcpy( ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j], hrtf_data_rptr, mem_size );
- ( *hHRTF )->pIndex_frequency_max_diffuse[j] = ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j];
-#else
- ( *hHRTF )->pIndex_frequency_max_diffuse[j] = (uint16_t *) malloc( mem_size );
- if ( (uint16_t *) ( *hHRTF )->pIndex_frequency_max_diffuse[j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pIndex_frequency_max_diffuse" );
- }
- memcpy( (uint16_t *) ( *hHRTF )->pIndex_frequency_max_diffuse[j], hrtf_data_rptr, mem_size );
-#endif
- hrtf_data_rptr += mem_size;
- }
- }
-
- /* index_frequency_max_diffuse */
- ( *hHRTF )->index_frequency_max_diffuse = *( (uint16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* inv_diffuse_weight Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* inv_diffuse_weight */
- for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
- {
- ( *hHRTF )->inv_diffuse_weight[0][i] = ( *( (Word16 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word16 );
- }
-
- for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
- {
- ( *hHRTF )->inv_diffuse_weight[1][i] = ( *( (Word16 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word16 );
- }
-
- /* max_total_num_fsamp_per_iteration */
- max_total_num_fsamp_per_iteration = *( (uint32_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint32_t );
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* coeff_re (the size depends on pIndex_frequency_max) */
- for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
- {
- for ( j = 0; j < BINAURAL_CHANNELS; j++ )
- {
- mem_size = max_total_num_fsamp_per_iteration * sizeof( float );
-#ifdef FIX_POINT_ROM_CONST
- ( *hHRTF )->pOut_to_bin_re_dyn[i][j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_re_dyn[i][j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_re" );
- }
- memset( ( *hHRTF )->pOut_to_bin_re_dyn[i][j], 0x00, mem_size );
- ( *hHRTF )->pOut_to_bin_re[i][j] = ( *hHRTF )->pOut_to_bin_re_dyn[i][j];
- pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_re_dyn[i][j];
-#else
- ( *hHRTF )->pOut_to_bin_re[i][j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_re[i][j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_re" );
- }
- memset( (float *) ( *hHRTF )->pOut_to_bin_re[i][j], 0x00, mem_size );
-
- pOut_to_bin_wptr = (float *) ( *hHRTF )->pOut_to_bin_re[i][j];
-#endif
-
- for ( k = 0; k < ( *hHRTF )->num_iterations[i][j]; k++ )
- {
-#ifdef FIX_1123_CREND_16BIT_FMT
- mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( int16_t );
+ mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( int16_t );
Word16 *ptW = (Word16 *) hrtf_data_rptr;
-#else
- mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( int32_t );
- Word32 *ptW = (Word32 *) hrtf_data_rptr;
-#endif
- for ( l = 0; l < ( *hHRTF )->pIndex_frequency_max[i][j][k]; l++ )
+ for ( l = 0; l < ( *hHRTF )->pIndex_frequency_max_diffuse[j][k]; l++ )
{
pOut_to_bin_wptr[l] = ptW[l] * powf( 2.f, -1.f * factorQ );
}
hrtf_data_rptr += mem_size;
- pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max[i][j][k];
+ pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k];
}
}
- }
- /* coeff_im (the size depends on pIndex_frequency_max) */
- for ( i = 0; i < ( *hHRTF )->max_num_ir; i++ )
- {
+ /* coeff_diffuse_im : The size depends on pIndex_frequency_max_diffuse */
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
- mem_size = max_total_num_fsamp_per_iteration * sizeof( float );
-#ifdef FIX_POINT_ROM_CONST
- ( *hHRTF )->pOut_to_bin_im_dyn[i][j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_im_dyn[i][j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_im" );
- }
- memset( ( *hHRTF )->pOut_to_bin_im_dyn[i][j], 0x00, mem_size );
- ( *hHRTF )->pOut_to_bin_im[i][j] = ( *hHRTF )->pOut_to_bin_im_dyn[i][j];
-
- pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_im_dyn[i][j];
-#else
- ( *hHRTF )->pOut_to_bin_im[i][j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_im[i][j] == NULL )
+ mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float );
+ ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j] = (float *) malloc( mem_size );
+ if ( ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j] == NULL )
{
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for Out_to_bin_im" );
+ return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_im" );
}
- memset( (float *) ( *hHRTF )->pOut_to_bin_im[i][j], 0x00, mem_size );
+ memset( ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j], 0x00, mem_size );
+ ( *hHRTF )->pOut_to_bin_diffuse_im[j] = ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j];
- pOut_to_bin_wptr = (float *) ( *hHRTF )->pOut_to_bin_im[i][j];
-#endif
- for ( k = 0; k < ( *hHRTF )->num_iterations[i][j]; k++ )
+ pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j];
+ for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
- mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( int16_t );
+ mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( int16_t );
Word16 *ptW = (Word16 *) hrtf_data_rptr;
-#else
- mem_size = ( *hHRTF )->pIndex_frequency_max[i][j][k] * sizeof( int32_t );
- Word32 *ptW = (Word32 *) hrtf_data_rptr;
-#endif
- for ( l = 0; l < ( *hHRTF )->pIndex_frequency_max[i][j][k]; l++ )
+ for ( l = 0; l < ( *hHRTF )->pIndex_frequency_max_diffuse[j][k]; l++ )
{
pOut_to_bin_wptr[l] = ptW[l] * powf( 2.f, -1.f * factorQ );
}
hrtf_data_rptr += mem_size;
- pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max[i][j][k];
+ pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k];
}
}
}
- /* max_total_num_fsamp_per_iteration_diff */
- max_total_num_fsamp_per_iteration_diff = *( (uint32_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint32_t );
-
- if ( max_total_num_fsamp_per_iteration_diff != 0 )
- {
- /* factorQ = *( (Word16 *) ( hrtf_data_rptr ) ); */
- /* hrtf_data_rptr += sizeof( Word16 ); */
- /* coeff_diffuse_re : The size depends on pIndex_frequency_max_diffuse */
- for ( j = 0; j < BINAURAL_CHANNELS; j++ )
- {
- mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float );
-#ifdef FIX_POINT_ROM_CONST
- ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_re" );
- }
- memset( ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j], 0x00, mem_size );
- ( *hHRTF )->pOut_to_bin_diffuse_re[j] = ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j];
-
- pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_re_dyn[j];
-#else
- ( *hHRTF )->pOut_to_bin_diffuse_re[j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_re" );
- }
- memset( (uint16_t *) ( *hHRTF )->pOut_to_bin_diffuse_re[j], 0x00, mem_size );
-
- pOut_to_bin_wptr = (float *) ( *hHRTF )->pOut_to_bin_diffuse_re[j];
-#endif
-
- for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ )
- {
-#ifdef FIX_1123_CREND_16BIT_FMT
- mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( int16_t );
- Word16 *ptW = (Word16 *) hrtf_data_rptr;
-#else
- mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( int32_t );
- Word32 *ptW = (Word32 *) hrtf_data_rptr;
-#endif
- for ( l = 0; l < ( *hHRTF )->pIndex_frequency_max_diffuse[j][k]; l++ )
- {
- pOut_to_bin_wptr[l] = ptW[l] * powf( 2.f, -1.f * factorQ );
- }
- hrtf_data_rptr += mem_size;
- pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k];
- }
- }
-
- /* coeff_diffuse_im : The size depends on pIndex_frequency_max_diffuse */
- for ( j = 0; j < BINAURAL_CHANNELS; j++ )
- {
- mem_size = max_total_num_fsamp_per_iteration_diff * sizeof( float );
-#ifdef FIX_POINT_ROM_CONST
- ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_im" );
- }
- memset( ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j], 0x00, mem_size );
- ( *hHRTF )->pOut_to_bin_diffuse_im[j] = ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j];
-
- pOut_to_bin_wptr = ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j];
-#else
- ( *hHRTF )->pOut_to_bin_diffuse_im[j] = (float *) malloc( mem_size );
- if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] == NULL )
- {
- return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for pOut_to_bin_diffuse_im" );
- }
- memset( (uint16_t *) ( *hHRTF )->pOut_to_bin_diffuse_im[j], 0x00, mem_size );
-
- pOut_to_bin_wptr = (float *) ( *hHRTF )->pOut_to_bin_diffuse_im[j];
-#endif
- for ( k = 0; k < ( *hHRTF )->num_iterations_diffuse[j]; k++ )
- {
-#ifdef FIX_1123_CREND_16BIT_FMT
- mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( int16_t );
- Word16 *ptW = (Word16 *) hrtf_data_rptr;
-#else
- mem_size = ( *hHRTF )->pIndex_frequency_max_diffuse[j][k] * sizeof( int32_t );
- Word32 *ptW = (Word32 *) hrtf_data_rptr;
-#endif
- for ( l = 0; l < ( *hHRTF )->pIndex_frequency_max_diffuse[j][k]; l++ )
- {
- pOut_to_bin_wptr[l] = ptW[l] * powf( 2.f, -1.f * factorQ );
- }
- hrtf_data_rptr += mem_size;
- pOut_to_bin_wptr += ( *hHRTF )->pIndex_frequency_max_diffuse[j][k];
- }
- }
- }
-
- return IVAS_ERR_OK;
-}
-
-
-/*---------------------------------------------------------------------*
- * create_fastconv_HRTF_from_rawdata()
- *
- * Create HRTF from the raw data (to the HRTF FastConv handle)
- *---------------------------------------------------------------------*/
-
-static ivas_error create_fastconv_HRTF_from_rawdata(
- HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */
- char *hrtf_data, /* i : pointer to binary file */
- HRTF_READER_RENDERER_TYPE rend_type, /* i : Renderer type */
- BINAURAL_INPUT_AUDIO_CONFIG input_cfg /* i : Input binaural config */
-)
-{
- int16_t i, j, k;
- char *hrtf_data_rptr;
- ivas_error error;
- Word16 factorQ;
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- float scaleFactor;
- int16_t *ptW16;
- float latency_s;
- uint16_t ntaps;
- uint16_t nbchan;
-#else
- int32_t *ptW32;
-#endif
-
- if ( hrtf_data == NULL )
- {
- return IVAS_ERR_UNEXPECTED_NULL_POINTER;
- }
-
- ( *hHRTF )->allocate_init_flag = 0;
-
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr = hrtf_data;
-
- /* latency_s Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* latency_s */
- latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word32 );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- nbchan = *( (uint16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint16_t );
-
- ntaps = *( (uint16_t *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
- {
- if ( HRTF_LS_CHANNELS != nbchan )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" );
- }
- ( *hHRTF )->ntaps_hrir = ntaps;
- ( *hHRTF )->FASTCONV_HRIR_latency_s = latency_s;
- }
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 )
- {
- if ( HOA3_CHANNELS != nbchan )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" );
- }
- ( *hHRTF )->ntaps_hrir_hoa3 = ntaps;
- ( *hHRTF )->FASTCONV_HOA3_latency_s = latency_s;
- }
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 )
- {
- if ( HOA2_CHANNELS != nbchan )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" );
- }
- ( *hHRTF )->ntaps_hrir_hoa2 = ntaps;
- ( *hHRTF )->FASTCONV_HOA2_latency_s = latency_s;
- }
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA )
- {
- if ( FOA_CHANNELS != nbchan )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" );
- }
- ( *hHRTF )->ntaps_hrir_foa = ntaps;
- ( *hHRTF )->FASTCONV_FOA_latency_s = latency_s;
- }
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
- {
- if ( HRTF_LS_CHANNELS != nbchan )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" );
- }
- ( *hHRTF )->ntaps_brir = ntaps;
- ( *hHRTF )->FASTCONV_BRIR_latency_s = latency_s;
- }
- else
- {
- return IVAS_ERROR( IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT, "Can not read hrtf binary file : wrong render type and input config couple " );
- }
-#else
- if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" );
- }
-#endif
-
- if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV )
- {
- if ( ( error = ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK )
- {
- return error;
- }
- }
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM )
- {
- if ( ( error = ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV_ROOM, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK )
- {
- return error;
- }
- }
- else
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "renderer type not compliant" );
- }
-#ifndef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr = hrtf_data;
-#endif
- /* HRIR */
- if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
- {
-#ifndef FIX_1123_FASTCONV_16BIT_FMT
- /* latency_s Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* latency_s */
- ( *hHRTF )->FASTCONV_HRIR_latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word32 );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-#endif
-
- /* HRIR Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- scaleFactor = powf( 2.f, -1.f * factorQ );
-#endif
-
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftHRIRReal[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftHRIRReal[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftHRIRImag[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftHRIRImag[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightHRIRReal[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightHRIRReal[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightHRIRImag[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightHRIRImag[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS * sizeof( int32_t );
-#endif
- }
- }
- }
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 )
- {
-#ifndef FIX_1123_FASTCONV_16BIT_FMT
- /* latency_s Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* latency_s */
- ( *hHRTF )->FASTCONV_HOA3_latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word32 );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( HOA3_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-#endif
-
- /* HRIR Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- scaleFactor = powf( 2.f, -1.f * factorQ );
-#endif
-
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HOA3_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa3; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftHRIRReal_HOA3[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftHRIRReal_HOA3[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa3 * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HOA3_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa3; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftHRIRImag_HOA3[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftHRIRImag_HOA3[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa3 * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HOA3_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa3; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightHRIRReal_HOA3[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightHRIRReal_HOA3[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa3 * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HOA3_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa3; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightHRIRImag_HOA3[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightHRIRImag_HOA3[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa3 * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- }
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 )
- {
-#ifndef FIX_1123_FASTCONV_16BIT_FMT
- /* latency_s Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* latency_s */
- ( *hHRTF )->FASTCONV_HOA2_latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word32 );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( HOA2_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
- if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-#endif
-
- /* HRIR Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- scaleFactor = powf( 2.f, -1.f * factorQ );
-#endif
-
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HOA2_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa2; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftHRIRReal_HOA2[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftHRIRReal_HOA2[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa2 * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HOA2_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa2; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftHRIRImag_HOA2[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftHRIRImag_HOA2[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa2 * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HOA2_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa2; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightHRIRReal_HOA2[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightHRIRReal_HOA2[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa2 * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HOA2_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa2; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightHRIRImag_HOA2[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightHRIRImag_HOA2[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa2 * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- }
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA )
- {
-#ifndef FIX_1123_FASTCONV_16BIT_FMT
- /* latency_s Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* latency_s */
- ( *hHRTF )->FASTCONV_FOA_latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word32 );
-
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( FOA_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-#endif
-
- /* HRIR Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- scaleFactor = powf( 2.f, -1.f * factorQ );
-#endif
-
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < FOA_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_foa; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftHRIRReal_FOA[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftHRIRReal_FOA[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_foa * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < FOA_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_foa; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftHRIRImag_FOA[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftHRIRImag_FOA[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_foa * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < FOA_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_foa; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightHRIRReal_FOA[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightHRIRReal_FOA[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_foa * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < FOA_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_hrir_foa; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_SBA; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightHRIRImag_FOA[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightHRIRImag_FOA[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_foa * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( int32_t );
-#endif
- }
- }
- }
- /* BRIR */
- else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
- {
-#ifndef FIX_1123_FASTCONV_16BIT_FMT
- /* latency_s Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-
- /* latency_s */
- ( *hHRTF )->FASTCONV_BRIR_latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
- hrtf_data_rptr += sizeof( Word32 );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-#endif
-
- /* BRIR Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- scaleFactor = powf( 2.f, -1.f * factorQ );
-#endif
-
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_brir; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_MAX; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftBRIRReal[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftBRIRReal[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_brir * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_brir; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_MAX; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->leftBRIRImag[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->leftBRIRImag[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_brir * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_brir; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_MAX; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightBRIRReal[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightBRIRReal[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_brir * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( int32_t );
-#endif
- }
- }
- for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
- {
- for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ptW16 = (Word16 *) hrtf_data_rptr;
- for ( k = 0; k < ( *hHRTF )->ntaps_brir; k++ )
-#else
- ptW32 = (Word32 *) hrtf_data_rptr;
- for ( k = 0; k < BINAURAL_NTAPS_MAX; k++ )
-#endif
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->rightBRIRImag[i][j][k] = ptW16[k] * scaleFactor;
-#else
- ( *hHRTF )->rightBRIRImag[i][j][k] = (float) ptW32[k] * powf( 2.f, -1.f * (float) factorQ );
-#endif
- }
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- hrtf_data_rptr += ( *hHRTF )->ntaps_brir * sizeof( Word16 );
-#else
- hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( int32_t );
-#endif
- }
- }
-
- /* Reverb Parameters */
- if ( CLDFB_NO_CHANNELS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (CLDFB_NO_CHANNELS_MAX)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* fastconvReverberationTimes Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- scaleFactor = powf( 2.f, -1.f * factorQ );
-#endif
-
- ptW16 = (int16_t *) hrtf_data_rptr;
- for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->fastconvReverberationTimes[j] = ptW16[j] * powf( 2.f, -1.f * factorQ );
-#else
- ( *hHRTF )->fastconvReverberationTimes[j] = (float) ptW16[j] * scaleFactor;
-#endif
- }
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
-
- /* fastconvReverberationEneCorrections Q factor */
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- scaleFactor = powf( 2.f, -1.f * factorQ );
-#endif
-
- ptW16 = (int16_t *) hrtf_data_rptr;
- for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
- {
-#ifdef FIX_1123_FASTCONV_16BIT_FMT
- ( *hHRTF )->fastconvReverberationEneCorrections[j] = ptW16[j] * powf( 2.f, -1.f * factorQ );
-#else
- ( *hHRTF )->fastconvReverberationEneCorrections[j] = (float) ptW16[j] * scaleFactor;
-#endif
- }
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
- }
-
- return IVAS_ERR_OK;
-}
-
-
-/*---------------------------------------------------------------------*
- * create_parambin_HRTF_from_rawdata()
- *
- *
- *---------------------------------------------------------------------*/
-
-static ivas_error create_parambin_HRTF_from_rawdata(
- HRTFS_PARAMBIN_HANDLE *hHRTF, /* i/o: Parametric binauralizer HRTF handle */
- char *hrtf_data /* i : pointer to binary file */
-)
-{
- int16_t i, j, k;
- char *hrtf_data_rptr;
- uint32_t data_size_tmp;
- Word16 factorQ;
- int16_t *ptW16;
- float scaler;
-
- if ( hrtf_data == NULL )
- {
- return IVAS_ERR_UNEXPECTED_NULL_POINTER;
- }
-
- hrtf_data_rptr = hrtf_data;
-
- /* HRTF_SH_CHANNELS */
- if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* HRTF_NUM_BINS */
- if ( HRTF_NUM_BINS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_NUM_BINS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* HRTF */
- /* Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
- scaler = powf( 2.f, -1.f * factorQ );
-
- data_size_tmp = HRTF_NUM_BINS * sizeof( int16_t );
- for ( i = 0; i < BINAURAL_CHANNELS; i++ )
- {
- for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
- {
- ptW16 = (int16_t *) hrtf_data_rptr;
- for ( k = 0; k < HRTF_NUM_BINS; k++ )
- {
- ( *hHRTF )->hrtfShCoeffsRe[i][j][k] = ptW16[k] * scaler;
- }
- hrtf_data_rptr += data_size_tmp;
- }
- }
- for ( i = 0; i < BINAURAL_CHANNELS; i++ )
- {
- for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
- {
- ptW16 = (int16_t *) hrtf_data_rptr;
- for ( k = 0; k < HRTF_NUM_BINS; k++ )
- {
- ( *hHRTF )->hrtfShCoeffsIm[i][j][k] = ptW16[k] * scaler;
- }
- hrtf_data_rptr += data_size_tmp;
- }
- }
-
- /* Reverb Parameters */
- if ( CLDFB_NO_CHANNELS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (CLDFB_NO_CHANNELS_MAX)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
- scaler = powf( 2.f, -1.f * factorQ );
-
- ptW16 = (int16_t *) hrtf_data_rptr;
- for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
- {
- ( *hHRTF )->parametricReverberationTimes[j] = ptW16[j] * scaler;
- }
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
-
- /* Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
- scaler = powf( 2.f, -1.f * factorQ );
-
- ptW16 = (int16_t *) hrtf_data_rptr;
- for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
- {
- ( *hHRTF )->parametricReverberationEneCorrections[j] = ptW16[j] * scaler;
- }
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
-
- /* Q factor*/
- factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( Word16 );
- scaler = powf( 2.f, -1.f * factorQ );
-
- ptW16 = (int16_t *) hrtf_data_rptr;
- for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
- {
- ( *hHRTF )->parametricEarlyPartEneCorrection[j] = ptW16[j] * scaler;
- }
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
-
return IVAS_ERR_OK;
}
-#endif
-#ifndef FIX_POINT_HRTF_FILE_FORMAT
+/*---------------------------------------------------------------------*
+ * create_fastconv_HRTF_from_rawdata()
+ *
+ * Create HRTF from the raw data (to the HRTF FastConv handle)
+ *---------------------------------------------------------------------*/
static ivas_error create_fastconv_HRTF_from_rawdata(
HRTFS_FASTCONV_HANDLE *hHRTF, /* i/o: HRTF FastConv handle */
@@ -2961,12 +1330,95 @@ static ivas_error create_fastconv_HRTF_from_rawdata(
BINAURAL_INPUT_AUDIO_CONFIG input_cfg /* i : Input binaural config */
)
{
- int16_t i, j;
+ int16_t i, j, k;
char *hrtf_data_rptr;
ivas_error error;
+ Word16 factorQ;
+ float scaleFactor;
+ int16_t *ptW16;
+ float latency_s;
+ uint16_t ntaps;
+ uint16_t nbchan;
+
+ if ( hrtf_data == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
( *hHRTF )->allocate_init_flag = 0;
+ hrtf_data_rptr = hrtf_data;
+
+ /* latency_s Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+
+ /* latency_s */
+ latency_s = ( *( (Word32 *) ( hrtf_data_rptr ) ) ) * powf( 2.f, -1.f * factorQ );
+ hrtf_data_rptr += sizeof( Word32 );
+
+ if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
+ }
+ hrtf_data_rptr += sizeof( uint16_t );
+
+ nbchan = *( (uint16_t *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( uint16_t );
+
+ ntaps = *( (uint16_t *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( uint16_t );
+
+ if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
+ {
+ if ( HRTF_LS_CHANNELS != nbchan )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" );
+ }
+ ( *hHRTF )->ntaps_hrir = ntaps;
+ ( *hHRTF )->FASTCONV_HRIR_latency_s = latency_s;
+ }
+ else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 )
+ {
+ if ( HOA3_CHANNELS != nbchan )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" );
+ }
+ ( *hHRTF )->ntaps_hrir_hoa3 = ntaps;
+ ( *hHRTF )->FASTCONV_HOA3_latency_s = latency_s;
+ }
+ else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 )
+ {
+ if ( HOA2_CHANNELS != nbchan )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" );
+ }
+ ( *hHRTF )->ntaps_hrir_hoa2 = ntaps;
+ ( *hHRTF )->FASTCONV_HOA2_latency_s = latency_s;
+ }
+ else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA )
+ {
+ if ( FOA_CHANNELS != nbchan )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" );
+ }
+ ( *hHRTF )->ntaps_hrir_foa = ntaps;
+ ( *hHRTF )->FASTCONV_FOA_latency_s = latency_s;
+ }
+ else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
+ {
+ if ( HRTF_LS_CHANNELS != nbchan )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" );
+ }
+ ( *hHRTF )->ntaps_brir = ntaps;
+ ( *hHRTF )->FASTCONV_BRIR_latency_s = latency_s;
+ }
+ else
+ {
+ return IVAS_ERROR( IVAS_ERR_BITSTREAM_READER_INVALID_FORMAT, "Can not read hrtf binary file : wrong render type and input config couple " );
+ }
+
if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV )
{
if ( ( error = ivas_allocate_binaural_hrtf( *hHRTF, 0, input_cfg, RENDERER_BINAURAL_FASTCONV, ( *hHRTF )->allocate_init_flag ) ) != IVAS_ERR_OK )
@@ -2985,296 +1437,290 @@ static ivas_error create_fastconv_HRTF_from_rawdata(
{
return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "renderer type not compliant" );
}
-
- hrtf_data_rptr = hrtf_data;
-
/* HRIR */
if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
{
- ( *hHRTF )->FASTCONV_HRIR_latency_s = *( (float *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( float );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
+ /* HRIR Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaleFactor = powf( 2.f, -1.f * factorQ );
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftHRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir; k++ )
+ {
+ ( *hHRTF )->leftHRIRReal[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftHRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir; k++ )
+ {
+ ( *hHRTF )->leftHRIRImag[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightHRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir; k++ )
+ {
+ ( *hHRTF )->rightHRIRReal[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightHRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir; k++ )
+ {
+ ( *hHRTF )->rightHRIRImag[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir * sizeof( Word16 );
}
}
}
else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA3 )
{
- /* HRIR_HOA3 */
- ( *hHRTF )->FASTCONV_HOA3_latency_s = *( (float *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( float );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( HOA3_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA3_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
+ /* HRIR Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaleFactor = powf( 2.f, -1.f * factorQ );
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HOA3_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa3; k++ )
+ {
+ ( *hHRTF )->leftHRIRReal_HOA3[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa3 * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HOA3_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa3; k++ )
+ {
+ ( *hHRTF )->leftHRIRImag_HOA3[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa3 * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HOA3_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightHRIRReal_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa3; k++ )
+ {
+ ( *hHRTF )->rightHRIRReal_HOA3[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa3 * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HOA3_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightHRIRImag_HOA3[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa3; k++ )
+ {
+ ( *hHRTF )->rightHRIRImag_HOA3[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa3 * sizeof( Word16 );
}
}
}
else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_HOA2 )
{
- /* HRIR_HOA2 */
- ( *hHRTF )->FASTCONV_HOA2_latency_s = *( (float *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( float );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( HOA2_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HOA2_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
+ /* HRIR Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaleFactor = powf( 2.f, -1.f * factorQ );
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HOA2_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa2; k++ )
+ {
+ ( *hHRTF )->leftHRIRReal_HOA2[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa2 * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HOA2_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa2; k++ )
+ {
+ ( *hHRTF )->leftHRIRImag_HOA2[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa2 * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HOA2_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightHRIRReal_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa2; k++ )
+ {
+ ( *hHRTF )->rightHRIRReal_HOA2[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa2 * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HOA2_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightHRIRImag_HOA2[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_hoa2; k++ )
+ {
+ ( *hHRTF )->rightHRIRImag_HOA2[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_hoa2 * sizeof( Word16 );
}
}
}
else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_FOA )
{
- /* HRIR_FOA */
- ( *hHRTF )->FASTCONV_FOA_latency_s = *( (float *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( float );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( FOA_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (FOA_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS_SBA != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS_SBA)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
+ /* HRIR Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaleFactor = powf( 2.f, -1.f * factorQ );
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < FOA_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_foa; k++ )
+ {
+ ( *hHRTF )->leftHRIRReal_FOA[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_foa * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < FOA_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_foa; k++ )
+ {
+ ( *hHRTF )->leftHRIRImag_FOA[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_foa * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < FOA_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightHRIRReal_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_foa; k++ )
+ {
+ ( *hHRTF )->rightHRIRReal_FOA[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_foa * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < FOA_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightHRIRImag_FOA[i][j], hrtf_data_rptr, BINAURAL_NTAPS_SBA * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_SBA * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_hrir_foa; k++ )
+ {
+ ( *hHRTF )->rightHRIRImag_FOA[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_hrir_foa * sizeof( Word16 );
}
}
}
/* BRIR */
else if ( rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM && input_cfg == BINAURAL_INPUT_AUDIO_CONFIG_COMBINED )
{
- ( *hHRTF )->FASTCONV_BRIR_latency_s = *( (float *) ( hrtf_data_rptr ) );
- hrtf_data_rptr += sizeof( float );
-
- if ( BINAURAL_CONVBANDS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_CONVBANDS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( HRTF_LS_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_LS_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- if ( BINAURAL_NTAPS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (BINAURAL_NTAPS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
+ /* BRIR Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaleFactor = powf( 2.f, -1.f * factorQ );
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftBRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_brir; k++ )
+ {
+ ( *hHRTF )->leftBRIRReal[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_brir * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->leftBRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_brir; k++ )
+ {
+ ( *hHRTF )->leftBRIRImag[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_brir * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightBRIRReal[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_brir; k++ )
+ {
+ ( *hHRTF )->rightBRIRReal[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_brir * sizeof( Word16 );
}
}
for ( i = 0; i < BINAURAL_CONVBANDS; i++ )
{
for ( j = 0; j < HRTF_LS_CHANNELS; j++ )
{
- memcpy( ( *hHRTF )->rightBRIRImag[i][j], hrtf_data_rptr, BINAURAL_NTAPS_MAX * sizeof( float ) );
- hrtf_data_rptr += BINAURAL_NTAPS_MAX * sizeof( float );
+ ptW16 = (Word16 *) hrtf_data_rptr;
+ for ( k = 0; k < ( *hHRTF )->ntaps_brir; k++ )
+ {
+ ( *hHRTF )->rightBRIRImag[i][j][k] = ptW16[k] * scaleFactor;
+ }
+ hrtf_data_rptr += ( *hHRTF )->ntaps_brir * sizeof( Word16 );
}
}
@@ -3285,17 +1731,152 @@ static ivas_error create_fastconv_HRTF_from_rawdata(
}
hrtf_data_rptr += sizeof( uint16_t );
- memcpy( ( *hHRTF )->fastconvReverberationTimes, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) );
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float );
+ /* fastconvReverberationTimes Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaleFactor = powf( 2.f, -1.f * factorQ );
+
+ ptW16 = (int16_t *) hrtf_data_rptr;
+ for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
+ {
+ ( *hHRTF )->fastconvReverberationTimes[j] = ptW16[j] * powf( 2.f, -1.f * factorQ );
+ }
+ hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
+
+ /* fastconvReverberationEneCorrections Q factor */
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaleFactor = powf( 2.f, -1.f * factorQ );
+
+ ptW16 = (int16_t *) hrtf_data_rptr;
+ for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
+ {
+ ( *hHRTF )->fastconvReverberationEneCorrections[j] = ptW16[j] * powf( 2.f, -1.f * factorQ );
+ }
+ hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
+ }
+
+ return IVAS_ERR_OK;
+}
+
+
+/*---------------------------------------------------------------------*
+ * create_parambin_HRTF_from_rawdata()
+ *
+ *
+ *---------------------------------------------------------------------*/
+
+static ivas_error create_parambin_HRTF_from_rawdata(
+ HRTFS_PARAMBIN_HANDLE *hHRTF, /* i/o: Parametric binauralizer HRTF handle */
+ char *hrtf_data /* i : pointer to binary file */
+)
+{
+ int16_t i, j, k;
+ char *hrtf_data_rptr;
+ uint32_t data_size_tmp;
+ Word16 factorQ;
+ int16_t *ptW16;
+ float scaler;
+
+ if ( hrtf_data == NULL )
+ {
+ return IVAS_ERR_UNEXPECTED_NULL_POINTER;
+ }
+
+ hrtf_data_rptr = hrtf_data;
+
+ /* HRTF_SH_CHANNELS */
+ if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" );
+ }
+ hrtf_data_rptr += sizeof( uint16_t );
+
+ /* HRTF_NUM_BINS */
+ if ( HRTF_NUM_BINS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_NUM_BINS)" );
+ }
+ hrtf_data_rptr += sizeof( uint16_t );
+
+ /* HRTF */
+ /* Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaler = powf( 2.f, -1.f * factorQ );
+
+ data_size_tmp = HRTF_NUM_BINS * sizeof( int16_t );
+ for ( i = 0; i < BINAURAL_CHANNELS; i++ )
+ {
+ for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
+ {
+ ptW16 = (int16_t *) hrtf_data_rptr;
+ for ( k = 0; k < HRTF_NUM_BINS; k++ )
+ {
+ ( *hHRTF )->hrtfShCoeffsRe[i][j][k] = ptW16[k] * scaler;
+ }
+ hrtf_data_rptr += data_size_tmp;
+ }
+ }
+ for ( i = 0; i < BINAURAL_CHANNELS; i++ )
+ {
+ for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
+ {
+ ptW16 = (int16_t *) hrtf_data_rptr;
+ for ( k = 0; k < HRTF_NUM_BINS; k++ )
+ {
+ ( *hHRTF )->hrtfShCoeffsIm[i][j][k] = ptW16[k] * scaler;
+ }
+ hrtf_data_rptr += data_size_tmp;
+ }
+ }
+
+ /* Reverb Parameters */
+ if ( CLDFB_NO_CHANNELS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) )
+ {
+ return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (CLDFB_NO_CHANNELS_MAX)" );
+ }
+ hrtf_data_rptr += sizeof( uint16_t );
+
+ /* Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaler = powf( 2.f, -1.f * factorQ );
+
+ ptW16 = (int16_t *) hrtf_data_rptr;
+ for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
+ {
+ ( *hHRTF )->parametricReverberationTimes[j] = ptW16[j] * scaler;
+ }
+ hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
+
+ /* Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaler = powf( 2.f, -1.f * factorQ );
+
+ ptW16 = (int16_t *) hrtf_data_rptr;
+ for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
+ {
+ ( *hHRTF )->parametricReverberationEneCorrections[j] = ptW16[j] * scaler;
+ }
+ hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
+
+ /* Q factor*/
+ factorQ = *( (Word16 *) ( hrtf_data_rptr ) );
+ hrtf_data_rptr += sizeof( Word16 );
+ scaler = powf( 2.f, -1.f * factorQ );
- memcpy( ( *hHRTF )->fastconvReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) );
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float );
+ ptW16 = (int16_t *) hrtf_data_rptr;
+ for ( j = 0; j < CLDFB_NO_CHANNELS_MAX; j++ )
+ {
+ ( *hHRTF )->parametricEarlyPartEneCorrection[j] = ptW16[j] * scaler;
}
+ hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( int16_t );
return IVAS_ERR_OK;
}
-#endif
/*---------------------------------------------------------------------*
* load_fastconv_HRTF_from_binary()
@@ -3385,77 +1966,6 @@ ivas_error load_fastconv_HRTF_from_binary(
}
}
-#ifndef FIX_POINT_HRTF_FILE_FORMAT
-
-/*---------------------------------------------------------------------*
- * create_parambin_HRTF_from_rawdata()
- *
- *
- *---------------------------------------------------------------------*/
-
-static ivas_error create_parambin_HRTF_from_rawdata(
- HRTFS_PARAMBIN_HANDLE *hHRTF, /* i/o: Parametric binauralizer HRTF handle */
- char *hrtf_data /* i : pointer to binary file */
-)
-{
- int16_t i, j;
- char *hrtf_data_rptr;
- uint32_t data_size_tmp;
-
- hrtf_data_rptr = hrtf_data;
-
- /* HRTF_SH_CHANNELS */
- if ( HRTF_SH_CHANNELS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_SH_CHANNELS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* HRTF_NUM_BINS */
- if ( HRTF_NUM_BINS != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (HRTF_NUM_BINS)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- /* HRTF */
- data_size_tmp = HRTF_NUM_BINS * sizeof( float );
- for ( i = 0; i < BINAURAL_CHANNELS; i++ )
- {
- for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
- {
- memcpy( ( *hHRTF )->hrtfShCoeffsRe[i][j], hrtf_data_rptr, data_size_tmp );
- hrtf_data_rptr += data_size_tmp;
- }
- }
- for ( i = 0; i < BINAURAL_CHANNELS; i++ )
- {
- for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
- {
- memcpy( ( *hHRTF )->hrtfShCoeffsIm[i][j], hrtf_data_rptr, data_size_tmp );
- hrtf_data_rptr += data_size_tmp;
- }
- }
-
- /* Reverb Parameters */
- if ( CLDFB_NO_CHANNELS_MAX != *( (uint16_t *) ( hrtf_data_rptr ) ) )
- {
- return IVAS_ERROR( IVAS_ERR_INTERNAL_FATAL, "HRTF binary file not compliant (CLDFB_NO_CHANNELS_MAX)" );
- }
- hrtf_data_rptr += sizeof( uint16_t );
-
- memcpy( ( *hHRTF )->parametricReverberationTimes, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) );
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float );
-
- memcpy( ( *hHRTF )->parametricReverberationEneCorrections, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) );
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float );
-
- memcpy( ( *hHRTF )->parametricEarlyPartEneCorrection, hrtf_data_rptr, CLDFB_NO_CHANNELS_MAX * sizeof( float ) );
- hrtf_data_rptr += CLDFB_NO_CHANNELS_MAX * sizeof( float );
-
- return IVAS_ERR_OK;
-}
-#endif
/*---------------------------------------------------------------------*
* load_parambin_HRTF_from_binary()
@@ -3514,11 +2024,7 @@ ivas_error load_parambin_HRTF_from_binary(
free( hrtf_data );
return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "HRTF binary file not compliant (number of HRTF)" );
}
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC ) /* Parametric binauralizer data is represented as single entity */
-#else
- if ( hrtf_header.rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM ) /* Parametric binauralizer data is represented as single entity */
-#endif
{
if ( fread( hrtf_data, 1, hrtf_header.data_size, f_hrtf ) != hrtf_header.data_size )
{
@@ -3682,7 +2188,6 @@ static void destroy_HRTF(
{
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
-#ifdef FIX_POINT_ROM_CONST
if ( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL )
{
free( ( *hHRTF )->pIndex_frequency_max_dyn[i][j] );
@@ -3695,25 +2200,10 @@ static void destroy_HRTF(
{
free( ( *hHRTF )->pOut_to_bin_im_dyn[i][j] );
}
-#else
- if ( ( *hHRTF )->pIndex_frequency_max[i][j] != NULL )
- {
- free( (uint16_t *) ( *hHRTF )->pIndex_frequency_max[i][j] );
- }
- if ( ( *hHRTF )->pOut_to_bin_re[i][j] != NULL )
- {
- free( (float *) ( *hHRTF )->pOut_to_bin_re[i][j] );
- }
- if ( ( *hHRTF )->pOut_to_bin_im[i][j] != NULL )
- {
- free( (float *) ( *hHRTF )->pOut_to_bin_im[i][j] );
- }
-#endif
}
}
for ( j = 0; j < BINAURAL_CHANNELS; j++ )
{
-#ifdef FIX_POINT_ROM_CONST
if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL )
{
free( ( *hHRTF )->pIndex_frequency_max_diffuse_dyn[j] );
@@ -3726,20 +2216,6 @@ static void destroy_HRTF(
{
free( ( *hHRTF )->pOut_to_bin_diffuse_im_dyn[j] );
}
-#else
- if ( ( *hHRTF )->pIndex_frequency_max_diffuse[j] != NULL )
- {
- free( (uint16_t *) ( *hHRTF )->pIndex_frequency_max_diffuse[j] );
- }
- if ( ( *hHRTF )->pOut_to_bin_diffuse_re[j] != NULL )
- {
- free( (float *) ( *hHRTF )->pOut_to_bin_diffuse_re[j] );
- }
- if ( ( *hHRTF )->pOut_to_bin_diffuse_im[j] != NULL )
- {
- free( (float *) ( *hHRTF )->pOut_to_bin_diffuse_im[j] );
- }
-#endif
}
free( *hHRTF );
@@ -3824,7 +2300,6 @@ void destroy_hrtf_statistics(
if ( ( hHrtfStatistics != NULL ) && ( *hHrtfStatistics != NULL ) && ( ( *hHrtfStatistics )->fromROM == FALSE ) )
{
-#ifdef FIX_POINT_ROM_CONST
if ( ( *hHrtfStatistics )->average_energy_l != NULL )
{
free( ( *hHrtfStatistics )->average_energy_l_dyn );
@@ -3837,11 +2312,6 @@ void destroy_hrtf_statistics(
{
free( ( *hHrtfStatistics )->inter_aural_coherence_dyn );
}
-#else
- free( (float *) ( *hHrtfStatistics )->average_energy_l );
- free( (float *) ( *hHrtfStatistics )->average_energy_r );
- free( (float *) ( *hHrtfStatistics )->inter_aural_coherence );
-#endif
}
ivas_HRTF_statistics_close( hHrtfStatistics );
diff --git a/lib_util/hrtf_file_reader.h b/lib_util/hrtf_file_reader.h
index 81af54479c113799da248b71712448be0dee830c..dbb38c3d888719c629203f58aad3c21184d4a36a 100644
--- a/lib_util/hrtf_file_reader.h
+++ b/lib_util/hrtf_file_reader.h
@@ -43,9 +43,6 @@ typedef enum
HRTF_READER_RENDERER_BINAURAL_FASTCONV,
HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM,
HRTF_READER_RENDERER_BINAURAL_PARAMETRIC,
-#ifndef FIX_POINT_HRTF_FILE_FORMAT
- HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM,
-#endif
HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD,
HRTF_READER_RENDERER_BINAURAL_MIXER_CONV,
HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM,
diff --git a/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c b/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c
index ba17e8545a650b1b4742a92ac6cffe4fedf596ac..6b614f80c8202a4bde22eca64ba20b1656c3928a 100644
--- a/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c
+++ b/scripts/binauralRenderer_interface/Table_Format_Converter/generate_tables_from_rom_to_bin.c
@@ -40,9 +40,7 @@
#include "ivas_stat_dec.h"
#include "hrtf_file_reader.h"
#include "ivas_rom_rend.h"
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
#include
-#endif
#define FILE_HEADER
@@ -98,13 +96,8 @@ typedef struct _crend_hrtf_tables_dimensions
int16_t max_num_ir;
int16_t max_num_iterations;
int16_t max_num_iterations_diffuse;
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
uint32_t max_total_num_fsamp_per_iteration;
uint32_t max_total_num_fsamp_per_iteration_diff;
-#else
- uint16_t max_total_num_fsamp_per_iteration;
- uint16_t max_total_num_fsamp_per_iteration_diff;
-#endif
} crend_hrtf_tables_dimensions;
@@ -1213,18 +1206,6 @@ char *create_hrtf_parametric( int32_t *hrtf_size )
uint32_t hrtf_data_size;
FILE *input_param_bin_file = NULL;
-#ifndef FIX_POINT_HRTF_FILE_FORMAT
- int16_t i, j;
- uint32_t data_size_tmp;
- uint8_t file_read_ok;
-
- float hrtfShCoeffsReFile[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS];
- float hrtfShCoeffsImFile[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS];
-
- float parametricReverberationTimesFile[CLDFB_NO_CHANNELS_MAX];
- float parametricReverberationEneCorrectionsFile[CLDFB_NO_CHANNELS_MAX];
- float parametricEarlyPartEneCorrectionFile[CLDFB_NO_CHANNELS_MAX];
-#endif
full_in_param_bin_path = (char *) malloc( sizeof( char ) * ( strlen( input_param_bin_path ) + strlen( input_param_bin_file_name ) + 2 ) );
if ( full_in_param_bin_path == NULL )
@@ -1241,7 +1222,6 @@ char *create_hrtf_parametric( int32_t *hrtf_size )
hrtf_data_size = 0;
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
input_param_bin_file = fopen( full_in_param_bin_path, "rb" );
@@ -1298,200 +1278,6 @@ char *create_hrtf_parametric( int32_t *hrtf_size )
full_in_param_bin_path = NULL;
}
-#else
- /* Binary file - block description :
-
- HRTFs
- HRTF_SH_CHANNELS => uint16_t
- HRTF_NUM_BINS => uint16_t
- hrtfShCoeffsRe => float[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS];
- hrtfShCoeffsIm => float[BINAURAL_CHANNELS][HRTF_SH_CHANNELS][HRTF_NUM_BINS];
-
- BRIR-based reverb
- CLDFB_NO_CHANNELS_MAX => uint16_t
- parametricReverberationTimes => float[CLDFB_NO_CHANNELS_MAX];
- parametricReverberationEneCorrections => float[CLDFB_NO_CHANNELS_MAX];
- parametricEarlyPartEneCorrection => float[CLDFB_NO_CHANNELS_MAX];
-*/
-
- // Compute total size of data to write
- // CLDFB SH domain HRTF-data
- hrtf_data_size += sizeof( uint16_t ); // HRTF_SH_CHANNELS
- hrtf_data_size += sizeof( uint16_t ); // HRTF_NUM_BINS
- hrtf_data_size += 2 * ( BINAURAL_CHANNELS * HRTF_SH_CHANNELS * HRTF_NUM_BINS * sizeof( float ) ); // HRTF
-
- // Always write also BRIR reverb data
- hrtf_data_size += sizeof( uint16_t ); // CLDFB_NO_CHANNELS_MAX
- hrtf_data_size += CLDFB_NO_CHANNELS_MAX * sizeof( float ); // parametricReverberationTimes
- hrtf_data_size += CLDFB_NO_CHANNELS_MAX * sizeof( float ); // parametricReverberationEneCorrections
- hrtf_data_size += CLDFB_NO_CHANNELS_MAX * sizeof( float ); // parametricEarlyPartEneCorrection
-
- file_read_ok = 0;
- input_param_bin_file = fopen( full_in_param_bin_path, "rb" );
- if ( input_param_bin_file != NULL )
- {
- uint16_t hrtf_sh_channels, hrtf_num_bins, cldfb_no_channels_max;
-
- fseek( input_param_bin_file, 0, SEEK_END );
- data_size_tmp = ftell( input_param_bin_file );
- fseek( input_param_bin_file, 0, SEEK_SET );
-
- if ( data_size_tmp != hrtf_data_size )
- {
- fprintf( stderr, "Inconsistent binary data file size (expected: %d, found %d). Using built-in default values.\n\n", hrtf_data_size, data_size_tmp );
- }
- else
- {
- fread( &hrtf_sh_channels, sizeof( uint16_t ), 1, input_param_bin_file );
- fread( &hrtf_num_bins, sizeof( uint16_t ), 1, input_param_bin_file );
- if ( hrtf_sh_channels != HRTF_SH_CHANNELS )
- {
- fprintf( stderr, "Warning: Inconsistent HRTF_SH_CHANNELS (expected: %d, found: %d).\n\n", HRTF_SH_CHANNELS, hrtf_sh_channels );
- }
- if ( hrtf_num_bins != HRTF_NUM_BINS )
- {
- fprintf( stderr, "Warning: Inconsistent HRTF_NUM_BINS (expected: %d, found: %d).\n\n", HRTF_NUM_BINS, hrtf_num_bins );
- }
-
- for ( size_t bin_chnl = 0; bin_chnl < BINAURAL_CHANNELS; bin_chnl++ )
- {
- for ( size_t hrtf_chnl = 0; hrtf_chnl < HRTF_SH_CHANNELS; hrtf_chnl++ )
- {
- fread( hrtfShCoeffsReFile[bin_chnl][hrtf_chnl], sizeof( float ), HRTF_NUM_BINS, input_param_bin_file );
- }
- }
- for ( size_t bin_chnl = 0; bin_chnl < BINAURAL_CHANNELS; bin_chnl++ )
- {
- for ( size_t hrtf_chnl = 0; hrtf_chnl < HRTF_SH_CHANNELS; hrtf_chnl++ )
- {
- fread( hrtfShCoeffsImFile[bin_chnl][hrtf_chnl], sizeof( float ), HRTF_NUM_BINS, input_param_bin_file );
- }
- }
-
- /* reverb */
- fread( &cldfb_no_channels_max, sizeof( uint16_t ), 1, input_param_bin_file );
- if ( cldfb_no_channels_max != CLDFB_NO_CHANNELS_MAX )
- {
- fprintf( stderr, "Warning: Inconsistent CLDFB_NO_CHANNELS_MAX (expected: %d, found: %d).\n\n", CLDFB_NO_CHANNELS_MAX, cldfb_no_channels_max );
- }
-
- fread( parametricReverberationTimesFile, sizeof( float ), CLDFB_NO_CHANNELS_MAX, input_param_bin_file );
- fread( parametricReverberationEneCorrectionsFile, sizeof( float ), CLDFB_NO_CHANNELS_MAX, input_param_bin_file );
- fread( parametricEarlyPartEneCorrectionFile, sizeof( float ), CLDFB_NO_CHANNELS_MAX, input_param_bin_file );
-
- file_read_ok = 1;
- }
- }
- else
- {
- fprintf( stderr, "Opening of parambin file %s failed. Using built-in default values.\n\n", full_in_param_bin_path );
- }
-
- // Allocate memory
- *hrtf_size = sizeof( ivas_hrtfs_header_t ) + hrtf_data_size;
- hrtf = (char *) malloc( *hrtf_size );
- if ( hrtf == NULL )
- {
- fprintf( stderr, "Memory allocation for the block failed!\n\n" );
- *hrtf_size = -1;
- return NULL;
- }
-
- // Write
-
- // Header [Declaration of the HRTF]
- // Renderer type (4 bytes) : See "RENDERER_TYPE"
- // Decoder output format (4 bytes) : See "BINAURAL_INPUT_AUDIO_CONFIG"
- // Sampling Frequency (4 bytes)
- // Raw data size (4 bytes)
-
- memset( hrtf, 0x00, *hrtf_size );
- hrtf_wptr = hrtf;
-
- // Renderer type - we use only parametric room type here to cover both cases
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- *( (int32_t *) ( hrtf_wptr ) ) = HRTF_READER_RENDERER_BINAURAL_PARAMETRIC;
-#else
- *( (int32_t *) ( hrtf_wptr ) ) = HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM;
-#endif
- hrtf_wptr += sizeof( int32_t );
-
- // Decoder output format - not relevant parametric binaural renderer
- *( (int32_t *) ( hrtf_wptr ) ) = BINAURAL_INPUT_AUDIO_CONFIG_UNDEFINED;
- hrtf_wptr += sizeof( int32_t );
-
- // Sampling Frequency
- *( (int32_t *) ( hrtf_wptr ) ) = 48000;
- hrtf_wptr += sizeof( int32_t );
-
- // Raw data size
- memcpy( hrtf_wptr, &( hrtf_data_size ), sizeof( uint32_t ) );
- hrtf_wptr += sizeof( uint32_t );
-
- // Write the HRTF raw data
- *( (uint16_t *) ( hrtf_wptr ) ) = HRTF_SH_CHANNELS;
- hrtf_wptr += sizeof( uint16_t );
-
- *( (uint16_t *) ( hrtf_wptr ) ) = HRTF_NUM_BINS;
- hrtf_wptr += sizeof( uint16_t );
-
- // HRTF
- data_size_tmp = HRTF_NUM_BINS * sizeof( float );
- for ( i = 0; i < BINAURAL_CHANNELS; i++ )
- {
- for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
- {
- if ( file_read_ok )
- {
- memcpy( hrtf_wptr, &hrtfShCoeffsReFile[i][j], data_size_tmp );
- }
- else
- {
- memcpy( hrtf_wptr, &hrtfShCoeffsRe[i][j], data_size_tmp );
- }
- hrtf_wptr += data_size_tmp;
- }
- }
- for ( i = 0; i < BINAURAL_CHANNELS; i++ )
- {
- for ( j = 0; j < HRTF_SH_CHANNELS; j++ )
- {
- if ( file_read_ok )
- {
- memcpy( hrtf_wptr, &hrtfShCoeffsImFile[i][j], data_size_tmp );
- }
- else
- {
- memcpy( hrtf_wptr, &hrtfShCoeffsIm[i][j], data_size_tmp );
- }
- hrtf_wptr += data_size_tmp;
- }
- }
-
- // Reverb Parameters
- *( (uint16_t *) ( hrtf_wptr ) ) = CLDFB_NO_CHANNELS_MAX;
- hrtf_wptr += sizeof( uint16_t );
-
- data_size_tmp = CLDFB_NO_CHANNELS_MAX * sizeof( float );
- if ( file_read_ok )
- {
- memcpy( hrtf_wptr, &( parametricReverberationTimesFile ), data_size_tmp ); // parametricReverberationTimes
- hrtf_wptr += data_size_tmp;
- memcpy( hrtf_wptr, &( parametricReverberationEneCorrectionsFile ), data_size_tmp ); // parametricReverberationEneCorrections
- hrtf_wptr += data_size_tmp;
- memcpy( hrtf_wptr, &( parametricEarlyPartEneCorrectionFile ), data_size_tmp ); // parametricEarlyPartEneCorrection
- hrtf_wptr += data_size_tmp;
- }
- else
- {
- memcpy( hrtf_wptr, &( parametricReverberationTimes ), data_size_tmp ); // parametricReverberationTimes
- hrtf_wptr += data_size_tmp;
- memcpy( hrtf_wptr, &( parametricReverberationEneCorrections ), data_size_tmp ); // parametricReverberationEneCorrections
- hrtf_wptr += data_size_tmp;
- memcpy( hrtf_wptr, &( parametricEarlyPartEneCorrection ), data_size_tmp ); // parametricEarlyPartEneCorrection
- hrtf_wptr += data_size_tmp;
- }
-#endif
return hrtf;
}
@@ -1911,7 +1697,6 @@ int16_t get_crend_hrtf_tables( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INP
return result;
}
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
/*---------------------------------------------------------------------*
* compute_crend_hrtf_data_size_fx()
*
@@ -1958,11 +1743,7 @@ int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptr
{
for ( iIter = 0; iIter < hrtf_table_ptrs->num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max[iIndex++] * sizeof( int16_t ); // 2* : re & im
-#else
- hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max[iIndex++] * sizeof( int32_t ); // 2* : re & im
-#endif
}
}
}
@@ -1975,89 +1756,13 @@ int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptr
{
for ( iIter = 0; iIter < hrtf_table_ptrs->num_iterations_diffuse[iChan]; iIter++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max_diffuse[iIndex++] * sizeof( int16_t ); // 2* : re & im
-#else
- hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max_diffuse[iIndex++] * sizeof( int32_t ); // 2* : re & im
-#endif
- }
- }
- }
-
- return hrtf_data_size;
-}
-#else
-/*---------------------------------------------------------------------*
- * compute_crend_hrtf_data_size()
- *
- *---------------------------------------------------------------------*/
-int32_t compute_crend_hrtf_data_size( crend_hrtf_tables_pointers *hrtf_table_ptrs, crend_hrtf_tables_dimensions *hrtf_table_dims )
-{
- int32_t hrtf_data_size = 0;
- int32_t iChan, iIR, iIndex, iIter;
-
- if ( ( hrtf_table_ptrs == NULL ) || ( hrtf_table_dims == NULL ) )
- {
- return 0;
- }
-
- hrtf_data_size += sizeof( float ); // latency_s
- hrtf_data_size += sizeof( uint16_t ); // max_num_ir
- hrtf_data_size += sizeof( uint16_t ); // BINAURAL_CHANNELS
- hrtf_data_size += sizeof( int16_t ); // max_num_iterations
- hrtf_data_size += hrtf_table_dims->max_num_ir * BINAURAL_CHANNELS * sizeof( uint16_t ); // num_iterations
- hrtf_data_size += hrtf_table_dims->max_num_ir * BINAURAL_CHANNELS * hrtf_table_dims->max_num_iterations * sizeof( uint16_t ); // pIndex_frequency_max
-
- hrtf_data_size += sizeof( int16_t ); // max_num_iterations_diffuse
- if ( hrtf_table_dims->max_num_iterations_diffuse != 0 )
- {
- hrtf_data_size += BINAURAL_CHANNELS * sizeof( uint16_t ); // num_iterations_diffuse
- // pIndex_frequency_max_diffuse : The size depends on num_iterations_diffuse
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- hrtf_data_size += hrtf_table_ptrs->num_iterations_diffuse[iChan] * sizeof( uint16_t );
- }
- }
-
- hrtf_data_size += sizeof( uint16_t ); // index_frequency_max_diffuse
- hrtf_data_size += hrtf_table_dims->max_num_ir * BINAURAL_CHANNELS * sizeof( float ); // inv_diffuse_weight
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- hrtf_data_size += sizeof( uint32_t ); // max_total_num_fsamp_per_iteration
-#else
- hrtf_data_size += sizeof( uint16_t ); // max_total_num_fsamp_per_iteration
-#endif
- // coeff_re & coeff_im : The size depends on pIndex_frequency_max
- for ( iIR = 0, iIndex = 0; iIR < hrtf_table_dims->max_num_ir; iIR++ )
- {
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- for ( iIter = 0; iIter < hrtf_table_ptrs->num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ )
- {
- hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max[iIndex++] * sizeof( float ); // 2* : re & im
- }
- }
- }
-
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- hrtf_data_size += sizeof( uint32_t ); // max_total_num_fsamp_per_iteration_diff
-#else
- hrtf_data_size += sizeof( uint16_t ); // max_total_num_fsamp_per_iteration_diff
-#endif
- if ( hrtf_table_dims->max_total_num_fsamp_per_iteration_diff != 0 )
- {
- // coeff_diffuse_re & coeff_diffuse_im : The size depends on pIndex_frequency_max
- for ( iChan = 0, iIndex = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- for ( iIter = 0; iIter < hrtf_table_ptrs->num_iterations_diffuse[iChan]; iIter++ )
- {
- hrtf_data_size += 2 * hrtf_table_ptrs->pIndex_frequency_max_diffuse[iIndex++] * sizeof( float ); // 2* : re & im
}
}
}
return hrtf_data_size;
}
-#endif
/*---------------------------------------------------------------------*
* check_bin_file()
@@ -2190,11 +1895,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
if ( rend_type == HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD || rend_type == HRTF_READER_RENDERER_BINAURAL_REVERB_ALL ||
rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV || rend_type == HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM ||
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC )
-#else
- rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC || rend_type == HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM )
-#endif
{
return 0;
}
@@ -2230,20 +1931,12 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
hrtf_data_in_rptr = hrtf_data_in;
// latency_s
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
if ( ( *( tabs_ptrs.latency_s ) - ( *( (int32_t *) ( hrtf_data_in_rptr ) ) ) * powf( 2.f, -31.f ) ) > 1e-9f )
-#else
- if ( ( *( tabs_ptrs.latency_s ) - *( (float *) ( hrtf_data_in_rptr ) ) ) > 1e-9f )
-#endif
{
fprintf( stderr, "check_hrtf_data of binary file failed: bad latency_s!\n\n" );
return -1;
}
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
hrtf_data_in_rptr += sizeof( int32_t );
-#else
- hrtf_data_in_rptr += sizeof( float );
-#endif
// max_num_ir
if ( tabs_dims.max_num_ir != *( (uint16_t *) ( hrtf_data_in_rptr ) ) )
@@ -2328,11 +2021,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
hrtf_data_in_rptr += sizeof( uint16_t );
// inv_diffuse_weight
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
ctrl_size = tabs_dims.max_num_ir * BINAURAL_CHANNELS * sizeof( int16_t );
-#else
- ctrl_size = tabs_dims.max_num_ir * BINAURAL_CHANNELS * sizeof( float );
-#endif
if ( memcmp( tabs_ptrs.inv_diffuse_weight, hrtf_data_in_rptr, ctrl_size ) != 0 )
{
fprintf( stderr, "check_hrtf_data of binary file failed: bad inv_diffuse_weight!\n\n" );
@@ -2349,21 +2038,12 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
hrtf_data_in_rptr += ctrl_size;
// max_total_num_fsamp_per_iteration
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
if ( tabs_dims.max_total_num_fsamp_per_iteration != *( (uint32_t *) ( hrtf_data_in_rptr ) ) )
{
fprintf( stderr, "check_hrtf_data of binary file failed: bad max_total_num_fsamp_per_iteration!\n\n" );
return -1;
}
hrtf_data_in_rptr += sizeof( uint32_t );
-#else
- if ( tabs_dims.max_total_num_fsamp_per_iteration != *( (uint16_t *) ( hrtf_data_in_rptr ) ) )
- {
- fprintf( stderr, "check_hrtf_data of binary file failed: bad max_total_num_fsamp_per_iteration!\n\n" );
- return -1;
- }
- hrtf_data_in_rptr += sizeof( uint16_t );
-#endif
// coeff_re : The size depends on pIndex_frequency_max
for ( iIR = 0, iIndex = 0; iIR < tabs_dims.max_num_ir; iIR++ )
@@ -2373,11 +2053,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
coeff_rptr = tabs_ptrs.coeff_re + ( iIR * BINAURAL_CHANNELS + iChan ) * tabs_dims.max_total_num_fsamp_per_iteration;
for ( iIter = 0; iIter < tabs_ptrs.num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ )
{
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( int32_t );
-#else
- ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( float );
-#endif
if ( memcmp( coeff_rptr, hrtf_data_in_rptr, ctrl_size ) != 0 )
{
fprintf( stderr, "check_hrtf_data of binary file failed: bad coeff_re!\n\n" );
@@ -2406,11 +2082,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
coeff_rptr = tabs_ptrs.coeff_im + ( iIR * BINAURAL_CHANNELS + iChan ) * tabs_dims.max_total_num_fsamp_per_iteration;
for ( iIter = 0; iIter < tabs_ptrs.num_iterations[iIR * BINAURAL_CHANNELS + iChan]; iIter++ )
{
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( int32_t );
-#else
- ctrl_size = tabs_ptrs.pIndex_frequency_max[iIndex] * sizeof( float );
-#endif
if ( memcmp( coeff_rptr, hrtf_data_in_rptr, ctrl_size ) != 0 )
{
fprintf( stderr, "check_hrtf_data of binary file failed: bad coeff_re!\n\n" );
@@ -2431,21 +2103,12 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
}
// max_total_num_fsamp_per_iteration_diff
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
if ( tabs_dims.max_total_num_fsamp_per_iteration_diff != *( (uint32_t *) ( hrtf_data_in_rptr ) ) )
{
fprintf( stderr, "check_hrtf_data of binary file failed: bad max_total_num_fsamp_per_iteration_diff!\n\n" );
return -1;
}
hrtf_data_in_rptr += sizeof( uint32_t );
-#else
- if ( tabs_dims.max_total_num_fsamp_per_iteration_diff != *( (uint16_t *) ( hrtf_data_in_rptr ) ) )
- {
- fprintf( stderr, "check_hrtf_data of binary file failed: bad max_total_num_fsamp_per_iteration_diff!\n\n" );
- return -1;
- }
- hrtf_data_in_rptr += sizeof( uint16_t );
-#endif
if ( tabs_dims.max_total_num_fsamp_per_iteration_diff != 0 )
{
@@ -2455,11 +2118,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
coeff_rptr = tabs_ptrs.coeff_diffuse_re + iChan * tabs_dims.max_total_num_fsamp_per_iteration_diff;
for ( iIter = 0; iIter < tabs_ptrs.num_iterations_diffuse[iChan]; iIter++ )
{
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( int32_t );
-#else
- ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( float );
-#endif
if ( memcmp( coeff_rptr, hrtf_data_in_rptr, ctrl_size ) != 0 )
{
fprintf( stderr, "check_hrtf_data of binary file failed: bad coeff_diffuse_re!\n\n" );
@@ -2484,11 +2143,7 @@ int16_t check_hrtf_data( HRTF_READER_RENDERER_TYPE rend_type, BINAURAL_INPUT_AUD
coeff_rptr = tabs_ptrs.coeff_diffuse_im + iChan * tabs_dims.max_total_num_fsamp_per_iteration_diff;
for ( iIter = 0; iIter < tabs_ptrs.num_iterations_diffuse[iChan]; iIter++ )
{
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( int32_t );
-#else
- ctrl_size = tabs_ptrs.pIndex_frequency_max_diffuse[iIndex] * sizeof( float );
-#endif
if ( memcmp( coeff_rptr, hrtf_data_in_rptr, ctrl_size ) != 0 )
{
fprintf( stderr, "check_hrtf_data of binary file failed: bad coeff_diffuse_im!\n\n" );
diff --git a/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c b/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c
index cb006574036ce60adf24cce2bde630e63ef35ab9..5c64af8f6d359ac4a00de39eae28d1cee37a89c4 100644
--- a/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c
+++ b/scripts/binauralRenderer_interface/generate_crend_ivas_tables_from_sofa.c
@@ -73,15 +73,9 @@
#define LAST_SAMPLERATE 16000 /* Hz */
#define TEMPLTATE_C_ROM_FILE_NAME "ivas_license_header.template"
#define ROM_FILE_NAME "ivas_rom_binaural_crend_head"
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
#define FORMAT_FLOAT "%a"
#define FORMAT_FLOAT_REVERB "%a"
#define FORMAT_FLOAT_LATENCY "%a"
-#else
-#define FORMAT_FLOAT "%8.6f"
-#define FORMAT_FLOAT_REVERB "%8.6f"
-#define FORMAT_FLOAT_LATENCY "%10.9ff"
-#endif
#define NUM_SAMPLES_PER_LINES 96
#define NUM_SAMPLES_PER_LINES_REVERB 9
#define DECLARATION_NAME "CRendBin"
@@ -121,13 +115,8 @@ typedef struct _crend_hrtf_tables_dimensions
int16_t max_num_ir;
int16_t max_num_iterations;
int16_t max_num_iterations_diffuse;
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
uint32_t max_total_num_fsamp_per_iteration;
uint32_t max_total_num_fsamp_per_iteration_diff;
-#else
- uint16_t max_total_num_fsamp_per_iteration;
- uint16_t max_total_num_fsamp_per_iteration_diff;
-#endif
} crend_hrtf_tables_dimensions;
@@ -139,13 +128,8 @@ void usage_gen_crend_tables( void );
void get_ls_layout_config( AUDIO_CONFIG ls_layout_config, struct ivas_layout_config *ls_struct );
int generate_crend_ivas_tables_from_sofa( const char *sofa_file_path, ConfigReader *cfgReader );
void update_h_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
-#ifdef FIX_1123_CREND_FLTFX_BE
void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, int16_t *pEner_l_fx, int16_t *pEner_r_fx, int16_t *pCoherence_fx, int16_t factorQ, const int32_t samplerate, const int16_t len );
-#else
-void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
-void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, const int16_t len );
-#endif
void update_h_file_with_reverb( const int32_t samplerate );
int generate_reverb_ivas_tables_from_sofa( const char *file_path );
@@ -153,20 +137,11 @@ extern int32_t float2int32_t( float, int16_t );
extern int16_t float2int16_t( float, int16_t );
void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims /*OUT*/ );
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
-uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims );
-#else
uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims );
-#endif
ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
ivas_error make_reverb_fx_be( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, int16_t *factorQ );
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] );
ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *pCoherence, int16_t factorQ, const int32_t samplerate );
-#else
-ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len );
-ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate );
-#endif
/*---------------------------------------------------------------------*
*
@@ -1306,27 +1281,16 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
}
-#ifdef FIX_1123_CREND_FLTFX_BE
int16_t factorQ[3];
make_fx_be( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ );
-#endif
if ( lib_rend_path != NULL )
{
update_h_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len );
-#ifdef FIX_1123_CREND_FLTFX_BE
update_c_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ );
-#else
- update_c_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len );
-#endif
}
-#if defined( FIX_1123_CREND_16BIT_FMT ) && !defined( FIX_1123_CREND_FLTFX_BE )
- int16_t factorQ[3];
- make_fx_be( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ );
-#endif
if ( binary_file_path != NULL )
{
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
if ( write_binary_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len, factorQ ) != IVAS_ERR_OK )
{
mxDestroyArray( sofa );
@@ -1337,21 +1301,6 @@ int generate_crend_ivas_tables_from_sofa( const char *file_path, ConfigReader *c
ivas_hrtf_close( &hrtf_data );
return -1;
}
-#else
- if ( binary_file_path != NULL )
- {
- if ( write_binary_file( &hrtf_data, lscfg, sample_rates[indSR], frame_len ) != IVAS_ERR_OK )
- {
- mxDestroyArray( sofa );
- fprintf( stderr, "Write binary file error\n" );
- free( sofa_file_path );
- free( index_pos );
- free( ivas_hrtf );
- ivas_hrtf_close( &hrtf_data );
- return -1;
- }
- }
-#endif
}
if ( ivas_hrtf->latency_s[0] )
@@ -1853,22 +1802,18 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path )
nr_fc_fft_filter = ( frame_len >> 1 ) + 1;
float *p_avg_lr = NULL;
float *pCoherence = NULL;
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
int16_t *p_avg_lr_fx = NULL;
int16_t *pCoherence_fx = NULL;
int16_t factorQ;
-#endif
p_avg_lr = (float *) malloc( sizeof( float * ) * nr_fc_fft_filter * 2 );
pCoherence = (float *) malloc( sizeof( float * ) * nr_fc_fft_filter );
memset( p_avg_lr, 0, sizeof( float ) * nr_fc_fft_filter * 2 );
memset( pCoherence, 0, sizeof( float ) * nr_fc_fft_filter );
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
p_avg_lr_fx = (int16_t *) malloc( sizeof( int16_t * ) * nr_fc_fft_filter * 2 );
pCoherence_fx = (int16_t *) malloc( sizeof( int16_t * ) * nr_fc_fft_filter );
memset( p_avg_lr_fx, 0, sizeof( int16_t ) * nr_fc_fft_filter * 2 );
memset( pCoherence_fx, 0, sizeof( int16_t ) * nr_fc_fft_filter );
-#endif
pHrtf_set_l_re = (float **) malloc( sizeof( float * ) * sofa_M );
pHrtf_set_l_im = (float **) malloc( sizeof( float * ) * sofa_M );
@@ -1910,7 +1855,6 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path )
ivas_reverb_get_hrtf_set_properties( pHrtf_set_l_re, pHrtf_set_l_im, pHrtf_set_r_re, pHrtf_set_r_im, IVAS_AUDIO_CONFIG_5_1, sofa_M, nr_fc_fft_filter,
nr_fc_fft_filter, p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence );
-#ifdef FIX_1123_CREND_FLTFX_BE
make_reverb_fx_be( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], &factorQ );
for ( i = 0; i < nr_fc_fft_filter; i++ )
{
@@ -1918,38 +1862,17 @@ int generate_reverb_ivas_tables_from_sofa( const char *file_path )
p_avg_lr_fx[i + nr_fc_fft_filter] = float2int16_t( p_avg_lr[i + nr_fc_fft_filter], factorQ );
pCoherence_fx[i] = float2int16_t( pCoherence[i], factorQ );
}
-#endif
if ( lib_rend_path != NULL )
{
update_h_file_with_reverb( sample_rates[indSR] );
-#ifdef FIX_1123_CREND_FLTFX_BE
update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, p_avg_lr_fx, &p_avg_lr_fx[nr_fc_fft_filter], pCoherence_fx, factorQ, sample_rates[indSR], nr_fc_fft_filter );
-#else
- update_c_file_with_reverb( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], nr_fc_fft_filter );
-#endif
- }
-#if defined( FIX_1123_CREND_16BIT_FMT ) && !defined( FIX_1123_CREND_FLTFX_BE )
- make_reverb_fx_be( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR], &factorQ );
- for ( i = 0; i < nr_fc_fft_filter; i++ )
- {
- p_avg_lr_fx[i] = float2int16_t( p_avg_lr[i], factorQ );
- p_avg_lr_fx[i + nr_fc_fft_filter] = float2int16_t( p_avg_lr[i + nr_fc_fft_filter], factorQ );
- pCoherence_fx[i] = float2int16_t( pCoherence[i], factorQ );
}
-#endif
if ( binary_file_path != NULL )
{
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
if ( write_reverb_to_binary_file( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, factorQ, sample_rates[indSR] ) != IVAS_ERR_OK )
{
goto cleanup;
}
-#else
- if ( write_reverb_to_binary_file( p_avg_lr, &p_avg_lr[nr_fc_fft_filter], pCoherence, sample_rates[indSR] ) != IVAS_ERR_OK )
- {
- goto cleanup;
- }
-#endif
}
cleanup:
@@ -2226,11 +2149,7 @@ void write_array_int16_t_to_file( FILE *fp, int16_t *vec, int32_t size_vec, int3
/*---------------------------------------------------------------------*
*update_c_file_with_reverb();
*---------------------------------------------------------------------*/
-#ifdef FIX_1123_CREND_FLTFX_BE
void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, int16_t *pEner_l_fx, int16_t *pEner_r_fx, int16_t *pCoherence_fx, int16_t factorQ, const int32_t samplerate, const int16_t len )
-#else
-void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate, const int16_t len )
-#endif
{
char len_str[26] = "LR_IAC_LENGTH_NR_FC";
if ( samplerate == 16000 )
@@ -2286,11 +2205,7 @@ void update_c_file_with_reverb( float *pEner_l, float *pEner_r, float *pCoherenc
/*---------------------------------------------------------------------*
*update_c_file();
*---------------------------------------------------------------------*/
-#ifdef FIX_1123_CREND_FLTFX_BE
void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len, int16_t factorQ[3] )
-#else
-void update_c_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len )
-#endif
{
if ( c_file_path == NULL )
@@ -2737,7 +2652,6 @@ void get_binary_tables_dimensions( HRTFS_DATA *hrtf, crend_hrtf_tables_dimension
}
}
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
/*---------------------------------------------------------------------*
* compute_binary_size();
@@ -2785,11 +2699,7 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr
{
for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
hrtf_data_size += 2 * hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int16_t ); // 2* : re & im
-#else
- hrtf_data_size += 2 * hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int32_t ); // 2* : re & im
-#endif
}
}
}
@@ -2802,11 +2712,7 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr
{
for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int16_t ); // 2* : re & im
-#else
- hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int32_t ); // 2* : re & im
-#endif
}
}
}
@@ -2814,78 +2720,6 @@ uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hr
return hrtf_data_size;
}
-#else
-
-/*---------------------------------------------------------------------*
- * compute_binary_size();
- *---------------------------------------------------------------------*/
-uint32_t compute_binary_size( HRTFS_DATA *hrtf, crend_hrtf_tables_dimensions *hrtf_table_dims )
-{
- int16_t iIR, iIter, iChan;
- uint32_t hrtf_data_size;
-
- hrtf_data_size = 0;
-
- hrtf_data_size += sizeof( float ); // latency_s
- hrtf_data_size += sizeof( uint16_t ); // max_num_ir
- hrtf_data_size += sizeof( uint16_t ); // BINAURAL_CHANNELS
- hrtf_data_size += sizeof( int16_t ); // max_num_iterations
- hrtf_data_size += hrtf->max_num_ir * BINAURAL_CHANNELS * sizeof( uint16_t ); // num_iterations
- hrtf_data_size += hrtf->max_num_ir * BINAURAL_CHANNELS * hrtf->max_num_iterations * sizeof( uint16_t ); // pIndex_frequency_max_dyn
-
- hrtf_data_size += sizeof( int16_t ); // max_num_iterations_diffuse
-
- if ( hrtf_table_dims->max_num_iterations_diffuse != 0 )
- {
- hrtf_data_size += BINAURAL_CHANNELS * sizeof( uint16_t ); // num_iterations_diffuse
- // The size of pIndex_frequency_max_diffuse_dyn depends on num_iterations_diffuse
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- hrtf_data_size += hrtf->num_iterations_diffuse[iChan] * sizeof( uint16_t );
- }
- }
-
- hrtf_data_size += sizeof( uint16_t ); // index_frequency_max_diffuse
- hrtf_data_size += hrtf->max_num_ir * sizeof( float ) * BINAURAL_CHANNELS; // inv_diffuse_weight
-
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- hrtf_data_size += sizeof( uint32_t ); // max_total_num_fsamp_per_iteration
-#else
- hrtf_data_size += sizeof( uint16_t ); // max_total_num_fsamp_per_iteration
-#endif
-
- // The sizes of coeff_re & coeff_im depend on pIndex_frequency_max_dyn
- for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
- {
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ )
- {
- hrtf_data_size += 2 * hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float ); // 2* : re & im
- }
- }
- }
-
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- hrtf_data_size += sizeof( uint32_t ); // max_total_num_fsamp_per_iteration_diff
-#else
- hrtf_data_size += sizeof( uint16_t ); // max_total_num_fsamp_per_iteration_diff
-#endif
- if ( hrtf_table_dims->max_total_num_fsamp_per_iteration_diff != 0 )
- {
- // The sizes of coeff_diffuse_re & coeff_diffuse_im depend on pIndex_frequency_max_dyn
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ )
- {
- hrtf_data_size += 2 * hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float ); // 2* : re & im
- }
- }
- }
-
- return hrtf_data_size;
-}
-#endif
/*---------------------------------------------------------------------*
* make_fx_be();
*---------------------------------------------------------------------*/
@@ -3056,27 +2890,16 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
if ( maxVal > 0 )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
factorQ[2] = (int16_t) floorf( 15.f - logf( maxVal ) / logf( 2.f ) );
-#else
- factorQ[2] = (int16_t) floorf( 31.f - logf( maxVal ) / logf( 2.f ) );
-#endif
}
else
{
factorQ[2] = 0;
}
-#ifdef FIX_1123_CREND_16BIT_FMT
if ( factorQ[2] > 15 )
{
factorQ[2] = 15;
}
-#else
- if ( factorQ[2] > 31 )
- {
- factorQ[2] = 31;
- }
-#endif
// pOut_to_bin_re_dyn (The size depends on pIndex_frequency_max_dyn)
for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
@@ -3090,13 +2913,8 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ )
{
tmp = coeff_rptr[iTap];
-#ifdef FIX_1123_CREND_16BIT_FMT
tmp16 = float2int16_t( coeff_rptr[iTap], factorQ[2] );
coeff_rptr[iTap] = (float) tmp16 * powf( 2.f, -1.f * (float) factorQ[2] );
-#else
- tmp32 = float2int32_t( coeff_rptr[iTap], factorQ[2] );
- coeff_rptr[iTap] = (float) tmp32 * powf( 2.f, -1.f * (float) factorQ[2] );
-#endif
diff = fabsf( tmp - coeff_rptr[iTap] );
if ( maxDiff < diff )
{
@@ -3119,13 +2937,8 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ )
{
tmp = coeff_rptr[iTap];
-#ifdef FIX_1123_CREND_16BIT_FMT
tmp16 = float2int16_t( coeff_rptr[iTap], factorQ[2] );
coeff_rptr[iTap] = (float) tmp16 * powf( 2.f, -1.f * (float) factorQ[2] );
-#else
- tmp32 = float2int32_t( coeff_rptr[iTap], factorQ[2] );
- coeff_rptr[iTap] = (float) tmp32 * powf( 2.f, -1.f * (float) factorQ[2] );
-#endif
diff = fabsf( tmp - coeff_rptr[iTap] );
if ( maxDiff < diff )
{
@@ -3150,13 +2963,8 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ )
{
tmp = coeff_rptr[iTap];
-#ifdef FIX_1123_CREND_16BIT_FMT
tmp16 = float2int16_t( coeff_rptr[iTap], factorQ[2] );
coeff_rptr[iTap] = (float) tmp16 * powf( 2.f, -1.f * (float) factorQ[2] );
-#else
- tmp32 = float2int32_t( coeff_rptr[iTap], factorQ[2] );
- coeff_rptr[iTap] = (float) tmp32 * powf( 2.f, -1.f * (float) factorQ[2] );
-#endif
diff = fabsf( tmp - coeff_rptr[iTap] );
if ( maxDiff < diff )
{
@@ -3177,13 +2985,8 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ )
{
tmp = coeff_rptr[iTap];
-#ifdef FIX_1123_CREND_16BIT_FMT
tmp16 = float2int16_t( coeff_rptr[iTap], factorQ[2] );
coeff_rptr[iTap] = (float) tmp16 * powf( 2.f, -1.f * (float) factorQ[2] );
-#else
- tmp32 = float2int32_t( coeff_rptr[iTap], factorQ[2] );
- coeff_rptr[iTap] = (float) tmp32 * powf( 2.f, -1.f * (float) factorQ[2] );
-#endif
diff = fabsf( tmp - coeff_rptr[iTap] );
if ( maxDiff < diff )
{
@@ -3197,7 +3000,6 @@ ivas_error make_fx_be( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const
return IVAS_ERR_OK;
}
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
/*---------------------------------------------------------------------*
* write_binary_file();
*---------------------------------------------------------------------*/
@@ -3363,22 +3165,13 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg,
coeff_rptr = hrtf->pOut_to_bin_re_dyn[iIR][iChan];
for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int16_t );
-#else
- data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int32_t );
-#endif
// memcpy( hrtf_bin_wptr, coeff_rptr, data_size_tmp );
for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ )
{
tmp = coeff_rptr[iTap];
-#ifdef FIX_1123_CREND_16BIT_FMT
( (int16_t *) hrtf_bin_wptr )[iTap] = float2int16_t( coeff_rptr[iTap], factorQ[2] );
tmp2 = ( (float) ( ( (int16_t *) hrtf_bin_wptr )[iTap] ) ) * powf( 2.f, -1.f * (float) factorQ[2] );
-#else
- ( (int32_t *) hrtf_bin_wptr )[iTap] = float2int32_t( coeff_rptr[iTap], factorQ[2] );
- tmp2 = ( (float) ( ( (int32_t *) hrtf_bin_wptr )[iTap] ) ) * powf( 2.f, -1.f * (float) factorQ[2] );
-#endif
diff = fabsf( tmp - tmp2 );
if ( maxDiff < diff )
{
@@ -3399,21 +3192,12 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg,
coeff_rptr = hrtf->pOut_to_bin_im_dyn[iIR][iChan];
for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int16_t );
-#else
- data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( int32_t );
-#endif
for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ )
{
tmp = coeff_rptr[iTap];
-#ifdef FIX_1123_CREND_16BIT_FMT
( (int16_t *) hrtf_bin_wptr )[iTap] = float2int16_t( coeff_rptr[iTap], factorQ[2] );
tmp2 = ( (float) ( ( (int16_t *) hrtf_bin_wptr )[iTap] ) ) * powf( 2.f, -1.f * (float) factorQ[2] );
-#else
- ( (int32_t *) hrtf_bin_wptr )[iTap] = float2int32_t( coeff_rptr[iTap], factorQ[2] );
- tmp2 = ( (float) ( ( (int32_t *) hrtf_bin_wptr )[iTap] ) ) * powf( 2.f, -1.f * (float) factorQ[2] );
-#endif
diff = fabsf( tmp - tmp2 );
if ( maxDiff < diff )
{
@@ -3437,22 +3221,13 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg,
coeff_rptr = hrtf->pOut_to_bin_diffuse_re_dyn[iChan];
for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int16_t );
-#else
- data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int32_t );
-#endif
// memcpy( hrtf_bin_wptr, coeff_rptr, data_size_tmp );
for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ )
{
tmp = coeff_rptr[iTap];
-#ifdef FIX_1123_CREND_16BIT_FMT
( (int16_t *) hrtf_bin_wptr )[iTap] = float2int16_t( coeff_rptr[iTap], factorQ[2] );
tmp2 = ( (float) ( ( (int16_t *) hrtf_bin_wptr )[iTap] ) ) * powf( 2.f, -1.f * (float) factorQ[2] );
-#else
- ( (int32_t *) hrtf_bin_wptr )[iTap] = float2int32_t( coeff_rptr[iTap], factorQ[2] );
- tmp2 = ( (float) ( ( (int32_t *) hrtf_bin_wptr )[iTap] ) ) * powf( 2.f, -1.f * (float) factorQ[2] );
-#endif
diff = fabsf( tmp - tmp2 );
if ( maxDiff < diff )
{
@@ -3470,21 +3245,12 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg,
coeff_rptr = hrtf->pOut_to_bin_diffuse_im_dyn[iChan];
for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ )
{
-#ifdef FIX_1123_CREND_16BIT_FMT
data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int16_t );
-#else
- data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( int32_t );
-#endif
for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ )
{
tmp = coeff_rptr[iTap];
-#ifdef FIX_1123_CREND_16BIT_FMT
( (int16_t *) hrtf_bin_wptr )[iTap] = float2int16_t( coeff_rptr[iTap], factorQ[2] );
tmp2 = ( (float) ( ( (int16_t *) hrtf_bin_wptr )[iTap] ) ) * powf( 2.f, -1.f * (float) factorQ[2] );
-#else
- ( (int32_t *) hrtf_bin_wptr )[iTap] = float2int32_t( coeff_rptr[iTap], factorQ[2] );
- tmp2 = ( (float) ( ( (int32_t *) hrtf_bin_wptr )[iTap] ) ) * powf( 2.f, -1.f * (float) factorQ[2] );
-#endif
diff = fabsf( tmp - tmp2 );
if ( maxDiff < diff )
{
@@ -3521,294 +3287,6 @@ ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg,
return IVAS_ERR_OK;
}
-#else
-
-/*---------------------------------------------------------------------*
- * write_binary_file();
- *---------------------------------------------------------------------*/
-ivas_error write_binary_file( HRTFS_DATA *hrtf, struct ivas_layout_config lscfg, const int32_t samplerate, const int16_t frame_len )
-{
- FILE *output_binary_file;
-
- int16_t iIR, iIter, iChan, iTap;
- uint32_t data_size_tmp;
- float *coeff_rptr;
- crend_hrtf_tables_dimensions hrtf_table_dims;
-
- uint32_t hrtf_data_size;
- char *hrtf_bin = NULL, *hrtf_bin_wptr;
-
- char *binary_file_full_path = NULL;
-
- if ( hrtf == NULL )
- return IVAS_ERR_FAILED_ALLOC;
-
- if ( binary_file_path == NULL )
- return IVAS_ERR_FAILED_ALLOC;
-
- /* Binary file - block description :
-
- latency_s => float
-
- max_num_ir => uint16_t
- BINAURAL_CHANNELS => uint16_t (BINAURAL_CHANNELS)
-
- max_num_iterations => int16_t
- num_iterations => uint16_t[max_num_ir][BINAURAL_CHANNELS]
- pIndex_frequency_max_dyn => uint16_t[max_num_ir][BINAURAL_CHANNELS][max_num_iterations] (Pointer)
-
- max_num_iterations_diffuse => int16_t
- num_iterations_diffuse => uint16_t[BINAURAL_CHANNELS]
- pIndex_frequency_max_diffuse_dyn => uint16_t[BINAURAL_CHANNELS][max_num_iterations_diffuse] (Pointer)
-
- index_frequency_max_diffuse => uint16_t
- inv_diffuse_weight => float[BINAURAL_CHANNELS][max_num_ir]
-
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- max_total_num_fsamp_per_iteration => uint32_t
-#else
- max_total_num_fsamp_per_iteration => uint16_t
-#endif
- coeff_re => float[max_num_ir][BINAURAL_CHANNELS][max_total_num_fsamp_per_iteration] (Pointer)
- coeff_im => float[max_num_ir][BINAURAL_CHANNELS][max_total_num_fsamp_per_iteration] (Pointer)
-
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- max_total_num_fsamp_per_iteration_diff => uint32_t
-#else
- max_total_num_fsamp_per_iteration_diff => uint16_t
-#endif
- coeff_diffuse_re => float[BINAURAL_CHANNELS][max_total_num_fsamp_per_iteration] (Pointer)
- coeff_diffuse_im => float[BINAURAL_CHANNELS][max_total_num_fsamp_per_iteration] (Pointer)
- */
-
- get_binary_tables_dimensions( hrtf, &hrtf_table_dims );
-
- hrtf_data_size = compute_binary_size( hrtf, &hrtf_table_dims );
-
- hrtf_bin = NULL;
- hrtf_bin = (char *) malloc( hrtf_data_size );
- if ( hrtf_bin == NULL )
- return IVAS_ERR_FAILED_ALLOC;
- memset( hrtf_bin, 0x00, hrtf_data_size );
- hrtf_bin_wptr = hrtf_bin;
-
- // Write the HRTF raw data
-
- ( (float *) hrtf_bin_wptr )[0] = hrtf->latency_s;
- hrtf_bin_wptr += sizeof( float );
-
- ( (uint16_t *) hrtf_bin_wptr )[0] = hrtf->max_num_ir;
- hrtf_bin_wptr += sizeof( uint16_t );
-
- ( (uint16_t *) hrtf_bin_wptr )[0] = BINAURAL_CHANNELS;
- hrtf_bin_wptr += sizeof( uint16_t );
-
-
- ( (int16_t *) hrtf_bin_wptr )[0] = hrtf->max_num_iterations; // max_num_iterations
- hrtf_bin_wptr += sizeof( int16_t );
-
- data_size_tmp = hrtf->max_num_ir * BINAURAL_CHANNELS * sizeof( uint16_t );
- memcpy( hrtf_bin_wptr, hrtf->num_iterations, data_size_tmp ); // num_iterations
- hrtf_bin_wptr += data_size_tmp;
-
- // pIndex_frequency_max_dyn
- data_size_tmp = hrtf->max_num_iterations * sizeof( uint16_t );
- for ( int iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
- {
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max_dyn[iIR][iChan], data_size_tmp );
- hrtf_bin_wptr += data_size_tmp;
- }
- }
-
- memcpy( hrtf_bin_wptr, &( hrtf_table_dims.max_num_iterations_diffuse ), sizeof( int16_t ) ); // max_num_iterations_diffuse
- hrtf_bin_wptr += sizeof( int16_t );
-
- if ( hrtf_table_dims.max_num_iterations_diffuse != 0 )
- {
- data_size_tmp = BINAURAL_CHANNELS * sizeof( uint16_t );
- memcpy( hrtf_bin_wptr, hrtf->num_iterations_diffuse, data_size_tmp ); // num_iterations_diffuse
- hrtf_bin_wptr += data_size_tmp;
-
- // pIndex_frequency_max_diffuse_dyn (the size depends on num_iterations_diffuse)
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- data_size_tmp = hrtf->num_iterations_diffuse[iChan] * sizeof( uint16_t );
- memcpy( hrtf_bin_wptr, hrtf->pIndex_frequency_max_diffuse_dyn[iChan], data_size_tmp );
- hrtf_bin_wptr += data_size_tmp;
- }
- }
-
- memcpy( hrtf_bin_wptr, &( hrtf->index_frequency_max_diffuse ), sizeof( uint16_t ) ); // index_frequency_max_diffuse
- hrtf_bin_wptr += sizeof( uint16_t );
-
- for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iIR] = hrtf->inv_diffuse_weight[0][iIR];
-#else
- sprintf( tmpStr, FORMAT_FLOAT, hrtf->inv_diffuse_weight[0][iIR] );
- sscanf( tmpStr, "%f", &( (float *) hrtf_bin_wptr )[iIR] );
-#endif
- }
-
- data_size_tmp = hrtf->max_num_ir * sizeof( float );
- hrtf_bin_wptr += data_size_tmp;
-
- for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iIR] = hrtf->inv_diffuse_weight[1][iIR];
-#else
- sprintf( tmpStr, FORMAT_FLOAT, hrtf->inv_diffuse_weight[1][iIR] );
- sscanf( tmpStr, "%f", &( (float *) hrtf_bin_wptr )[iIR] );
-#endif
- }
- data_size_tmp = hrtf->max_num_ir * sizeof( float );
- hrtf_bin_wptr += data_size_tmp;
-
-
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- memcpy( hrtf_bin_wptr, &( hrtf_table_dims.max_total_num_fsamp_per_iteration ), sizeof( uint32_t ) ); // max_total_num_fsamp_per_iteration
- hrtf_bin_wptr += sizeof( uint32_t );
-#else
- memcpy( hrtf_bin_wptr, &( hrtf_table_dims.max_total_num_fsamp_per_iteration ), sizeof( uint16_t ) ); // max_total_num_fsamp_per_iteration
- hrtf_bin_wptr += sizeof( uint16_t );
-#endif
-
-
- // pOut_to_bin_re_dyn (The size depends on pIndex_frequency_max_dyn)
- for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
- {
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- coeff_rptr = hrtf->pOut_to_bin_re_dyn[iIR][iChan];
- for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ )
- {
- data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float );
- // memcpy( hrtf_bin_wptr, coeff_rptr, data_size_tmp );
- for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap];
-#else
- //( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap];
- sprintf( tmpStr, FORMAT_FLOAT, coeff_rptr[iTap] );
- sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
-#endif
- }
- hrtf_bin_wptr += data_size_tmp;
- coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter];
- }
- }
- }
-
- // pOut_to_bin_im_dyn (The size depends on pIndex_frequency_max_dyn)
- for ( iIR = 0; iIR < hrtf->max_num_ir; iIR++ )
- {
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- coeff_rptr = hrtf->pOut_to_bin_im_dyn[iIR][iChan];
- for ( iIter = 0; iIter < hrtf->num_iterations[iIR][iChan]; iIter++ )
- {
- data_size_tmp = hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter] * sizeof( float );
- for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter]; iTap++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap];
-#else
- //( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap];
- sprintf( tmpStr, FORMAT_FLOAT, coeff_rptr[iTap] );
- sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
-#endif
- }
- hrtf_bin_wptr += data_size_tmp;
- coeff_rptr += hrtf->pIndex_frequency_max_dyn[iIR][iChan][iIter];
- }
- }
- }
-
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- memcpy( hrtf_bin_wptr, &( hrtf_table_dims.max_total_num_fsamp_per_iteration_diff ), sizeof( uint32_t ) ); // max_total_num_fsamp_per_iteration_diff
- hrtf_bin_wptr += sizeof( uint32_t );
-#else
- memcpy( hrtf_bin_wptr, &( hrtf_table_dims.max_total_num_fsamp_per_iteration_diff ), sizeof( uint16_t ) ); // max_total_num_fsamp_per_iteration_diff
- hrtf_bin_wptr += sizeof( uint16_t );
-#endif
-
- if ( hrtf_table_dims.max_total_num_fsamp_per_iteration_diff != 0 )
- {
- // pOut_to_bin_diffuse_re_dyn : The size depends on pIndex_frequency_max_diffuse_dyn
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- coeff_rptr = hrtf->pOut_to_bin_diffuse_re_dyn[iChan];
- for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ )
- {
- data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float );
- for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap];
-#else
- //( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap];
- sprintf( tmpStr, FORMAT_FLOAT, coeff_rptr[iTap] );
- sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
-#endif
- }
- hrtf_bin_wptr += data_size_tmp;
- coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter];
- }
- }
-
- // pOut_to_bin_diffuse_im_dyn : The size depends on pIndex_frequency_max_diffuse_dyn
- for ( iChan = 0; iChan < BINAURAL_CHANNELS; iChan++ )
- {
- coeff_rptr = hrtf->pOut_to_bin_diffuse_im_dyn[iChan];
- for ( iIter = 0; iIter < hrtf->num_iterations_diffuse[iChan]; iIter++ )
- {
- data_size_tmp = hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter] * sizeof( float );
- for ( iTap = 0; iTap < hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter]; iTap++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap];
-#else
- //( (float *) hrtf_bin_wptr )[iTap] = coeff_rptr[iTap];
- sprintf( tmpStr, FORMAT_FLOAT, coeff_rptr[iTap] );
- sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
-#endif
- }
- hrtf_bin_wptr += data_size_tmp;
- coeff_rptr += hrtf->pIndex_frequency_max_diffuse_dyn[iChan][iIter];
- }
- }
- }
-
- if ( hrtf_bin_wptr - hrtf_bin != hrtf_data_size )
- {
- free( hrtf_bin );
- return IVAS_ERR_FAILED_FILE_WRITE;
- }
-
- binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + strlen( lscfg.name ) + 2 + 2 + 3 + 4 + 1 ) );
- sprintf( binary_file_full_path, "%s_%s_%ikHz.bin", binary_file_path, lscfg.name, samplerate / 1000 );
- fprintf( stdout, "Write Binary file %s:\n", binary_file_full_path );
-
- output_binary_file = fopen( binary_file_full_path, "wb" );
- if ( output_binary_file == NULL )
- {
- free( hrtf_bin );
- return IVAS_ERR_FAILED_FILE_WRITE;
- }
- fwrite( hrtf_bin, hrtf_data_size, 1, output_binary_file );
- fclose( output_binary_file );
-
- free( hrtf_bin );
- free( binary_file_full_path );
-
- return IVAS_ERR_OK;
-}
-#endif
/*---------------------------------------------------------------------*
* make_fx_be();
*---------------------------------------------------------------------*/
@@ -3900,7 +3378,6 @@ ivas_error make_reverb_fx_be( float *pEner_l, float *pEner_r, float *pCoherence,
return IVAS_ERR_OK;
}
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
/*---------------------------------------------------------------------*
* write_reverb_to_binary_file();
*---------------------------------------------------------------------*/
@@ -4009,108 +3486,6 @@ ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *p
return IVAS_ERR_OK;
}
-#else
-
-/*---------------------------------------------------------------------*
- * write_binary_file();
- *---------------------------------------------------------------------*/
-ivas_error write_reverb_to_binary_file( float *pEner_l, float *pEner_r, float *pCoherence, const int32_t samplerate )
-{
- FILE *output_binary_file;
-
- int16_t iTap;
-#ifndef FIX_POINT_HRTF_FILE_FORMAT
- char tmpStr[64];
-#endif
- uint32_t hrtf_data_size;
-
- char *hrtf_bin = NULL, *hrtf_bin_wptr;
-
- char *binary_file_full_path = NULL;
-
- int16_t len = LR_IAC_LENGTH_NR_FC;
-
- if ( samplerate == 16000 )
- {
- len = LR_IAC_LENGTH_NR_FC_16KHZ;
- }
-
- if ( pEner_l == NULL )
- return IVAS_ERR_UNEXPECTED_NULL_POINTER;
-
- if ( pEner_r == NULL )
- return IVAS_ERR_UNEXPECTED_NULL_POINTER;
-
- if ( pCoherence == NULL )
- return IVAS_ERR_UNEXPECTED_NULL_POINTER;
-
- if ( binary_file_path == NULL )
- return IVAS_ERR_UNEXPECTED_NULL_POINTER;
-
- hrtf_bin = NULL;
- hrtf_data_size = sizeof( float ) * 3 * len;
- hrtf_bin = (char *) malloc( hrtf_data_size );
- if ( hrtf_bin == NULL )
- return IVAS_ERR_UNEXPECTED_NULL_POINTER;
- memset( hrtf_bin, 0x00, hrtf_data_size );
- hrtf_bin_wptr = hrtf_bin;
-
- for ( iTap = 0; iTap < len; iTap++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iTap] = pEner_l[iTap];
-#else
- sprintf( tmpStr, FORMAT_FLOAT, pEner_l[iTap] );
- sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
-#endif
- }
- hrtf_bin_wptr += sizeof( float ) * len;
- for ( iTap = 0; iTap < len; iTap++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iTap] = pEner_r[iTap];
-#else
- sprintf( tmpStr, FORMAT_FLOAT, pEner_r[iTap] );
- sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
-#endif
- }
- hrtf_bin_wptr += sizeof( float ) * len;
- for ( iTap = 0; iTap < len; iTap++ )
- {
-#ifdef FIX_POINT_HRTF_FILE_FORMAT
- ( (float *) hrtf_bin_wptr )[iTap] = pCoherence[iTap];
-#else
- sprintf( tmpStr, FORMAT_FLOAT, pCoherence[iTap] );
- sscanf( tmpStr, "%f", &( ( (float *) hrtf_bin_wptr )[iTap] ) );
-#endif
- }
- hrtf_bin_wptr += sizeof( float ) * len;
-
- if ( hrtf_bin_wptr - hrtf_bin != hrtf_data_size )
- {
- free( hrtf_bin );
- return IVAS_ERR_FAILED_FILE_WRITE;
- }
-
- binary_file_full_path = (char *) malloc( sizeof( char ) * ( strlen( binary_file_path ) + strlen( "Reverb" ) + 2 + 2 + 3 + 4 + 1 ) );
- sprintf( binary_file_full_path, "%s_%s_%ikHz.bin", binary_file_path, "Reverb", samplerate / 1000 );
- fprintf( stdout, "Write Binary file %s:\n", binary_file_full_path );
-
- output_binary_file = fopen( binary_file_full_path, "wb" );
- if ( output_binary_file == NULL )
- {
- free( hrtf_bin );
- return IVAS_ERR_FAILED_FILE_WRITE;
- }
- fwrite( hrtf_bin, hrtf_data_size, 1, output_binary_file );
- fclose( output_binary_file );
-
- free( hrtf_bin );
- free( binary_file_full_path );
-
- return IVAS_ERR_OK;
-}
-#endif
/*---------------------------------------------------------------------*
*get_ls_layout_config( AUDIO_CONFIG_CONFIG ls_layout_config, struct ivas_layout_config *ls_struct )
* fill ls_struct with proper values depending on ls_layout_config
diff --git a/scripts/create_histogram_summary.py b/scripts/create_histogram_summary.py
index 1ab951ac72af1f926a3a0bc7d5ba08bda781a9ef..6e940c883af20185c5559cbd85428867b237eb5c 100644
--- a/scripts/create_histogram_summary.py
+++ b/scripts/create_histogram_summary.py
@@ -3,14 +3,16 @@
import argparse
import math
import numpy as np
+
# These next three lines are added as a precaution in case the gitlab runner
# needs DISPLAY to render the plots, even if they are written to file.
import matplotlib
+
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import csv
import os
-from parse_xml_report import FORMATS, CATEGORIES
+from parse_xml_report import IVAS_FORMATS, EVS_FORMATS, IVAS_CATEGORIES, EVS_CATEGORIES
"""
Parses a CSV report and creates a summary report.
@@ -44,11 +46,22 @@ if __name__ == "__main__":
help="Measure, any of: MLD, DIFF, SSNR, default: MLD",
default=["MLD"],
)
+ parser.add_argument(
+ "--evs",
+ action="store_true",
+ help="Parse using EVS 26.444 formats",
+ )
args = parser.parse_args()
csv_report = args.csv_report
csv_summary = args.csv_summary
csv_image = args.csv_image
measure = args.measure[0]
+ if args.evs:
+ FORMATS = EVS_FORMATS
+ CATEGORIES = EVS_CATEGORIES
+ else:
+ FORMATS = IVAS_FORMATS
+ CATEGORIES = IVAS_CATEGORIES
limits_per_measure = {
"MLD": ("MLD", [0, 5, 10, math.inf]),
diff --git a/scripts/parse_xml_report.py b/scripts/parse_xml_report.py
index 366e02aba5ae14fc2ca203c5bda1db1699a751f2..3be7a9ca0b62e62d2469a07c9142a8fdd3879a84 100644
--- a/scripts/parse_xml_report.py
+++ b/scripts/parse_xml_report.py
@@ -12,7 +12,7 @@ Parse a junit report and create a summary report.
PROPERTIES = ["MLD", "MAXIMUM ABS DIFF", "MIN_SSNR", "MIN_ODG"]
-FORMATS = {
+IVAS_FORMATS = {
"Stereo": r"stereo",
"ISM": r"ISM",
"Multichannel": r"Multi-channel",
@@ -23,7 +23,16 @@ FORMATS = {
"Renderer": r"renderer",
}
-CATEGORIES = {
+EVS_FORMATS = {
+ "AMRWBIO_dec": r"Readme_AMRWB_IO_dec",
+ "AMRWBIO_enc": r"Readme_AMRWB_IO_enc",
+ "EVS_dec": r"Readme_EVS_dec",
+ "EVS_enc": r"Readme_EVS_enc",
+ "EVS_JBM_dec": r"Readme_JBM_dec",
+}
+
+
+IVAS_CATEGORIES = {
"Normal operation": r".*",
"DTX": r"DTX",
"PLC": r"%",
@@ -31,6 +40,14 @@ CATEGORIES = {
"JBM": r"JBM",
}
+EVS_CATEGORIES = {
+ "Normal operation": r".*",
+ "DTX": r"DTX",
+ "PLC": r"b10|f06",
+ "Bitrate switching": r"sw",
+ "JBM": r"JBM",
+}
+
# Main routine
if __name__ == "__main__":
parser = argparse.ArgumentParser(
@@ -42,10 +59,20 @@ if __name__ == "__main__":
help="XML junit report input file, e.g. report-junit.xml",
)
parser.add_argument("csv_file", type=str, help="Output CSV file, e.g. report.csv")
+ parser.add_argument(
+ "--evs",
+ action="store_true",
+ help="Parse using EVS 26.444 formats",
+ )
args = parser.parse_args()
xml_report = args.xml_report
csv_file = args.csv_file
-
+ if args.evs:
+ FORMATS = EVS_FORMATS
+ CATEGORIES = EVS_CATEGORIES
+ else:
+ FORMATS = IVAS_FORMATS
+ CATEGORIES = IVAS_CATEGORIES
tree = ElementTree.parse(xml_report)
testsuite = tree.find(".//testsuite")
diff --git a/tests/cmp_pcm.py b/tests/cmp_pcm.py
index e299047492f8a3d5922d2c1d750253556f07616c..5b335840e6634ed3286c4fe0ecc99eaa2bad3302 100755
--- a/tests/cmp_pcm.py
+++ b/tests/cmp_pcm.py
@@ -128,18 +128,26 @@ def cmp_pcm(
def pqevalaudio_wrapper(
- ref_sig: np.ndarray,
- eval_sig: np.ndarray,
- fs: int,
- ) -> str:
+ ref_sig: np.ndarray,
+ eval_sig: np.ndarray,
+ fs: int,
+) -> str:
with tempfile.TemporaryDirectory() as tmp_dir:
tmp_dir = Path(tmp_dir)
tmp_file_ref = str(tmp_dir.joinpath("ref.wav"))
tmp_file_eval = str(tmp_dir.joinpath("eval.wav"))
# PQevalAudio neeeds 48 kHz sampling rate
- r48 = np.clip( pyaudio3dtools.audioarray.resample(ref_sig.astype(float), fs, 48000), -32768, 32767 ).astype(np.int16)
- t48 = np.clip( pyaudio3dtools.audioarray.resample(eval_sig.astype(float), fs, 48000), -32768, 32767 ).astype(np.int16)
+ r48 = np.clip(
+ pyaudio3dtools.audioarray.resample(ref_sig.astype(float), fs, 48000),
+ -32768,
+ 32767,
+ ).astype(np.int16)
+ t48 = np.clip(
+ pyaudio3dtools.audioarray.resample(eval_sig.astype(float), fs, 48000),
+ -32768,
+ 32767,
+ ).astype(np.int16)
pyaudio3dtools.audiofile.writefile(tmp_file_ref, r48, 48000)
pyaudio3dtools.audiofile.writefile(tmp_file_eval, t48, 48000)
@@ -167,6 +175,7 @@ if __name__ == "__main__":
parser.add_argument("-s", "--sampling_rate", type=int, default=48000, dest="fs")
parser.add_argument("--get_mld", action="store_true")
parser.add_argument("--mld_lim", type=float, default=0, dest="mld_lim")
+ parser.add_argument("--get_odg", action="store_true")
args = parser.parse_args()
result, msg = cmp_pcm(**vars(args))
diff --git a/tests/test_26444.py b/tests/test_26444.py
index d23c01e8a83d389eb1e6b07d2273236391334039..fa6214c66a8c5164ba636346839c8041aa7ae197 100644
--- a/tests/test_26444.py
+++ b/tests/test_26444.py
@@ -34,9 +34,13 @@ Execute tests specified via a parameter file.
import filecmp
import os
-import subprocess
-
+import re
import pytest
+import shutil
+
+from tests.cmp_pcm import cmp_pcm
+from tests.conftest import DecoderFrontend, EncoderFrontend, parse_properties
+
test_dict = {}
TEST_DIR = "evs_be_test"
@@ -47,6 +51,7 @@ scripts = [
"Readme_EVS_enc.txt",
"Readme_JBM_dec.txt",
]
+
for s in scripts:
with open(os.path.join(TEST_DIR, s), "r", encoding="UTF-8") as fp:
tag = ""
@@ -70,62 +75,116 @@ for s in scripts:
dec_opts = ""
diff_opts = ""
+
@pytest.mark.parametrize("test_tag", list(test_dict.keys()))
-def test_evs_26444(runner_frontend, test_tag):
+def test_evs_26444(
+ record_property,
+ props_to_record,
+ dut_encoder_frontend: EncoderFrontend,
+ dut_decoder_frontend: DecoderFrontend,
+ ref_decoder_frontend: DecoderFrontend,
+ test_tag,
+ get_mld,
+ get_mld_lim,
+ abs_tol,
+ get_ssnr,
+ get_odg,
+):
enc_opts, dec_opts, diff_opts = test_dict[test_tag]
-
- result = None
- if enc_opts:
- enc_opts = enc_opts.replace("./", TEST_DIR + "/")
- enc_opts = enc_opts.replace("-rf rf_config.cfg", "-rf " + TEST_DIR + "/rf_config.cfg") # Special handling of this arguments since the path is missing
- cmd = ["./IVAS_cod", "-q"] + enc_opts.split()[1:]
- print(" ".join(["Encoder command: "] + cmd))
- runner_frontend.run(cmd)
- if dec_opts:
- dec_opts = dec_opts.replace("./", TEST_DIR + "/")
- cmd = ["./IVAS_dec", "-q"] + dec_opts.split()[1:]
- print(" ".join(["Decoder command: "] + cmd))
- runner_frontend.run(cmd)
-
- result = runner_frontend.result
-
- if result != None and result.returncode:
- pytest.fail("Non-zero returncode for command: " + " ".join(cmd))
diff_opts = diff_opts.replace("./", TEST_DIR + "/")
- if ";" in diff_opts:
- cmd1, cmd2 = diff_opts.split(";")
- cmd1 = cmd1.split()
- cmd2 = cmd2.split()
- result1 = filecmp.cmp(cmd1[0], cmd1[1])
- result2 = filecmp.cmp(cmd2[2], cmd2[3])
- else:
- cmd1 = diff_opts.split()
- result1 = filecmp.cmp(cmd1[0], cmd1[1])
- result2 = True
- if not (result1 and result2):
- pytest.fail("Output differs")
+ if enc_opts:
+ args = enc_opts.split()[1:]
+
+ bitrate = args[-4]
+ sampling_rate = args[-3]
+ in_file = args[-2]
+ out_file = args[-1]
+ add_option_list = args[:-4]
+
+ dut_encoder_frontend.run(
+ bitrate,
+ sampling_rate,
+ in_file,
+ out_file,
+ add_option_list=add_option_list,
+ run_dir=TEST_DIR,
+ )
-class Runner:
- def __init__(self) -> None:
- self.returncode = None
- self.result = None
-
- def run(self, cmd: str) -> None:
- result = subprocess.run(cmd, capture_output=True, check=False)
- self.result = result
- self.returncode = result.returncode
-
- def _check_run(self):
- if self.returncode is not None:
- if self.returncode:
- pytest.fail( "Command terminated with a non-0 return code" )
-
-@pytest.fixture(scope="function")
-def runner_frontend() -> Runner:
- runner = Runner()
- yield runner
-
- # Fixture teardown
- runner._check_run()
+ if dec_opts:
+ args = dec_opts.split()[1:]
+ output_config = "" # Empty for EVS operation
+ sampling_rate = args[-3]
+ in_file = args[-2]
+ out_file = args[-1]
+ add_option_list = args[:-3]
+
+ dut_decoder_frontend.run(
+ output_config,
+ sampling_rate,
+ in_file,
+ out_file,
+ add_option_list=add_option_list,
+ run_dir=TEST_DIR,
+ )
+
+ # Run comparison on encoder and decoder test cases
+ equal = True
+ for diff_opt in diff_opts.split(";"):
+ pattern = r"(\$DIFF_BIN\s?-w\s?)?"
+ diff_opt = re.sub(pattern, "", diff_opt).strip()
+ [ref, test] = diff_opt.split()[:2]
+ # Run audio file comparison if MLD/SSNR/PEAQ is requested and the test is either a bitstream or audio (not JBM tracefile)
+ # and the ref_decoder_path is specified (otherwise ref_decoder_frontend is None)
+ if (
+ (get_mld or get_ssnr or get_odg)
+ and ("COD" in ref or "OUT" in ref)
+ and ref_decoder_frontend
+ ):
+ if enc_opts:
+ for file in [ref, test]:
+ output_config = "" # Empty for EVS operation
+ in_file = file
+ out_file = file + ".wav"
+ add_option_list = []
+ ref_decoder_frontend.run(
+ output_config,
+ sampling_rate,
+ in_file,
+ out_file,
+ add_option_list=add_option_list,
+ )
+ fs = int(sampling_rate) * 1000
+ reffile = ref + ".wav"
+ testfile = test + ".wav"
+ else:
+ fs = int(re.search(r"(\d+)kHz", ref).group(1)) * 1000
+ # pyaudio3dtools.audiofile.readfile only handles .wav, .pcm and .raw suffixes.
+ reffile = ref + ".pcm"
+ testfile = test + ".pcm"
+ shutil.copy(ref, reffile)
+ shutil.copy(test, testfile)
+ output_differs, reason = cmp_pcm(
+ reffile,
+ testfile,
+ output_config,
+ fs,
+ get_mld=get_mld,
+ mld_lim=get_mld_lim,
+ abs_tol=abs_tol,
+ allow_differing_lengths=False,
+ get_ssnr=get_ssnr,
+ get_odg=get_odg,
+ )
+
+ props = parse_properties(reason, output_differs, props_to_record)
+ for k, v in props.items():
+ record_property(k, v)
+ equal &= not output_differs
+
+ else:
+ equal &= filecmp.cmp(ref, test)
+
+ if not equal:
+ pytest.fail("Output differs")