Skip to content
This diff is collapsed.
......@@ -30,6 +30,10 @@
*******************************************************************************************************/
#ifndef _IVAS_ROM_TDBINAURALRENDERER_
#define _IVAS_ROM_TDBINAURALRENDERER_
#include <stdint.h>
#include "options.h"
#ifdef DEBUGGING
......@@ -69,3 +73,4 @@ extern const uint32_t defaultHRIR_rom_ITD_azimBsShape[84];
extern const float defaultHRIR_rom_ITD_azimKSeq[19];
extern const uint32_t defaultHRIR_rom_ITD_elevBsShape[28];
extern const float defaultHRIR_rom_ITD_elevKSeq[16];
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -300,6 +300,8 @@ const float SincTable[321] =
0.00000000f
};
#ifndef FIX_638_ENERGIE_IAC_ROM_TABLES
const float defaultHRIR_coherence_48kHz[LR_IAC_LENGTH_NR_FC] = {
0.983003f, 0.933450f, 0.789276f, 0.574420f, 0.340710f, 0.144220f, 0.018803f, 0.000000f, 0.000000f,
0.000000f, 0.011939f, 0.035489f, 0.043188f, 0.042460f, 0.041788f, 0.038562f, 0.028911f, 0.017162f,
......@@ -397,7 +399,7 @@ const float defaultHRIR_right_avg_power_48kHz[LR_IAC_LENGTH_NR_FC] = {
};
const float defaultHRIR_coherence_32kHz[LR_IAC_LENGTH_NR_FC] = {
0.976959f, 0.962817f, 0.892107f, 0.783427f, 0.649433f, 0.488372f, 0.336040f, 0.196803f, 0.094108f,
0.976959f, 0.962817f, 0.892107f, 0.783427f, 0.649434f, 0.488372f, 0.336040f, 0.196803f, 0.094108f,
0.016852f, 0.004815f, 0.000000f, 0.000000f, 0.000000f, 0.002703f, 0.009460f, 0.024631f, 0.038937f,
0.041367f, 0.041308f, 0.039589f, 0.039056f, 0.037048f, 0.032828f, 0.024623f, 0.015933f, 0.009282f,
0.007047f, 0.007754f, 0.011823f, 0.015553f, 0.018773f, 0.021834f, 0.024812f, 0.027619f, 0.028707f,
......@@ -430,68 +432,69 @@ const float defaultHRIR_coherence_32kHz[LR_IAC_LENGTH_NR_FC] = {
const float defaultHRIR_left_avg_power_32kHz[LR_IAC_LENGTH_NR_FC] = {
1.042842f, 1.041052f, 1.032098f, 1.024347f, 1.017398f, 1.019204f, 1.022140f, 1.026773f, 1.026684f,
1.024560f, 1.019019f, 1.016692f, 1.016507f, 1.025484f, 1.035123f, 1.045753f, 1.050401f, 1.052033f,
1.024560f, 1.019019f, 1.016691f, 1.016507f, 1.025484f, 1.035123f, 1.045753f, 1.050401f, 1.052033f,
1.047590f, 1.042551f, 1.037116f, 1.034266f, 1.031619f, 1.029278f, 1.025989f, 1.022575f, 1.019610f,
1.017442f, 1.015805f, 1.012657f, 1.008261f, 1.001990f, 0.995937f, 0.990744f, 0.988777f, 0.988277f,
1.017441f, 1.015805f, 1.012657f, 1.008261f, 1.001990f, 0.995937f, 0.990744f, 0.988777f, 0.988277f,
0.988755f, 0.987563f, 0.985600f, 0.982481f, 0.980182f, 0.978414f, 0.977951f, 0.977129f, 0.976068f,
0.974020f, 0.972563f, 0.971992f, 0.973446f, 0.975452f, 0.977643f, 0.978631f, 0.978818f, 0.977682f,
0.976742f, 0.976096f, 0.975927f, 0.975729f, 0.974941f, 0.973370f, 0.971276f, 0.968762f, 0.966461f,
0.976742f, 0.976096f, 0.975927f, 0.975729f, 0.974942f, 0.973370f, 0.971276f, 0.968762f, 0.966461f,
0.964481f, 0.962731f, 0.960904f, 0.958549f, 0.955708f, 0.952543f, 0.949546f, 0.946857f, 0.944631f,
0.942410f, 0.939997f, 0.936815f, 0.933278f, 0.929505f, 0.926271f, 0.923282f, 0.920659f, 0.917696f,
0.942410f, 0.939998f, 0.936815f, 0.933278f, 0.929505f, 0.926271f, 0.923282f, 0.920659f, 0.917696f,
0.914482f, 0.910602f, 0.906806f, 0.903065f, 0.900364f, 0.897894f, 0.895772f, 0.893323f, 0.890740f,
0.887944f, 0.885641f, 0.883667f, 0.882835f, 0.882051f, 0.881336f, 0.880121f, 0.878813f, 0.877633f,
0.877223f, 0.877327f, 0.878409f, 0.879421f, 0.880327f, 0.881091f, 0.882024f, 0.883779f, 0.886402f,
0.877223f, 0.877327f, 0.878410f, 0.879421f, 0.880327f, 0.881091f, 0.882024f, 0.883779f, 0.886402f,
0.889602f, 0.893152f, 0.896459f, 0.899400f, 0.902225f, 0.905146f, 0.908573f, 0.912109f, 0.915718f,
0.918254f, 0.920227f, 0.921355f, 0.922089f, 0.922760f, 0.923576f, 0.924088f, 0.924398f, 0.923115f,
0.921260f, 0.918548f, 0.915643f, 0.912707f, 0.909842f, 0.906416f, 0.902615f, 0.897332f, 0.891877f,
0.886166f, 0.880998f, 0.875991f, 0.871078f, 0.865522f, 0.859537f, 0.852717f, 0.846083f, 0.839728f,
0.833972f, 0.828308f, 0.822411f, 0.816009f, 0.809271f, 0.802578f, 0.796320f, 0.790714f, 0.785846f,
0.781192f, 0.776652f, 0.772249f, 0.767940f, 0.764926f, 0.762667f, 0.761540f, 0.761326f, 0.761372f,
0.761547f, 0.761950f, 0.762506f, 0.764263f, 0.766400f, 0.769105f, 0.771504f, 0.773644f, 0.775056f,
0.776462f, 0.777865f, 0.779929f, 0.781942f, 0.783881f, 0.784915f, 0.785562f, 0.785567f, 0.785690f,
0.781192f, 0.776652f, 0.772249f, 0.767939f, 0.764926f, 0.762667f, 0.761540f, 0.761326f, 0.761372f,
0.761547f, 0.761950f, 0.762506f, 0.764263f, 0.766400f, 0.769105f, 0.771504f, 0.773645f, 0.775056f,
0.776463f, 0.777865f, 0.779929f, 0.781942f, 0.783881f, 0.784915f, 0.785562f, 0.785567f, 0.785690f,
0.785891f, 0.786286f, 0.786348f, 0.785912f, 0.784408f, 0.782509f, 0.780101f, 0.777798f, 0.775564f,
0.773205f, 0.770446f, 0.767088f, 0.762953f, 0.758652f, 0.754459f, 0.750714f, 0.747266f, 0.743818f,
0.740063f, 0.735847f, 0.731497f, 0.727285f, 0.723759f, 0.720587f, 0.717650f, 0.714166f, 0.710382f,
0.706148f, 0.702029f, 0.698046f, 0.694494f, 0.690839f, 0.687115f, 0.682535f, 0.677735f, 0.672604f,
0.667663f, 0.662868f, 0.658475f, 0.654061f, 0.649634f, 0.644689f, 0.639750f, 0.634821f, 0.630767f,
0.627153f, 0.624422f, 0.621650f, 0.618850f, 0.615731f, 0.613069f, 0.611089f, 0.610598f, 0.610566f,
0.610880f, 0.610933f, 0.610809f, 0.611930f, 0.614079f, 0.617771f, 0.622653f, 0.628199f, 0.635210f,
0.645081f, 0.656860f, 0.669006f, 0.673510f, 0.666552f, 0.628172f, 0.575127f, 0.494850f, 0.413951f,
0.610880f, 0.610933f, 0.610810f, 0.611930f, 0.614079f, 0.617771f, 0.622653f, 0.628199f, 0.635210f,
0.645081f, 0.656860f, 0.669006f, 0.673510f, 0.666552f, 0.628172f, 0.575128f, 0.494850f, 0.413951f,
0.332637f, 0.280816f, 0.241903f, 0.222353f, 0.218443f
};
const float defaultHRIR_right_avg_power_32kHz[LR_IAC_LENGTH_NR_FC] = {
1.042841f, 1.041051f, 1.032097f, 1.024346f, 1.017399f, 1.019202f, 1.022138f, 1.026772f, 1.026684f,
1.024560f, 1.019019f, 1.016691f, 1.016506f, 1.025485f, 1.035123f, 1.045752f, 1.050401f, 1.052035f,
1.024560f, 1.019019f, 1.016691f, 1.016506f, 1.025485f, 1.035123f, 1.045752f, 1.050401f, 1.052034f,
1.047590f, 1.042551f, 1.037115f, 1.034265f, 1.031619f, 1.029280f, 1.025989f, 1.022573f, 1.019609f,
1.017441f, 1.015805f, 1.012660f, 1.008264f, 1.001991f, 0.995937f, 0.990744f, 0.988778f, 0.988278f,
0.988755f, 0.987564f, 0.985601f, 0.982480f, 0.980182f, 0.978415f, 0.977953f, 0.977129f, 0.976065f,
0.988755f, 0.987564f, 0.985601f, 0.982480f, 0.980182f, 0.978415f, 0.977952f, 0.977129f, 0.976065f,
0.974019f, 0.972563f, 0.971995f, 0.973448f, 0.975452f, 0.977643f, 0.978632f, 0.978821f, 0.977685f,
0.976745f, 0.976097f, 0.975927f, 0.975729f, 0.974941f, 0.973370f, 0.971276f, 0.968759f, 0.966458f,
0.976745f, 0.976097f, 0.975927f, 0.975729f, 0.974941f, 0.973370f, 0.971276f, 0.968759f, 0.966457f,
0.964480f, 0.962731f, 0.960906f, 0.958547f, 0.955706f, 0.952543f, 0.949546f, 0.946857f, 0.944629f,
0.942409f, 0.939999f, 0.936815f, 0.933278f, 0.929507f, 0.926270f, 0.923280f, 0.920660f, 0.917696f,
0.942409f, 0.939999f, 0.936815f, 0.933278f, 0.929507f, 0.926271f, 0.923280f, 0.920660f, 0.917696f,
0.914481f, 0.910601f, 0.906806f, 0.903066f, 0.900365f, 0.897895f, 0.895772f, 0.893323f, 0.890740f,
0.887942f, 0.885640f, 0.883669f, 0.882835f, 0.882049f, 0.881335f, 0.880120f, 0.878812f, 0.877632f,
0.887942f, 0.885641f, 0.883669f, 0.882835f, 0.882049f, 0.881335f, 0.880120f, 0.878812f, 0.877632f,
0.877223f, 0.877328f, 0.878410f, 0.879422f, 0.880327f, 0.881092f, 0.882026f, 0.883781f, 0.886402f,
0.889601f, 0.893151f, 0.896457f, 0.899399f, 0.902224f, 0.905146f, 0.908576f, 0.912111f, 0.915716f,
0.889601f, 0.893150f, 0.896457f, 0.899399f, 0.902224f, 0.905146f, 0.908576f, 0.912111f, 0.915716f,
0.918254f, 0.920227f, 0.921354f, 0.922087f, 0.922759f, 0.923576f, 0.924090f, 0.924401f, 0.923115f,
0.921259f, 0.918547f, 0.915643f, 0.912708f, 0.909842f, 0.906416f, 0.902617f, 0.897334f, 0.891879f,
0.886168f, 0.881000f, 0.875992f, 0.871078f, 0.865522f, 0.859538f, 0.852719f, 0.846085f, 0.839728f,
0.833973f, 0.828309f, 0.822411f, 0.816009f, 0.809271f, 0.802579f, 0.796321f, 0.790714f, 0.785846f,
0.886167f, 0.881000f, 0.875992f, 0.871078f, 0.865522f, 0.859538f, 0.852719f, 0.846085f, 0.839728f,
0.833972f, 0.828309f, 0.822411f, 0.816009f, 0.809271f, 0.802579f, 0.796321f, 0.790714f, 0.785846f,
0.781192f, 0.776653f, 0.772250f, 0.767940f, 0.764926f, 0.762667f, 0.761541f, 0.761325f, 0.761371f,
0.761548f, 0.761950f, 0.762504f, 0.764263f, 0.766400f, 0.769104f, 0.771504f, 0.773644f, 0.775054f,
0.761548f, 0.761950f, 0.762504f, 0.764263f, 0.766400f, 0.769105f, 0.771504f, 0.773644f, 0.775054f,
0.776461f, 0.777866f, 0.779929f, 0.781942f, 0.783879f, 0.784913f, 0.785561f, 0.785567f, 0.785690f,
0.785891f, 0.786285f, 0.786348f, 0.785913f, 0.784409f, 0.782510f, 0.780103f, 0.777798f, 0.775563f,
0.773206f, 0.770449f, 0.767090f, 0.762954f, 0.758652f, 0.754458f, 0.750712f, 0.747266f, 0.743818f,
0.740062f, 0.735846f, 0.731497f, 0.727285f, 0.723759f, 0.720587f, 0.717649f, 0.714164f, 0.710381f,
0.785891f, 0.786285f, 0.786348f, 0.785913f, 0.784409f, 0.782510f, 0.780102f, 0.777798f, 0.775563f,
0.773206f, 0.770449f, 0.767089f, 0.762954f, 0.758652f, 0.754458f, 0.750712f, 0.747266f, 0.743818f,
0.740062f, 0.735846f, 0.731497f, 0.727286f, 0.723759f, 0.720587f, 0.717649f, 0.714164f, 0.710381f,
0.706148f, 0.702028f, 0.698044f, 0.694493f, 0.690838f, 0.687113f, 0.682535f, 0.677735f, 0.672602f,
0.667662f, 0.662869f, 0.658475f, 0.654061f, 0.649632f, 0.644687f, 0.639749f, 0.634820f, 0.630767f,
0.667662f, 0.662869f, 0.658476f, 0.654061f, 0.649632f, 0.644687f, 0.639749f, 0.634820f, 0.630767f,
0.627154f, 0.624423f, 0.621650f, 0.618849f, 0.615732f, 0.613069f, 0.611090f, 0.610599f, 0.610566f,
0.610881f, 0.610933f, 0.610811f, 0.611930f, 0.614078f, 0.617770f, 0.622653f, 0.628199f, 0.635210f,
0.645082f, 0.656861f, 0.669007f, 0.673511f, 0.666551f, 0.628170f, 0.575125f, 0.494849f, 0.413951f,
0.332639f, 0.280817f, 0.241904f, 0.222354f, 0.218443f
};
const float defaultHRIR_coherence_16kHz[LR_IAC_LENGTH_NR_FC] = {
0.969495f, 0.969495f, 0.955351f, 0.919989f, 0.884627f, 0.842799f, 0.775108f, 0.707416f, 0.639724f,
0.559264f, 0.478804f, 0.398344f, 0.327187f, 0.258355f, 0.189524f, 0.134064f, 0.087519f, 0.040974f,
......@@ -587,6 +590,8 @@ const float defaultHRIR_right_avg_power_16kHz[LR_IAC_LENGTH_NR_FC] = {
0.485566f, 0.481405f, 0.471746f, 0.440098f, 0.408450f, 0.376802f, 0.330743f, 0.284685f, 0.238626f,
0.203638f, 0.171419f, 0.139199f, 0.126311f, 0.126311f
};
#endif
/*----------------------------------------------------------------------------------*
* t-design and SN3D normalization table
*----------------------------------------------------------------------------------*/
......
......@@ -96,6 +96,7 @@ extern const int16_t HRTF_MODEL_N_CPTS_VAR[HRTF_MODEL_N_SECTIONS];
extern const float SincTable[321];
#ifndef FIX_638_ENERGIE_IAC_ROM_TABLES
extern const float defaultHRIR_coherence_48kHz[LR_IAC_LENGTH_NR_FC];
extern const float defaultHRIR_left_avg_power_48kHz[LR_IAC_LENGTH_NR_FC];
extern const float defaultHRIR_right_avg_power_48kHz[LR_IAC_LENGTH_NR_FC];
......@@ -107,6 +108,7 @@ extern const float defaultHRIR_right_avg_power_32kHz[LR_IAC_LENGTH_NR_FC];
extern const float defaultHRIR_coherence_16kHz[LR_IAC_LENGTH_NR_FC];
extern const float defaultHRIR_left_avg_power_16kHz[LR_IAC_LENGTH_NR_FC];
extern const float defaultHRIR_right_avg_power_16kHz[LR_IAC_LENGTH_NR_FC];
#endif
/*----------------------------------------------------------------------------------*
* t-design and SN3D normalization table
......
......@@ -583,6 +583,30 @@ static void ComputeCoeffs(
hMd->gd2 = gd_tmp[1];
}
else
{
if ( real_only )
{
float gd_tmp[BINAURAL_CHANNELS];
for ( i = 0; i < BINAURAL_CHANNELS; i++ )
{
gd_tmp[i] = cov_ii_re[i][i];
if ( gd_tmp[i] < EPSILON )
{
gd_tmp[i] = 1.0f;
}
else
{
gd_tmp[i] = ( cov_oo_re[i][i] ) / gd_tmp[i];
gd_tmp[i] = sqrtf( gd_tmp[i] );
}
hMd->pred_mat_re[i][i] = gd_tmp[i];
set_zero( hMd->pred_mat_im[i], BINAURAL_CHANNELS );
}
hMd->pred_mat_re[1][0] = 0.0f;
hMd->pred_mat_re[0][1] = 0.0f;
}
else
{
cov_norm_fact = GetNormFact( cov_ii_re, cov_ii_im, cov_io_re, cov_io_im, cov_oo_re );
......@@ -717,6 +741,7 @@ static void ComputeCoeffs(
}
}
}
}
return;
}
......@@ -1328,7 +1353,8 @@ void ivas_SplitRenderer_GetRotMd(
MULTI_BIN_REND_POSE_DATA *pMultiBinPoseData,
float Cldfb_RealBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
float Cldfb_ImagBuffer_Ref_Binaural[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX], /* o : Reference Binaural signals */
const int16_t low_res )
const int16_t low_res,
const int16_t ro_md_flag )
{
float cov_ii_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
float cov_oo_re[BINAURAL_CHANNELS][BINAURAL_CHANNELS];
......@@ -1363,7 +1389,7 @@ void ivas_SplitRenderer_GetRotMd(
start_slot_idx = sf_idx * num_slots;
for ( b = 0; b < num_md_bands; b++ )
{
if ( b < COMPLEX_MD_BAND_THRESH )
if ( ( b < SPLIT_REND_RO_MD_BAND_THRESH ) || ( !ro_md_flag && b < COMPLEX_MD_BAND_THRESH ) )
{
real_only = 0;
}
......@@ -1407,17 +1433,20 @@ void ivas_rend_CldfbSplitPreRendProcess(
float Cldfb_In_BinImag[][CLDFB_NO_COL_MAX][CLDFB_NO_CHANNELS_MAX],
IVAS_SPLIT_REND_BITS_HANDLE pBits,
const int32_t target_md_bits,
const int16_t low_res_pre_rend_rot )
const int16_t low_res_pre_rend_rot,
const int16_t ro_md_flag )
{
push_wmops( "ivas_rend_CldfbSplitPreRendProcess" );
ivas_SplitRenderer_GetRotMd( hBinHrSplitPreRend, pMultiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, low_res_pre_rend_rot );
ivas_SplitRenderer_GetRotMd( hBinHrSplitPreRend, pMultiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, low_res_pre_rend_rot, ro_md_flag );
ivas_SplitRenderer_quant_code( hBinHrSplitPreRend, headPosition, pMultiBinPoseData, pBits, low_res_pre_rend_rot, target_md_bits );
#ifdef SPLIT_POSE_CORRECTION_DEBUG
float tmpCrendBuffer[2][L_FRAME48k], quant_val, step, minv, maxv;
IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES];
IVAS_QUATERNION QuaternionsPost[MAX_PARAM_SPATIAL_SUBFRAMES], head_pos_euler;
float Cldfb_RealBuffer_Binaural_5ms[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
float Cldfb_ImagBuffer_Binaural_5ms[BINAURAL_CHANNELS][MAX_PARAM_SPATIAL_SUBFRAMES][CLDFB_NO_CHANNELS_MAX];
int16_t sf_idx, pos_idx, b, ch1, ch2;
int32_t read_off, write_off;
for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ )
......@@ -1444,7 +1473,11 @@ void ivas_rend_CldfbSplitPreRendProcess(
set_pose_types( hBinHrSplitPreRend->hBinHrSplitPostRend->pose_type, pMultiBinPoseData );
for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ )
{
hBinHrSplitPreRend->hBinHrSplitPostRend->QuaternionsPre[sf_idx] = headPositions[sf_idx];
Quat2EulerDegree( headPosition, &head_pos_euler.z, &head_pos_euler.y, &head_pos_euler.x );
hBinHrSplitPreRend->hBinHrSplitPostRend->QuaternionsPre[sf_idx].w = -3.0f;
hBinHrSplitPreRend->hBinHrSplitPostRend->QuaternionsPre[sf_idx].x = roundf( head_pos_euler.x );
hBinHrSplitPreRend->hBinHrSplitPostRend->QuaternionsPre[sf_idx].y = roundf( head_pos_euler.y );
hBinHrSplitPreRend->hBinHrSplitPostRend->QuaternionsPre[sf_idx].z = roundf( head_pos_euler.z );
}
for ( sf_idx = 0; sf_idx < 1; sf_idx++ )
{
......@@ -1453,12 +1486,12 @@ void ivas_rend_CldfbSplitPreRendProcess(
for ( b = 0; b < MAX_SPLIT_REND_MD_BANDS; b++ )
{
hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b] = hBinHrSplitPreRend->rot_md[pos_idx][sf_idx][b];
#if 0
#if 1
BIN_HR_SPLIT_REND_MD_HANDLE hMd;
hMd = &hBinHrSplitPreRend->hBinHrSplitPostRend->rot_md[pos_idx][sf_idx][b];
minv = -1.4f;
maxv = 1.4f;
step = ( maxv - minv ) / 30.0f;
step = ( maxv - minv ) / 62.0f;
if ( b >= 20 )
{
float sign;
......@@ -1496,7 +1529,13 @@ void ivas_rend_CldfbSplitPreRendProcess(
}
#endif
ivas_rend_CldfbSplitPostRendProcess( hBinHrSplitPreRend->hBinHrSplitPostRend, pMultiBinPoseData, QuaternionsPost, Cldfb_In_BinReal[0], Cldfb_In_BinImag[0], tmpCrendBuffer, 1 );
for ( sf_idx = 0; sf_idx < MAX_PARAM_SPATIAL_SUBFRAMES; sf_idx++ )
{
mvr2r( (float *) Cldfb_In_BinReal[0][sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES], (float *) Cldfb_RealBuffer_Binaural_5ms[0], MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX );
mvr2r( (float *) Cldfb_In_BinReal[1][sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES], (float *) Cldfb_RealBuffer_Binaural_5ms[1], MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX );
mvr2r( (float *) Cldfb_In_BinImag[0][sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES], (float *) Cldfb_ImagBuffer_Binaural_5ms[0], MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX );
mvr2r( (float *) Cldfb_In_BinImag[1][sf_idx * MAX_PARAM_SPATIAL_SUBFRAMES], (float *) Cldfb_ImagBuffer_Binaural_5ms[1], MAX_PARAM_SPATIAL_SUBFRAMES * CLDFB_NO_CHANNELS_MAX );
ivas_rend_CldfbSplitPostRendProcess( hBinHrSplitPreRend->hBinHrSplitPostRend, pMultiBinPoseData, QuaternionsPost[0], Cldfb_RealBuffer_Binaural_5ms, Cldfb_ImagBuffer_Binaural_5ms, tmpCrendBuffer, 1 );
{
float *pOut[2];
......@@ -1505,6 +1544,7 @@ void ivas_rend_CldfbSplitPreRendProcess(
pOut[1] = tmpCrendBuffer[1];
dbgwrite_wav( pOut, CLDFB_NO_COL_MAX * hBinHrSplitPreRend->hBinHrSplitPostRend->cldfbSyn[0]->no_channels, fname, 48000, 2 );
}
}
#endif
pop_wmops();
......@@ -1578,6 +1618,7 @@ ivas_error ivas_splitBinPreRendOpen(
ivas_split_rend_init_huff_cfg( &hBinRend->huff_cfg );
#ifdef SPLIT_POSE_CORRECTION_DEBUG
ivas_error error;
if ( ( error = ivas_splitBinPostRendOpen( &hBinRend->hBinHrSplitPostRend, pMultiBinPoseData, 48000 ) ) != IVAS_ERR_OK )
{
return error;
......@@ -2103,7 +2144,8 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
const int16_t max_bands,
float *in[],
const int16_t low_res_pre_rend_rot,
const int16_t pcm_out_flag )
const int16_t pcm_out_flag,
const int16_t ro_md_flag )
{
ivas_error error;
int32_t bit_len, available_bits, target_md_bits, actual_md_bits;
......@@ -2188,7 +2230,7 @@ static ivas_error ivas_renderMultiTDBinToSplitBinaural(
actual_md_bits = pBits->bits_written;
ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot );
ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot, ro_md_flag );
}
if ( pcm_out_flag == 0 )
......@@ -2329,7 +2371,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
float *output[],
const int16_t low_res_pre_rend_rot,
const int16_t cldfb_in_flag,
const int16_t pcm_out_flag )
const int16_t pcm_out_flag,
const int16_t ro_md_flag )
{
ivas_error error;
int32_t bit_len, target_md_bits, actual_md_bits, available_bits;
......@@ -2355,7 +2398,7 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
{
/*TD input*/
/*if CLDFB handles have been allocated then assume valid multi binaural input in out[][] buffer and perform CLDFB analysis*/
error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPosition, SplitRendBitRate, codec_frame_size_ms, pBits, max_bands, output, low_res_pre_rend_rot, pcm_out_flag );
error = ivas_renderMultiTDBinToSplitBinaural( hSplitBin, headPosition, SplitRendBitRate, codec_frame_size_ms, pBits, max_bands, output, low_res_pre_rend_rot, pcm_out_flag, ro_md_flag );
pop_wmops();
return error;
......@@ -2373,7 +2416,8 @@ ivas_error ivas_renderMultiBinToSplitBinaural(
target_md_bits = ivas_get_split_rend_md_target_brate( SplitRendBitRate, pcm_out_flag ) * L_FRAME48k / 48000;
actual_md_bits = pBits->bits_written;
ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot );
ivas_rend_CldfbSplitPreRendProcess( hSplitBin->hBinHrSplitPreRend, headPosition, &hSplitBin->multiBinPoseData, Cldfb_In_BinReal, Cldfb_In_BinImag, pBits, target_md_bits, low_res_pre_rend_rot, ro_md_flag );
}
if ( pcm_out_flag == 0 )
......
......@@ -1157,6 +1157,9 @@ typedef struct ivas_binaural_td_rendering_struct
float Gain; /* Mixer gain */
TDREND_MIX_Listener_t *Listener_p; /* The virtual listener */
TDREND_HRFILT_FiltSet_t *HrFiltSet_p; /* HR filter set */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
TDREND_HRFILT_FiltSet_t **pHrFiltSet_p; /* pointer to HR filter set */
#endif
int16_t UseCommonDistAttenModel; /* Use common dist atten model (TRUE/FALSE) */
int16_t DistAttenEnabled; /* (TRUE/FALSE) */
......@@ -1168,7 +1171,11 @@ typedef struct
{
int32_t binaural_latency_ns;
BINAURAL_TD_OBJECT_RENDERER_HANDLE hBinRendererTd;
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
TDREND_HRFILT_FiltSet_t **hHrtfTD;
#else
TDREND_HRFILT_FiltSet_t *hHrtfTD;
#endif
} TDREND_WRAPPER, *TDREND_WRAPPER_HANDLE;
......@@ -1191,7 +1198,15 @@ typedef struct ivas_hrtfs_structure
uint16_t index_frequency_max_diffuse;
int16_t max_num_ir;
int16_t max_num_iterations;
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
int16_t init_from_rom;
#endif
#ifdef FIX_INV_DIFFUSE_WEIGHT
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;
#else
float inv_diffuse_weight[MAX_INTERN_CHANNELS]; /* inverse diffuse weights array, access one inverse weight by pInvDiffuseWeight[channel] */
#endif
float gain_lfe;
} HRTFS_DATA, *HRTFS_HANDLE;
......@@ -1202,8 +1217,13 @@ typedef struct ivas_crend_state_t
{
float *freq_buffer_re[MAX_INTERN_CHANNELS];
float *freq_buffer_im[MAX_INTERN_CHANNELS];
#ifdef FIX_INV_DIFFUSE_WEIGHT
float *freq_buffer_re_diffuse[BINAURAL_CHANNELS];
float *freq_buffer_im_diffuse[BINAURAL_CHANNELS];
#else
float *freq_buffer_re_diffuse;
float *freq_buffer_im_diffuse;
#endif
float *prev_out_buffer[BINAURAL_CHANNELS];
float *lfe_delay_line;
float m_fYaw;
......@@ -1373,21 +1393,6 @@ typedef struct ivas_binaural_head_rot_split_rendering_huff_struct
} BIN_HR_SPLIT_REND_HUFF, *BIN_HR_SPLIT_REND_HUFF_HANDLE;
typedef struct ivas_binaural_head_rot_split_pre_rendering_struct
{
BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS];
float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1];
BIN_HR_SPLIT_REND_HUFF huff_cfg;
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
HANDLE_CLDFB_FILTER_BANK cldfbSynRotBinDec[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS];
#endif
#ifdef SPLIT_POSE_CORRECTION_DEBUG
BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend;
#endif
} BIN_HR_SPLIT_PRE_REND, *BIN_HR_SPLIT_PRE_REND_HANDLE;
typedef struct ivas_binaural_head_rot_split_post_rendering_struct
{
......@@ -1416,6 +1421,22 @@ typedef struct ivas_binaural_head_rot_split_post_rendering_struct
} BIN_HR_SPLIT_POST_REND, *BIN_HR_SPLIT_POST_REND_HANDLE;
typedef struct ivas_binaural_head_rot_split_pre_rendering_struct
{
BIN_HR_SPLIT_REND_MD rot_md[MAX_HEAD_ROT_POSES - 1][MAX_SPLIT_MD_SUBFRAMES][MAX_SPLIT_REND_MD_BANDS];
float fix_pos_rot_mat[MAX_HEAD_ROT_POSES - 1][BINAURAL_CHANNELS][BINAURAL_CHANNELS];
IVAS_SPLIT_REND_POSE_TYPE pose_type[MAX_HEAD_ROT_POSES - 1];
BIN_HR_SPLIT_REND_HUFF huff_cfg;
#ifdef SPLIT_REND_WITH_HEAD_ROT_DEBUG
HANDLE_CLDFB_FILTER_BANK cldfbSynRotBinDec[MAX_HEAD_ROT_POSES + 1][BINAURAL_CHANNELS];
#endif
#ifdef SPLIT_POSE_CORRECTION_DEBUG
BIN_HR_SPLIT_POST_REND_HANDLE hBinHrSplitPostRend;
#endif
} BIN_HR_SPLIT_PRE_REND, *BIN_HR_SPLIT_PRE_REND_HANDLE;
typedef struct ivas_binaural_head_rot_split_rendering_lcld_enc_struct
{
void *pLcld_enc;
......@@ -1626,7 +1647,11 @@ typedef struct ivas_masa_external_rendering_struct
#endif
REVERB_STRUCT_HANDLE hReverb;
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
HRTFS_PARAMBIN_HANDLE *hHrtfParambin;
#else
HRTFS_PARAMBIN_HANDLE hHrtfParambin;
#endif
VBAP_HANDLE hVBAPdata;
float *hoa_dec_mtx;
......
This diff is collapsed.
......@@ -128,6 +128,9 @@ 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 */
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
const bool asHrtfBinary, /* i : load hrtf binary file */
#endif
const int16_t nonDiegeticPan, /* i : non-diegetic object flag */
const float nonDiegeticPanGain, /* i : non-diegetic panning gain */
const int16_t num_subframes /* i : number of subframes */
......@@ -197,6 +200,30 @@ ivas_error IVAS_REND_GetDelay(
int32_t *timeScale /* o : Time scale of the delay, equal to renderer output sampling rate */
);
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
/*! r: error code */
ivas_error IVAS_REND_GetHrtfHandle(
IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */
IVAS_DEC_HRTF_HANDLE **hHrtfTD /* o : HRTF handle */
);
/*! r: error code */
ivas_error IVAS_REND_GetHrtfCRendHandle(
IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */
IVAS_DEC_HRTF_CREND_HANDLE **hSetOfHRTF /* o : Set of HRTF handle */
);
ivas_error IVAS_REND_GetHrtfFastConvHandle(
IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */
IVAS_DEC_HRTF_FASTCONV_HANDLE **hHrtfFastConv /* o : FASTCONV HRTF handle */
);
ivas_error IVAS_REND_GetHrtfParamBinHandle(
IVAS_REND_HANDLE hIvasRend, /* i/o: IVAS decoder handle */
IVAS_DEC_HRTF_PARAMBIN_HANDLE **hHrtfParambin /* o : Parametric binauralizer HRTF handle */
);
#endif
/* Functions to be called during rendering */
ivas_error IVAS_REND_FeedInputAudio(
......
This diff is collapsed.
......@@ -35,9 +35,23 @@
#include "common_api_types.h"
typedef struct hrtfFileReader hrtfFileReader;
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
typedef enum
{
HRTF_READER_RENDERER_BINAURAL_INVALID,
HRTF_READER_RENDERER_BINAURAL_FASTCONV,
HRTF_READER_RENDERER_BINAURAL_FASTCONV_ROOM,
HRTF_READER_RENDERER_BINAURAL_PARAMETRIC,
HRTF_READER_RENDERER_BINAURAL_PARAMETRIC_ROOM,
HRTF_READER_RENDERER_BINAURAL_OBJECTS_TD,
HRTF_READER_RENDERER_BINAURAL_MIXER_CONV,
HRTF_READER_RENDERER_BINAURAL_MIXER_CONV_ROOM,
HRTF_READER_RENDERER_BINAURAL_REVERB_ALL
} HRTF_READER_RENDERER_TYPE;
#endif
typedef struct ivas_hrtfs_header_t
{
int32_t rend_type;
......@@ -79,6 +93,18 @@ ivas_error load_HRTF_binary(
const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */
);
#ifdef FIX_638_ENERGIE_IAC_ROM_TABLES
/*---------------------------------------------------------------------*
* load_reverb_from_binary()
*
* Load reverb binary data into the HRTF handle
*---------------------------------------------------------------------*/
ivas_error load_reverb_binary(
IVAS_DEC_HRTF_HANDLE hHrtf, /* i/o: HRTF handle */
const hrtfFileReader *hrtfReader /* i/o: pointer to hrtfFileReader handle */
);
#endif
/*---------------------------------------------------------------------*
* create_SetOfHRTF_from_binary()
*
......@@ -91,16 +117,21 @@ ivas_error create_SetOfHRTF_from_binary(
int32_t output_Fs /* i : Output sampling frequency */
);
/*---------------------------------------------------------------------*
* destroy_SetOfHRTF()
*
* Destroy the HRTF data set.
*---------------------------------------------------------------------*/
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
void destroy_SetOfHRTF(
IVAS_DEC_HRTF_CREND_HANDLE *hSetOfHRTF /* i/o: Set of HRTF CRend handle */
);
#else
ivas_error destroy_SetOfHRTF(
IVAS_DEC_HRTF_CREND_HANDLE hSetOfHRTF /* i/o: Set of HRTF CRend handle */
);
#endif
/*---------------------------------------------------------------------*
......@@ -114,6 +145,17 @@ ivas_error load_fastconv_HRTF_from_binary(
const hrtfFileReader *hrtfReader /* i : pointer to hrtfFileReader handle */
);
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
/*---------------------------------------------------------------------*
* destroy_fastconv_hrtf()
*
* free memory allocated for FastConv HRTF binary data into the handle
*---------------------------------------------------------------------*/
void destroy_fastconv_hrtf(
IVAS_DEC_HRTF_FASTCONV_HANDLE *hHrtfFastConv /* i/o: FastConv HRTF handle */
);
#endif
/*---------------------------------------------------------------------*
* load_parambin_HRTF_from_binary()
......@@ -127,6 +169,28 @@ ivas_error load_parambin_HRTF_from_binary(
);
#ifdef NONBE_FIX_BINARY_BINAURAL_READING
/*---------------------------------------------------------------------*
* destroy_parambin_hrtf()
*
* free memory allocated for Parambin HRTF binary data into the handle
*---------------------------------------------------------------------*/
void destroy_parambin_hrtf(
IVAS_DEC_HRTF_PARAMBIN_HANDLE *hHrtfParambin /* i/o: Parambin HRTF handle */
);
/*---------------------------------------------------------------------*
* destroy_td_hrtf()
*
* Destroy the HRTF TD handle
*---------------------------------------------------------------------*/
void destroy_td_hrtf(
IVAS_DEC_HRTF_HANDLE *hHRTF /* i/o: HRTF handle */
);
#else
/*---------------------------------------------------------------------*
* dealloc_HRTF_binary()
*
......@@ -137,4 +201,5 @@ ivas_error dealloc_HRTF_binary(
IVAS_DEC_HRTF_HANDLE hHrtf /* i/o: HRTF handle */
);
#endif
#endif /* IVAS_HRTF_FILE_READER_H */
......@@ -435,7 +435,7 @@ static ivas_error read_bin_bits(
*pTarget = 0;
for ( n = 0; n < nBits; n++ )
{
nByte = ( this->readOffset + n ) >> 3;
nByte = (uint32_t) ( ( this->readOffset + n ) >> 3 );
bit = this->pBitstream[nByte] >> ( 7 - ( ( this->readOffset + n ) % 8 ) ) & 1;
*pTarget = ( *pTarget << 1 ) + bit;
}
......
......@@ -298,7 +298,11 @@ ivas_error split_rend_read_bits_from_file(
return IVAS_ERR_FAILED_FILE_READ;
}
#ifdef FIX_WARNING_SPLIT_RENDER
header_len = (int32_t) strlen( header );
#else
header_len = strlen( header );
#endif
/* read frame header */
for ( i = 0; i < header_len; i++ )
......
......@@ -91,6 +91,10 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript):
self.parser.add_argument(
"--rebuild", help="force a rebuild of the binaries", action="store_true"
)
self.parser.add_argument(
"--usan_supp_file", help="suppression file for undef behaviour sanitizer",
default=None,
)
def run(self):
......@@ -116,6 +120,11 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript):
else:
checks = self.args["checks"]
usan_supp_file = None
# need to convert to abs path as runtime dir will be different from calling dir
if self.args["usan_supp_file"] is not None:
usan_supp_file = os.path.abspath(self.args["usan_supp_file"])
if self.args["svn"]:
br = IvasBuilderAndRunner.fromSvn(
self.args["svn"],
......@@ -157,6 +166,7 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript):
format_select_list=modes,
formats_fname=self.args["format_file"],
max_workers=self.args["max_workers"],
usan_supp_file=usan_supp_file,
)
IvasScriptsCommon.runner_setup(
br.build_and_run_dict[check]["runner"], self.args
......@@ -168,8 +178,10 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript):
if self.args["rebuild"] == True:
br.force_build = True
checks_ret_val = list()
for check in checks:
br.run(check)
ret_val = br.run(check)
checks_ret_val.append(ret_val)
if self.args["create_html_output"]:
cmd = ["git", "rev-parse", "HEAD"]
commit_hash = subprocess.run(cmd, capture_output=True).stdout.decode("utf8")
......@@ -194,11 +206,11 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript):
)
returncode = 0
for check in checks:
for check, ret_val in zip(checks, checks_ret_val):
runner = br.build_and_run_dict[check]["runner"]
failed_encs = runner.failed_modes["enc"]
failed_decs = runner.failed_modes["dec"]
if len(failed_encs) > 0 or len(failed_decs) > 0:
if len(failed_encs) > 0 or len(failed_decs) > 0 or ret_val != 0:
returncode = RET_CODE_FAILURE
return returncode
......
......@@ -33,40 +33,52 @@
import argparse
import concurrent.futures
import os
import pathlib
import re
import shutil
import subprocess
import sys
import threading
from itertools import repeat
from pyaudio3dtools.audiofile import readfile
from pyaudio3dtools.audioarray import compare
FILES_EQUAL = "File A = File B"
SNR_EXPR = r"SNR\s+=(.+)dB\s*\(File B Gain = (.+)\)"
SNR_EXPR = r"SNR\s+=(.+)dB\s*\(.+= (.+)\)"
SEG_SNR_EXPR = r"Seg. SNR\s+=(.+)dB"
DIFF_EXPR = r"Max Diff\s+=\s+(\d+)"
DIFF_STR = {
"CompAudio": "{label} Max. diff (PCM) for file {f}: {diff}",
"mld": "{label} MLD diff for file {f}: {diff}",
}
def main(args):
if shutil.which("CompAudio") is None:
print("CompAudio not in PATH - abort.")
tool = args.tool
if shutil.which(tool) is None:
print(f"{tool} not in PATH - abort.")
sys.exit(-1)
num_files_diff = 0
with OutFileManager(args.out_file) as out_file:
if args.diffs_only:
print("Only printing differing files!", file=out_file)
print("Only printing differing files!")
fol1, fol2 = os.path.normpath(args.folder1), os.path.normpath(args.folder2)
common_files = get_common_files(fol1, fol2)
diff_files = get_diff_files(fol1, fol2)
num_files_diff = len(diff_files)
print(f"Comparing {len(common_files)} files...", file=out_file)
print(f"Comparing {len(common_files)} files...")
outputs = dict()
if args.num_threads > 1:
if args.num_threads == 1:
# if only one thread is passed, do everything in the main thread
# to allow for meaningful debugging if needed
for f in common_files:
compare_files(f, fol1, fol2, outputs, tool)
else:
with concurrent.futures.ThreadPoolExecutor(
max_workers=args.num_threads
) as exc:
......@@ -76,20 +88,26 @@ def main(args):
repeat(fol1),
repeat(fol2),
repeat(outputs),
repeat(tool),
)
else:
# if only one thread is passed, do everything in the main thread
# to allow for meaningful debugging if needed
for f in common_files:
compare_files(f, fol1, fol2, outputs)
if args.sort:
out = dict(sorted(outputs.items(), key=lambda item: item[1]))
else:
out = outputs
for f, output_tuple in out.items():
diff, snr, gain, seg_snr = output_tuple
# write csv header
if out_file is not None:
if tool == "CompAudio":
out_file.write("filename,diff\n")
elif tool == "mld":
out_file.write("filename,mld\n")
for f, tool_output in out.items():
if tool == "CompAudio":
diff, snr, gain, seg_snr = tool_output
elif tool == "mld":
diff = tool_output
if diff > 0:
num_files_diff = num_files_diff + 1
......@@ -99,38 +117,47 @@ def main(args):
label = "[OKAY]"
else:
label = "[FAIL]"
result = f"{label} Max. diff (PCM) for file {f}: {diff}"
result = DIFF_STR[tool].format(label=label, f=f, diff=diff)
if args.verbose and diff != 0.0:
if tool == "CompAudio" and args.verbose and diff != 0.0:
result += f", SNR = {snr:4.2f} dB (File 2 Gain = {gain:4.3f})"
result += f", Seg. SNR = {seg_snr:4.2f} dB"
print(result, file=out_file)
print(result)
if out_file is not None:
out_file.write(f"{f},{diff}\n")
if num_files_diff > 0:
print(f"{num_files_diff} files differ/don't exist", file=out_file)
print(f"{num_files_diff} files differ/don't exist")
else:
print(f"All files are bitexact", file=out_file)
print(f"All files are bitexact")
def compare_files(f, fol1, fol2, outputs_dict):
def compare_files(f, fol1, fol2, outputs_dict, tool):
"""
Compare file f in both folders fol1 and fol2 using CompAudio and
Compare file f in both folders fol1 and fol2 using the given tool and
store the parsed difference in outputs_dict.
"""
f1 = os.path.join(fol1, f)
f2 = os.path.join(fol2, f)
cmd = f"CompAudio {f1} {f2}"
if tool == "CompAudio":
cmd = f"{tool} {f1} {f2}"
try:
output = subprocess.check_output(cmd.split(" "))
except subprocess.CalledProcessError:
print("CompAudio returned a non-zero exit status. Check your files.")
print(f"{tool} returned a non-zero exit status. Check your files.")
sys.exit(-1)
output_tuple = _parse_comp_audio(output)
tool_output = _parse_comp_audio(output)
elif tool == "mld":
s1, fs1 = readfile(f1, outdtype="int16")
s2, fs2 = readfile(f2, outdtype="int16")
cmp_result = compare(s1, s2, fs1, per_frame=False, get_mld=True)
tool_output = cmp_result["MLD"]
with threading.Lock():
outputs_dict.update({f: output_tuple})
outputs_dict.update({f: tool_output})
def get_common_files(fol1, fol2):
......@@ -220,7 +247,6 @@ class OutFileManager:
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Compare .wav files in two folders using CompAudio"
)
......@@ -251,10 +277,16 @@ if __name__ == "__main__":
"--out_file",
type=str,
default=None,
help="If given, write output diffs to this file",
help="If given, write output diffs to this file as comma-separated values (csv)",
)
parser.add_argument(
"-t", "--num_threads", type=int, default=None, help="Number of threads to use"
)
parser.add_argument(
"-t", "--num_threads", type=int, default=1, help="Number of threads to use"
"--tool",
choices=["mld", "CompAudio"],
default="CompAudio",
help="Compare tool to run",
)
args = parser.parse_args()
......
......@@ -31,7 +31,7 @@
# Allows to convert SOFA file(s) to rom tables files (*.c|h) or binaural binary file(s)
## Requirements
- MATLAB >= R2020b
- MATLAB >= R2017b
- Signal Processing Toolbox
- C/C++ compiler
- Linux (Ubuntu) :
......@@ -89,7 +89,7 @@
- [`td_object_renderer`](../../scripts/td_object_renderer)
- See [`README.md`](../../scripts/td_object_renderer/modeling_tool/README.md) in the folder.
- Generate part of the ROM files [`ivas_rom_TdBinauralRenderer.h`](../../lib_rend/ivas_rom_TdBinauralRenderer.h), [`ivas_rom_TdBinauralRenderer.c`](../../lib_rend/ivas_rom_TdBinauralRenderer.c), and TD renderer binary file.
- **Warning**: The computed values depend on MATLAB and OS versions used. IVAS tests are still BE.
- **Warning**: The "fastconvReverberationTimes" computed values depend on MATLAB and OS versions used. Current values are computed with matlab 2017b on windows as mentioned in the rom file.
### SOFA files:
- HRIRs sofa files for testing are stored in [`HRIRs_sofa`](HRIRs_sofa) folder
......@@ -117,13 +117,3 @@ See [`scripts/ThirdPartyLegalNotices`](../../scripts/ThirdPartyLegalNotices) for
- `ivas_binaural_mixconv_hrir_*kHz.bin`: file containing tables values for IVAS mixer conv binaural renderer for HRIR for one sample rate.
- `ivas_binaural_mixconv_brir_*kHz.bin`: file containing tables values for IVAS mixer conv binaural renderer for BRIR for one sample rate.
- Without MATLAB only binary files for mixer conv renderer BRIR can be generated.
- Run, for example, to use IVAS renderer as a BRIR convolver run successively:
```shell
./generate_crend_ivas_tables -lib_rend_path ./ -brir_optim_config_path ./brir_no_optim.cfg -binary_files_path ./binaural_renderers_hrtf_data -binary_common_file_name IIS_BRIR_officialMPEG_Combined_no_optim 5 ./BRIRs_sofa/IIS_BRIR_officialMPEG_Combined.sofa
./tables_format_converter -output_file_path ../binaural_renderers_hrtf_data -output_file_name brir_no_optim -input_mixerconv_brir_file_path ../binaural_renderers_hrtf_data -input_mixerconv_brir_file_name IIS_BRIR_officialMPEG_Combined_no_optim
```
and then to complete, the `IVAS_rend` command line
```shell
IVAS_rend -hrtf ./scripts/binaurelRenderer_interface/binaural_renderers_hrtf_data/brir_no_optim_48kHz.bin ...
```
......@@ -27,8 +27,7 @@ set(SOURCE_FILES_C
${IVAS_REND_PATH}/ivas_rom_binauralRenderer.c
${IVAS_REND_PATH}/ivas_rom_binaural_crend_head.c
${IVAS_REND_PATH}/ivas_rom_rend.c
${IVAS_UTIL_PATH}/cmdl_tools.c
)
${IVAS_UTIL_PATH}/cmdl_tools.c)
set(SOURCE_FILES_H
${IVAS_REND_PATH}/ivas_rom_binauralRenderer.h
......