diff --git a/Workspace_msvc/lib_dec.vcxproj b/Workspace_msvc/lib_dec.vcxproj
index 3bde19ca477629259cb331c6220c55f063e40eb1..1241f11e30e1075f70a95aba6d0da9508ac3f558 100644
--- a/Workspace_msvc/lib_dec.vcxproj
+++ b/Workspace_msvc/lib_dec.vcxproj
@@ -307,6 +307,7 @@
+
diff --git a/Workspace_msvc/lib_dec.vcxproj.filters b/Workspace_msvc/lib_dec.vcxproj.filters
index 155b8dfc458ebc9e0526b83aab251c90a792f1ac..96ebc5c6d68bdad9595f7fa5d855bf8182cdf014 100644
--- a/Workspace_msvc/lib_dec.vcxproj.filters
+++ b/Workspace_msvc/lib_dec.vcxproj.filters
@@ -581,6 +581,9 @@
dec_ivas_c
+
+ dec_ivas_c
+
diff --git a/apps/decoder.c b/apps/decoder.c
index cb81edc24be6893e626bedca2d4d8e9e15b4b781..2e3816b41181456c57a8a4154fae849e48cce9af 100644
--- a/apps/decoder.c
+++ b/apps/decoder.c
@@ -425,11 +425,19 @@ int main(
IVAS_RENDER_CONFIG_DATA renderConfig;
/* sanity check */
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM && arg.outputFormat != IVAS_DEC_OUTPUT_MONO )
+ {
+ fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM or MONO is used as output. Exiting. \n" );
+ goto cleanup;
+ }
+#else
if ( arg.outputFormat != IVAS_DEC_OUTPUT_BINAURAL_ROOM )
{
fprintf( stderr, "\nExternal Renderer Config is supported only when BINAURAL_ROOM is used as output. Exiting. \n" );
goto cleanup;
}
+#endif
if ( ( error = IVAS_DEC_GetRenderConfig( hIvasDec, &renderConfig ) ) != IVAS_ERR_OK )
{
diff --git a/lib_com/common_api_types.h b/lib_com/common_api_types.h
index c27b7bc62852ca914519749fc693f8bf5d3fb54a..3f64942320e3262f32840eb2dc2a50fca7e0a3b5 100644
--- a/lib_com/common_api_types.h
+++ b/lib_com/common_api_types.h
@@ -46,6 +46,7 @@
#define IVAS_MAX_BITS_PER_FRAME ( 512000 / 50 )
#define IVAS_MAX_NUM_OBJECTS 4
#define IVAS_MAX_OUTPUT_CHANNELS 16
+#define IVAS_MAX_INPUT_CHANNELS 16
#define IVAS_CLDFB_NO_CHANNELS_MAX ( 60 )
/*----------------------------------------------------------------------------------*
@@ -101,20 +102,32 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
int16_t override;
int16_t use_brir;
int16_t late_reverb_on;
- int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */
- float pFc_input[IVAS_CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */
- float pAcoustic_rt60[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */
- float pAcoustic_dsr[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */
- float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */
- float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */
+ int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */
+ float pFc_input[IVAS_CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */
+ float pAcoustic_rt60[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */
+ float pAcoustic_dsr[IVAS_CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */
+ float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */
+ float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */
} IVAS_ROOM_ACOUSTICS_CONFIG_DATA;
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+typedef struct IVAS_PROXIMITY_CONFIG
+{
+ int16_t active; /* Flag to turn ON proximity-based mixing */
+ int16_t object_locations[IVAS_MAX_INPUT_CHANNELS]; /* user locations array for proximity-based mixing */
+ int16_t listener_location; /* listener location for proximity-based mixing */
+} IVAS_PROXIMITY_CONFIG;
+#endif
+
typedef struct _IVAS_RENDER_CONFIG
{
#ifdef DEBUGGING
IVAS_RENDER_TYPE_OVERRIDE renderer_type_override;
#endif
IVAS_ROOM_ACOUSTICS_CONFIG_DATA room_acoustics;
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ IVAS_PROXIMITY_CONFIG proxMix;
+#endif
} IVAS_RENDER_CONFIG_DATA, *IVAS_RENDER_CONFIG_HANDLE;
typedef struct _IVAS_LS_CUSTOM_LAYOUT
diff --git a/lib_com/ivas_prot.h b/lib_com/ivas_prot.h
index 0016a77f66be8903b95d323adb719c61e0b532bf..f50f0ec63040908dd26c97f6ef1e8a1fd2960d13 100644
--- a/lib_com/ivas_prot.h
+++ b/lib_com/ivas_prot.h
@@ -4769,7 +4769,6 @@ void computeReferencePower_enc(
const int16_t num_freq_bands /* i : Number of frequency bands */
);
-
ivas_error ivas_mono_dmx_renderer_open(
Decoder_Struct *st_ivas /* i/o: IVAS decoder structure */
);
@@ -5396,6 +5395,20 @@ void ivas_reverb_get_hrtf_set_properties(
);
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+/* Proximity-based mixing */
+ivas_error ivas_prox_mixer_compute_gains(
+ const int16_t userID,
+ float *pMixer,
+ const int16_t *userLoc,
+ const int16_t nChan,
+ float ppPcm_in[][L_FRAME48k],
+ const int16_t frame_len,
+ float *powvec
+);
+#endif
+
+
/* Orientation tracking */
void ivas_orient_trk_Init(
ivas_orient_trk_state_t *pOTR
diff --git a/lib_com/options.h b/lib_com/options.h
index 6a9861f02e0bd12c9d6893535260703d4528457c..218c978921cac2302560d21a64fe9803f3bcbfbb 100644
--- a/lib_com/options.h
+++ b/lib_com/options.h
@@ -58,6 +58,7 @@
#ifdef DEBUGGING
+/*#define DEBUG_PROX_MIX_INFO*/ /* proximity-based mixing debug details output */
/*#define MEM_COUNT_DETAILS*/ /* RAM counting tool: print per sub-structure details */
/*#define DEBUG_MODE_INFO*/ /* output most important parameters to the subdirectory "res/" */
@@ -146,6 +147,7 @@
/*#define FIX_IVAS_185_MDCT_ST_PLC_FADEOUT*/ /* IVAS-185 fix bug in TCX-PLC fadeout for MDCT-Stereo and improve fadeout by fading to background noise instead of white noise */
/*#define FIX_I1_113*/ /* under review : MCT bit distribution optimization for SBA high bitrates*/
+#define I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER /* Implement proximity-based mixing in ISM decoder/renderer */
#define FIX_ADAP_STEFI_SHIFT /* Issue 89: fix bug in parameter shift of adaptive stereo filling */
#define SPAR_SCALING_HARMONIZATION /* Issue 80: Changes to harmonize scaling in spar */
diff --git a/lib_dec/ivas_init_dec.c b/lib_dec/ivas_init_dec.c
index d8c14257bd195704ebf65ca429b0a120a184a1e0..37a35ff7931926b70e77d1a400307d4d03babe19 100644
--- a/lib_dec/ivas_init_dec.c
+++ b/lib_dec/ivas_init_dec.c
@@ -574,7 +574,12 @@ ivas_error ivas_init_decoder_front(
* Allocate and initialize Binaural Renderer configuration handle
*--------------------------------------------------------------------*/
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM ||
+ st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_MONO )
+#else
if ( st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL || st_ivas->hDecoderConfig->output_config == AUDIO_CONFIG_BINAURAL_ROOM )
+#endif
{
if ( ( error = ivas_render_config_open( &( st_ivas->hRenderConfig ) ) ) != IVAS_ERR_OK )
{
diff --git a/lib_dec/ivas_mono_dmx_renderer.c b/lib_dec/ivas_mono_dmx_renderer.c
index 468b0215b0f90bb7b486581bc5c69eacbdb8cfa0..0c492510d852895f39b33fbf7895f99c0afe2d5e 100644
--- a/lib_dec/ivas_mono_dmx_renderer.c
+++ b/lib_dec/ivas_mono_dmx_renderer.c
@@ -73,6 +73,24 @@ ivas_error ivas_mono_dmx_renderer_open(
st_ivas->hMonoDmxRenderer = hDownmix;
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ hDownmix->do_proximity_mixing = st_ivas->hRenderConfig->proxMix.active;
+ if ( hDownmix->do_proximity_mixing )
+ {
+ set_zero( hDownmix->powvec, MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS );
+ mvs2s( st_ivas->hRenderConfig->proxMix.objectLocations, hDownmix->userLoc, MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS );
+ hDownmix->listenerLoc = st_ivas->hRenderConfig->proxMix.listenerLocation;
+
+#ifdef DEBUG_PROX_MIX_INFO
+ int16_t channel_idx;
+ for ( channel_idx = 0 ; channel_idx < MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS; channel_idx++ )
+ {
+ printf("\n channel_idx = %d, userLoc = %d \n", channel_idx, hDownmix->userLoc[channel_idx] );
+ }
+#endif /* DEBUG_PROX_MIX_INFO */
+ }
+#endif /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
+
return IVAS_ERR_OK;
}
@@ -92,20 +110,89 @@ void ivas_mono_downmix_render_passive(
int16_t i, j, numInputChannels;
float proto_signal[L_FRAME48k], eq;
MONO_DOWNMIX_RENDERER_HANDLE hDownmix;
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ float prox_mixer_gains[MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS];
+#endif
numInputChannels = st_ivas->nSCE;
hDownmix = st_ivas->hMonoDmxRenderer;
set_zero( proto_signal, output_frame );
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ if ( hDownmix->do_proximity_mixing )
+ {
+ /* get the mixing matrix.. */
+ ivas_prox_mixer_compute_gains( hDownmix->listenerLoc, prox_mixer_gains, hDownmix->userLoc, numInputChannels, output_f, output_frame, hDownmix->powvec );
+
+#ifdef DEBUG_PROX_MIX_INFO
+ printf("\n\n prox_mixer_gains = ");
+ for ( i = 0; i < numInputChannels; i++ )
+ printf( "%.8f ", prox_mixer_gains[i] );
+
+ printf("\n hDownmix->powvec = ");
+ for ( i = 0; i < numInputChannels; i++ )
+ printf( "%.6e ", hDownmix->powvec[i] );
+
+ printf("\n");
+#endif /* DEBUG_PROX_MIX_INFO */
+
+ /* Compute the Proto Signal */
+ for ( i = 0; i < numInputChannels; i++ )
+ {
+ v_multc_acc( output_f[i], prox_mixer_gains[i], proto_signal, output_frame );
+ }
+ }
+ else
+ {
+ /* Compute the Proto Signal */
+ for ( i = 0; i < numInputChannels; i++ )
+ {
+ v_add( output_f[i], proto_signal, proto_signal, output_frame );
+ }
+ }
+#else /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
/* Compute the Proto Signal */
for ( i = 0; i < numInputChannels; i++ )
{
v_add( output_f[i], proto_signal, proto_signal, output_frame );
}
+#endif /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
/* compute the input energy, proto energy after smoothing */
hDownmix->inputEnergy[0] *= DOWNMIX_ALPHA;
hDownmix->protoEnergy[0] *= DOWNMIX_ALPHA;
+
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ if ( hDownmix->do_proximity_mixing )
+ {
+ for ( i = 0; i < output_frame; i++ )
+ {
+ hDownmix->protoEnergy[0] += proto_signal[i] * proto_signal[i];
+ }
+ for ( j = 0; j < numInputChannels; j++ )
+ {
+ const float mixer_gain_pow2 = prox_mixer_gains[j] * prox_mixer_gains[j];
+ if ( mixer_gain_pow2 > 0.0f )
+ {
+ for ( i = 0; i < output_frame; i++ )
+ {
+ hDownmix->inputEnergy[0] += output_f[j][i] * output_f[j][i];
+ }
+ }
+ }
+ }
+ else
+ {
+ for ( i = 0; i < output_frame; i++ )
+ {
+ hDownmix->protoEnergy[0] += proto_signal[i] * proto_signal[i];
+ for ( j = 0; j < numInputChannels; j++ )
+ {
+ hDownmix->inputEnergy[0] += ( output_f[j][i] * output_f[j][i] );
+ }
+ }
+ }
+#else /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
for ( i = 0; i < output_frame; i++ )
{
hDownmix->protoEnergy[0] += proto_signal[i] * proto_signal[i];
@@ -114,6 +201,7 @@ void ivas_mono_downmix_render_passive(
hDownmix->inputEnergy[0] += ( output_f[j][i] * output_f[j][i] );
}
}
+#endif /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
/* compute the eq factor */
eq = min( DOWNMIX_MAX_GAIN, sqrtf( hDownmix->inputEnergy[0] / ( EPSILON + hDownmix->protoEnergy[0] ) ) );
diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_prox_mix.c b/lib_dec/ivas_prox_mix.c
similarity index 74%
rename from scripts/ivas_pytests/tests/unit_tests/crend/ivas_prox_mix.c
rename to lib_dec/ivas_prox_mix.c
index 2bf19080e5f47a64fe793ec6ef4f3701056c0461..67f4999e431d4598bf51a2cdb553a4b496c063cd 100644
--- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_prox_mix.c
+++ b/lib_dec/ivas_prox_mix.c
@@ -44,91 +44,72 @@
#ifdef DEBUGGING
#include "debug.h"
#endif
-#include "ivas_prox_mix.h"
+#include "ivas_prot.h"
#include "wmops.h"
/*------------------------------------------------------------------------------------------*
* PreProcessor
*------------------------------------------------------------------------------------------*/
+#define POWER_FACT ( 1.0f )
+#define POWER_SMOOTH_HI ( 0.6f )
+#define POWER_SMOOTH_LO ( 0.9f )
/*------------------------------------------------------------------------------------------*
* Global variables
*------------------------------------------------------------------------------------------*/
-/*------------------------------------------------------------------------------------------*
- * Static functions declaration
- *------------------------------------------------------------------------------------------*/
-
-static float get_block_power( float *vec, int32_t frame_len );
-
/*------------------------------------------------------------------------------------------*
* function definitions
*------------------------------------------------------------------------------------------*/
-/*-----------------------------------------------------------------------------------------*
- * Function description - Returns mixer to combine uplink signals in an intelligent way to
- * prevent unnecessary reproduction of certain signals and prevent acoustic feedback.
- *
- * Inputs -
- * userID: a given user ID
- * bitstream: float of bitstream data containing co-located user IDs
- * pMixer: a 1-d mixer to be used in ivas_crend to combine the multichannel audio data into
- * a single Mono signal.
- * Outputs -
+ /*-------------------------------------------------------------------------
+ * ivas_prox_mixer_get_block_power()
*
- *
- *
- *-----------------------------------------------------------------------------------------*/
-
-ivas_result_t get_users_locations(
- uint8_t *bitstream,
- int32_t len,
- int16_t *userLoc )
+ * Compute the total power of the signal block
+ *------------------------------------------------------------------------*/
+static float ivas_prox_mixer_get_block_power(
+ const float *vec,
+ int16_t frame_len )
{
- /* userID = channelID starting from index=0 */
- int16_t nrLoc = 1;
- int32_t i;
+ int16_t i;
+ float pow;
+ pow = 0.0f;
- /* enter user location depending on position in userLoc array */
- for ( i = 0; i < len; i++ )
+ for ( i = 0; i < frame_len; i++ )
{
-
- if ( bitstream[i] == LOC_BITSTREAM_DELIMITER )
- {
- nrLoc++;
- }
- else
- {
- userLoc[bitstream[i]] = nrLoc;
- }
+ pow = pow + vec[i] * vec[i];
}
- return IVAS_SUCCESS;
+ return pow;
}
-
-ivas_result_t get_prox_downmix_mixer(
- int16_t userID,
+/*-------------------------------------------------------------------------
+ * ivas_prox_mixer_compute_gains()
+ *
+ * Compute mixing gains for proximity-based mixing functionality
+ *------------------------------------------------------------------------*/
+ivas_error ivas_prox_mixer_compute_gains(
+ const int16_t userID,
float *sMixer,
- int16_t *userLoc,
- int32_t nChan,
- float ppPcm_in[][L_FRAME48k],
- int32_t frame_len,
+ const int16_t *userLoc,
+ const int16_t nChan,
+ float ppPcm_in[][L_FRAME48k],
+ const int16_t frame_len,
float *powvec )
{
/* userID = channelID starting from index=0 */
- int16_t nrUsers = 0, nrLoc = 0;
- int32_t i, j;
- int16_t locIdx = 0;
+ int16_t nrUsers, nrLoc, i, j, locIdx;
float pow_1, pow_2;
- float *pow;
+ float pow[MAX_INPUT_CHANNELS];
- pow = (float *) calloc( nChan, sizeof( float ) );
+ nrUsers = 0;
+ nrLoc = 0;
+ locIdx = 0;
/* init */
for ( i = 0; i < nChan; i++ )
{
- pow[i] = get_block_power( ppPcm_in[i], frame_len );
+ pow[i] = ivas_prox_mixer_get_block_power( ppPcm_in[i], frame_len );
if ( pow[i] >= powvec[i] )
{
@@ -182,10 +163,7 @@ ivas_result_t get_prox_downmix_mixer(
sMixer[i] = 0.0f;
break;
}
- else
- {
- sMixer[j] = 0.0f;
- }
+ sMixer[j] = 0.0f;
}
}
}
@@ -207,23 +185,6 @@ ivas_result_t get_prox_downmix_mixer(
sMixer[i] = sMixer[i] / (float) nrUsers;
}
}
- free( pow );
-
- return IVAS_SUCCESS;
-}
-
-
-static float get_block_power(
- float *vec,
- int32_t frame_len )
-{
- int32_t i;
- float pow = 0.0f;
-
- for ( i = 0; i < frame_len; i++ )
- {
- pow = pow + vec[i] * vec[i];
- }
- return pow;
+ return IVAS_ERR_OK;
}
diff --git a/lib_dec/ivas_render_config.c b/lib_dec/ivas_render_config.c
index d03ce0fa75c0af967be2e73477b83303032a20ba..03704cdd7dbf689bd23d7a25817170c4fba5d91e 100644
--- a/lib_dec/ivas_render_config.c
+++ b/lib_dec/ivas_render_config.c
@@ -103,6 +103,11 @@ ivas_error ivas_render_config_init_from_rom(
#ifdef DEBUGGING
( *hRenderConfig )->renderer_type_override = RENDER_TYPE_OVERRIDE_NONE;
+#endif
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ ( *hRenderConfig )->proxMix.active = false;
+ set_s( ( *hRenderConfig )->proxMix.objectLocations, 0, MAX_INPUT_CHANNELS );
+ ( *hRenderConfig )->proxMix.listenerLocation = 0;
#endif
( *hRenderConfig )->roomAcoustics.override = false;
( *hRenderConfig )->roomAcoustics.use_brir = room_flag_on;
diff --git a/lib_dec/ivas_stat_dec.h b/lib_dec/ivas_stat_dec.h
index c773491d410632dc6dfa382db42b70b181d4d913..6b0fb557322b365a8f64cc14a82a6ab95c47fe07 100644
--- a/lib_dec/ivas_stat_dec.h
+++ b/lib_dec/ivas_stat_dec.h
@@ -1145,6 +1145,12 @@ typedef struct ivas_mono_downmix_renderer_struct
{
float inputEnergy[CLDFB_NO_CHANNELS_MAX];
float protoEnergy[CLDFB_NO_CHANNELS_MAX];
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ int16_t do_proximity_mixing;
+ int16_t listenerLoc;
+ int16_t userLoc[MAX_INPUT_CHANNELS];
+ float powvec[MAX_INPUT_CHANNELS];
+#endif /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
} MONO_DOWNMIX_RENDERER_STRUCT, *MONO_DOWNMIX_RENDERER_HANDLE;
@@ -1707,20 +1713,32 @@ typedef struct ivas_roomAcoustics_t
int16_t override;
int16_t use_brir;
int16_t late_reverb_on;
- int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */
- float pFc_input[CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */
- float pAcoustic_rt60[CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */
- float pAcoustic_dsr[CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */
- float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */
- float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */
+ int16_t nBands; /* Number of frequency bands for which reverb properties are provided, integer, range [2..256] */
+ float pFc_input[CLDFB_NO_CHANNELS_MAX]; /* Center frequencies for which following values are provided: */
+ float pAcoustic_rt60[CLDFB_NO_CHANNELS_MAX]; /* - The room's T60 per center frequency */
+ float pAcoustic_dsr[CLDFB_NO_CHANNELS_MAX]; /* - The room's Diffuse to Source Ratio per center frequency */
+ float acousticPreDelay; /* Time elapsed between input signal and late reverberation start, float, range [0.001..10] */
+ float inputPreDelay; /* Offset in seconds from where DSR is computed in the RIR (0 = at source), float, range [0.001..10] */
} ivas_roomAcoustics_t;
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+typedef struct ivas_proximity_t
+{
+ int16_t active; /* Flag to turn ON proximity-based mixing */
+ int16_t objectLocations[MAX_INPUT_CHANNELS]; /* user locations array for proximity-based mixing */
+ int16_t listenerLocation; /* listener location for proximity-based mixing */
+} ivas_proximity_t;
+#endif
+
typedef struct ivas_render_config_t
{
#ifdef DEBUGGING
ivas_renderTypeOverride renderer_type_override;
#endif
ivas_roomAcoustics_t roomAcoustics;
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ ivas_proximity_t proxMix;
+#endif
} RENDER_CONFIG_DATA, *RENDER_CONFIG_HANDLE;
diff --git a/lib_dec/lib_dec.c b/lib_dec/lib_dec.c
index 78b9f901aaf2d9d1ec8800d70234e89f7d2c66fa..bdb89b8883fe5629106ddbd9f6982c1fb9572515 100644
--- a/lib_dec/lib_dec.c
+++ b/lib_dec/lib_dec.c
@@ -992,6 +992,11 @@ ivas_error IVAS_DEC_GetRenderConfig(
mvr2r( hRCin->roomAcoustics.pAcoustic_rt60, hRCout->room_acoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX );
mvr2r( hRCin->roomAcoustics.pAcoustic_dsr, hRCout->room_acoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX );
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ hRCout->proxMix.active = hRCin->proxMix.active;
+ hRCout->proxMix.listener_location = hRCin->proxMix.listenerLocation;
+ mvs2s( hRCin->proxMix.objectLocations, hRCout->proxMix.object_locations, MAX_INPUT_CHANNELS );
+#endif
return IVAS_ERR_OK;
}
@@ -1036,6 +1041,12 @@ ivas_error IVAS_DEC_FeedRenderConfig(
mvr2r( renderConfig.room_acoustics.pAcoustic_rt60, hRenderConfig->roomAcoustics.pAcoustic_rt60, CLDFB_NO_CHANNELS_MAX );
mvr2r( renderConfig.room_acoustics.pAcoustic_dsr, hRenderConfig->roomAcoustics.pAcoustic_dsr, CLDFB_NO_CHANNELS_MAX );
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ hRenderConfig->proxMix.active = renderConfig.proxMix.active;
+ hRenderConfig->proxMix.listenerLocation = renderConfig.proxMix.listener_location;
+ mvs2s( renderConfig.proxMix.object_locations, hRenderConfig->proxMix.objectLocations, MAX_INPUT_CHANNELS );
+#endif
+
return IVAS_ERR_OK;
}
diff --git a/lib_util/render_config_reader.c b/lib_util/render_config_reader.c
index 58e0eee2860d4084a849324108e19a8b53615e65..51e54df9b0e140bbd8e880f9fe24265fed1ed2f7 100644
--- a/lib_util/render_config_reader.c
+++ b/lib_util/render_config_reader.c
@@ -161,6 +161,52 @@ static int16_t read_vector(
}
+/*-----------------------------------------------------------------------------------------*
+ * Function read_vector_short_int()
+ *
+ * Reads a short integer (16 bit) vector from a line
+ *-----------------------------------------------------------------------------------------*/
+
+static int16_t read_vector_short_int(
+ char *pLine, /* i : String to read from */
+ int16_t *pTarget /* o : Output vector pointer */
+)
+{
+ char *tmp;
+ int16_t n;
+ int16_t count;
+
+ n = (int16_t) sscanf( pLine, "[%s", pLine );
+ if ( n == 0 )
+ {
+ return true;
+ }
+
+ /* Additional comma to make parsing easier */
+ pLine[strlen( pLine ) - 1] = ',';
+
+ tmp = pLine;
+ /* Count # of commas to determine vector length */
+ for ( n = 0; tmp[n]; tmp[n] == ',' ? n++ : *tmp++ )
+ ;
+
+ count = n;
+ tmp = pLine;
+
+ for ( n = 0; n < count; n++ )
+ {
+ if ( (int16_t) sscanf( tmp, "%hd,", &pTarget[n] ) != 1 )
+ {
+ return true;
+ }
+
+ tmp = strchr( tmp, ',' ) + 1;
+ }
+
+ return false;
+}
+
+
/*-----------------------------------------------------------------------------------------*
* Function strip_spaces_upper()
*
@@ -499,6 +545,41 @@ ivas_error RenderConfigReader_read(
fprintf( stderr, "Reverb config: number of bands changed but configuration vectors missing\n" );
}
}
+#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
+ else if ( strcmp( chapter, "OBJECTPROXIMITY" ) == 0 )
+ {
+ params_idx = 0;
+ pValue = (char *) calloc( strlen( pParams ), sizeof( char ) );
+ while ( sscanf( pParams + params_idx, "%64[^=]=%[^;];", item, pValue ) == 2 )
+ {
+ params_idx += strlen( item ) + strlen( pValue ) + 2;
+ fprintf( stderr, " PARAM: %s -> %s\n", item, pValue );
+
+ if ( strcmp( item, "PROXIMITYMIXING" ) == 0 )
+ {
+ if ( read_bool( pValue, &hRenderConfig->proxMix.active ) )
+ {
+ errorHandler( item, ERROR_VALUE_INVALID );
+ }
+ }
+ else if ( strcmp( item, "OBJECTLOCATIONS" ) == 0 )
+ {
+ set_s( hRenderConfig->proxMix.object_locations, 0, IVAS_MAX_INPUT_CHANNELS );
+ if ( read_vector_short_int( pValue, hRenderConfig->proxMix.object_locations ) )
+ {
+ errorHandler( item, ERROR_VALUE_INVALID );
+ }
+ }
+ else if ( strcmp( item, "LISTENERLOCATION" ) == 0 )
+ {
+ if ( !sscanf( pValue, "%hd", &hRenderConfig->proxMix.listener_location ) )
+ {
+ errorHandler( item, ERROR_VALUE_INVALID );
+ }
+ }
+ }
+#endif /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
+ }
#ifdef DEBUGGING
else if ( strcmp( chapter, "GENERAL" ) == 0 && strlen( pParams ) != 0 )
{
diff --git a/scripts/config/self_test.prm b/scripts/config/self_test.prm
index ffafdb3776df6912396c384375c28e06ceccb30c..7cbfc5b894f91a05e40edc2bb9955feb6201d35a 100644
--- a/scripts/config/self_test.prm
+++ b/scripts/config/self_test.prm
@@ -392,6 +392,14 @@
../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48s.pcm bit
../IVAS_dec -t testv/headrot_case03_3000_q.csv BINAURAL 48 bit testv/stv4ISM48s.pcm_256000_48-48_TDHR.tst
+// 3 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, MONO out, prox_mix_test
+../IVAS_cod -ism 3 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv 256000 48 testv/stv3ISM48_prox_mix.pcm bit
+../IVAS_dec -render_config testv/prox_mixing_on.cfg MONO 48 bit testv/stv3ISM48_prox_mix.pcm_256000_48-48_MONO.tst
+
+// 4 ISm with metadata at 256 kbps, 48 kHz in, 48 kHz out, MONO out, prox_mix_test
+../IVAS_cod -ism 4 testv/stvISM1.csv testv/stvISM2.csv testv/stvISM3.csv testv/stvISM4.csv 256000 48 testv/stv4ISM48_prox_mix.pcm bit
+../IVAS_dec -render_config testv/prox_mixing_on.cfg MONO 48 bit testv/stv4ISM48_prox_mix.pcm_256000_48-48_MONO.tst
+
// SBA at 13.2 kbps, 32kHz in, 32kHz out, HOA3 out
../IVAS_cod -sba 3 13200 32 testv/stv3OA32c.pcm bit
diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_io_parse.h b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_io_parse.h
index 21b59ad06ff711c3e71e216c9da76be255fc09d7..651de9408df16be54e5cea6d662859c37a4a0491 100644
--- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_io_parse.h
+++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_io_parse.h
@@ -76,7 +76,6 @@ typedef enum test_types
FASTCONV_BIN_TEST,
PARAM_BIN_TEST,
TD_BIN_TEST,
- CREND_ACOUSTIC_PROXIMITY,
CREND_TEST_NO_DIEGETIC,
CREND_NUM_TESTS
} test_types;
@@ -106,7 +105,6 @@ typedef struct ivas_crend_io_params_t
char ref_path[IVAS_MAX_PATH_LEN];
char in_path[IVAS_MAX_PATH_LEN];
char out_path[IVAS_MAX_PATH_LEN];
- char prox_path[IVAS_MAX_PATH_LEN];
char csv_path[IVAS_MAX_PATH_LEN];
float latency_s;
int32_t use_brir;
diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_public.h b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_public.h
index 057cfba10abf7c66749ab046029d43a17200a01a..6406d047fdecd54f9b5507247252ce38a82503e8 100644
--- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_public.h
+++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_public.h
@@ -78,8 +78,6 @@ int32_t ivas_wrapper_get_frame_len( int32_t sample_rate );
ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, float *mixer );
-ivas_result_t ivas_object_mixer_renderer( ivas_crend_io_params_t *pIo_params, int16_t *userLoc );
-
ivas_result_t ivas_wav_header_skip( FILE *in_file );
#endif /* IVAS_CREND_PUBLIC_H */
diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_unit_test.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_unit_test.c
index b2a24534c02267d75acec5199a4880c192a9d3e8..7b124c989094448cb02471f9fc3eecb52291d78c 100644
--- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_unit_test.c
+++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_unit_test.c
@@ -48,7 +48,6 @@
#include "ivas_crend_public.h"
#include "ivas_crend_unit_test.h"
#include "ivas_stat_dec.h"
-#include "ivas_prox_mix.h"
#include "prot.h"
#include "ivas_prot.h"
@@ -242,151 +241,7 @@ static ivas_result_t ivas_crend_reverb_test( ivas_crend_io_params_t *pIo_params
return IVAS_SUCCESS;
}
-/*-----------------------------------------------------------------------------------------*
- * Function description -
- * common function call for ivas_crend_proximity_test which tests the proximity mixer
- *
- * Inputs -
- * ivas_crend_io_params_t io_params
- *
- * Outputs -
- *
- *-----------------------------------------------------------------------------------------*/
-static ivas_result_t ivas_crend_proximity_test( ivas_crend_io_params_t *pIo_params )
-{
- int16_t *userLoc;
- int32_t in_ch;
-#ifdef USE_PCM_OUT
- size_t num;
-#else
- int16_t num;
-#endif
- int16_t out = 0, test = PASS;
- int16_t ref;
-
- float out_0f, acc_0f;
-
- uint8_t bitstream[MAX_BITSTREAM_LEN];
-
- assert( pIo_params->in_fmt == OBA );
- assert( pIo_params->out_fmt == MONO_1 );
-
- in_ch = ivas_get_num_channels( pIo_params->in_fmt );
-
- /* allocate up to in_ch users to userLoc array */
- userLoc = (int16_t *) calloc( in_ch, sizeof( int16_t ) );
-
- /* load bitstream data */
- num = (int16_t)fread( bitstream, sizeof( uint8_t ), MAX_BITSTREAM_LEN, pIo_params->fProx );
-
- /* using bitstream information fill in the location in the userLoc vector */
- get_users_locations( bitstream, num, userLoc );
-
- /* call the object mixer-renderer */
- ivas_object_mixer_renderer( pIo_params, userLoc );
-
- free( userLoc );
-
-#ifdef USE_PCM_OUT
- int32_t i;
- for (i = 0; i < in_ch; i++)
- {
- fseek(pIo_params->fRef, 0, SEEK_SET);
- ivas_wav_header_skip(pIo_params->fRef);
- }
-#endif
-#ifdef USE_PCM_OUT
- if ( pIo_params->fRef )
- {
- fseek( pIo_params->fRef, 0, SEEK_SET );
- fseek( pIo_params->fOut, 0, SEEK_SET );
- if ( strstr( pIo_params->ref_path, ".wav" ) != NULL )
- {
- ivas_wav_header_skip( pIo_params->fRef );
- }
- while ( 1 )
- {
- acc_0f = 0.0f;
- /* read reference channel correspnding to the given user in USER_ID */
- if ( fread( &ref, sizeof( int16_t ), 1, pIo_params->fRef ) <= 0 )
- {
- printf( "Ref file finished\n" );
- goto DONE;
- }
- acc_0f = (float) ( ref ) * ( 1.0 / PCM16_TO_FLT_FAC );
-
- /* compare to output from object mixer-renderer call above */
- if ( fread( &out, sizeof( int16_t ), 1, pIo_params->fOut ) <= 0 )
- {
- printf( "Output file finished\n" );
- goto DONE;
- }
- out_0f = (float) ( out ) * ( 1.0 / PCM16_TO_FLT_FAC );
- /* check if much different.. */
- if ( fabs( out_0f - acc_0f ) > TC_TOL )
- {
- test = FAIL;
- }
- }
- }
-#else
- if ( pIo_params->fRef )
- {
- int16_t numRead;
- AudioFileReader_close( &pIo_params->fRef );
- AudioFileWriter_close( &pIo_params->fOut );
- AudioFileReader *fRef, *fOut;
- AudioFileReader_open( &fOut, pIo_params->out_path, pIo_params->sample_rate );
- AudioFileReader_open( &fRef, pIo_params->ref_path, pIo_params->sample_rate );
- while ( 1 )
- {
- acc_0f = 0.0f;
- /* read reference channel correspnding to the given user in USER_ID */
- if ( (AudioFileReader_read( fRef , &ref, 1, &numRead ) != IVAS_ERR_OK) || (numRead == 0) )
- {
- printf( "Ref file finished\n" );
- goto DONE;
- }
- acc_0f = (float) ( ref ) * ( 1.0 / PCM16_TO_FLT_FAC );
-
- /* compare to output from object mixer-renderer call above */
- if ( ( AudioFileReader_read( fOut, &out, 1, &numRead ) != IVAS_ERR_OK ) || ( numRead == 0 ) )
- {
- printf( "Output file finished\n" );
- goto DONE;
- }
- out_0f = (float) ( out ) * ( 1.0 / PCM16_TO_FLT_FAC );
-
- /* check if much different.. */
- if ( fabs( out_0f - acc_0f ) > TC_TOL )
- {
- test = FAIL;
- }
- }
- AudioFileReader_close( &fOut );
- AudioFileReader_close( &fRef );
- }
-
-
-
-#endif
-DONE:
- if ( test == PASS )
- {
- printf( "%s PASSED\n\n", "CREND_PROXIMITY" );
- }
- else
- {
- printf( "%s FAILED\n\n", "CREND_PROXIMITY" );
- exit( -1 );
- }
- if ( pIo_params->fProx )
- {
- fclose( pIo_params->fProx );
- }
- return IVAS_SUCCESS;
-}
/*-----------------------------------------------------------------------------------------*
* Function description -
* function call for ivas_crend_binaural_test
@@ -686,7 +541,6 @@ int main( int argc, char **argv )
if ( io_params.in_path[0] != '\0' )
{
if (
- io_params.test == CREND_ACOUSTIC_PROXIMITY ||
io_params.test == CREND_BIN_TEST ||
io_params.test == FASTCONV_BIN_TEST ||
io_params.test == PARAM_BIN_TEST ||
@@ -698,9 +552,6 @@ int main( int argc, char **argv )
}
switch ( io_params.test )
{
- case CREND_ACOUSTIC_PROXIMITY:
- ivas_crend_proximity_test( &io_params );
- break;
case CREND_BIN_TEST:
case FASTCONV_BIN_TEST:
case PARAM_BIN_TEST:
diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_unit_test.vcxproj b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_unit_test.vcxproj
index 3d8e7ab07f968b37bee7eb46cb7ed36fbc9c6a62..2be2a1b762250a842746a1a0fc20a5bf808de6cf 100644
--- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_unit_test.vcxproj
+++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_unit_test.vcxproj
@@ -27,13 +27,11 @@
-
-
{32354377-ACA7-40F9-9A0E-87FC956F0B78}
diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c
index d993405b1169dc591fe242b44fe3464af11683dd..bf75f093c69a01d02c04b90fd9b1c89fb896a15e 100644
--- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c
+++ b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_crend_utest_utils.c
@@ -49,7 +49,6 @@
#include "ivas_dec_parse_io.h"
#include "ivas_crend_public.h"
#include "ivas_stat_dec.h"
-#include "ivas_prox_mix.h"
#include "prot.h"
#include "ivas_prot.h"
#include "cmdl_tools.h"
@@ -476,17 +475,6 @@ void ivas_open_files_crend( ivas_crend_io_params_t *pIo_params )
}
}*/
-
- if ( pIo_params->test == CREND_ACOUSTIC_PROXIMITY )
- {
- /* open proximity bitstream file */
- if ( ( pIo_params->fProx = fopen( pIo_params->prox_path, "rb" ) ) == NULL )
- {
- fprintf( stderr, "Error: LocSharing bitstream file %s could not be opened\n\n", pIo_params->prox_path );
- ivas_crend_unit_test_usage();
- }
- }
- fprintf( stdout, "prox file or path: %s\n", pIo_params->prox_path );
}
/*-----------------------------------------------------------------------------------------*
@@ -599,25 +587,6 @@ ivas_result_t ivas_crend_parse_io_params( int argc, char **argv, ivas_crend_io_p
mandatory_args++;
}
- /*-----------------------------------------------------------------*
- * Proximity file
- *------------------------------------------------------------------*/
- else if ( strcmp( to_upper( argv[i] ), "-PROX" ) == 0 )
- {
- if ( strlen( argv[++i] ) > IVAS_MAX_PATH_LEN )
- {
- fprintf( stderr, "Error: input proximity path %s too big\n\n", argv[i] );
- ivas_crend_unit_test_usage();
- }
- strcpy( pIo_params->prox_path, argv[i] );
- if ( pIo_params->prox_path[0] == '\0' )
- {
- fprintf( stderr, "Error: input proximity folder %s could not be opened\n\n", argv[i] );
- ivas_crend_unit_test_usage();
- }
- i++;
- optional_args++;
- }
/*-----------------------------------------------------------------*
* Input csv file
*-----------------------------------------------------------------*/
@@ -861,7 +830,7 @@ static ivas_result_t ivas_wrapper_get_in_buf( ivas_crend_io_params_t *pIo_params
int16_t tmp, read = 0;
num_in_ch = ivas_get_num_channels( pIo_params->in_fmt );
- if ( pIo_params->test == CREND_BIN_TEST || pIo_params->test == FASTCONV_BIN_TEST || pIo_params->test == PARAM_BIN_TEST || pIo_params->test == TD_BIN_TEST || pIo_params->test == CREND_ACOUSTIC_PROXIMITY)
+ if ( pIo_params->test == CREND_BIN_TEST || pIo_params->test == FASTCONV_BIN_TEST || pIo_params->test == PARAM_BIN_TEST || pIo_params->test == TD_BIN_TEST )
{
/* Read in PCM */
for ( j = 0; j < input_frame_len; j++ )
@@ -1635,181 +1604,3 @@ ivas_result_t ivas_common_mixer_renderer( ivas_crend_io_params_t *pIo_params, fl
return IVAS_SUCCESS;
}
-
-/*-----------------------------------------------------------------------------------------*
- * Function description -
- * Object mixer renderer block
- *
- * Inputs -
- * ivas_enc_io_params_t io_params
- *
- * Outputs -
- *
- *-----------------------------------------------------------------------------------------*/
-ivas_result_t ivas_object_mixer_renderer( ivas_crend_io_params_t *pIo_params, int16_t *userLoc )
-{
- ivas_result_t result = IVAS_SUCCESS;
-
- float ppPcm_in[IVAS_MAX_NUM_CH][L_FRAME48k];
- float ppPcm_out[IVAS_MAX_NUM_CH][L_FRAME48k];
- DECODER_CONFIG decoder_config;
- Decoder_Struct st_ivas;
-
- memset( &st_ivas, 0, sizeof( Decoder_Struct ) );
-
- st_ivas.hDecoderConfig = &decoder_config;
- memset( st_ivas.hDecoderConfig, 0, sizeof( DECODER_CONFIG ) );
-
- int64_t frame_count = 0;
-
- int32_t i = 0, j = 0;
- int32_t frame_len = 0;
-
- float *Smixer;
- float *powvec;
- ivas_dec_io_params_t dec_io_params = { 0 };
- int16_t in_format;
- int16_t lfe_ch_idx;
-
- ivas_dec_default_io_params( &dec_io_params );
- ivas_copy_io_params_to_dec_io_params( pIo_params, &dec_io_params );
-
- frame_len = ivas_wrapper_get_frame_len( pIo_params->sample_rate );
-
-#ifdef USE_PCM_OUT
- /* skip WAV header */
- for ( i = 0; i < IVAS_MAX_NUM_CH; i++ )
- {
- if ( pIo_params->fIn[i] != NULL )
- {
- result = ivas_wav_header_skip( pIo_params->fIn[i] );
-
- if ( IVAS_SUCCESS != result )
- {
- fprintf( stderr, "WAV header skip failed\n" );
- ivas_crend_close( &st_ivas );
- exit( -1 );
- }
- }
- }
-#endif
-
- result = ivas_crend_set_config_params( &decoder_config, &dec_io_params, &in_format, &lfe_ch_idx );
-
- st_ivas.transport_config = ivas_crend_map_out_fmt( in_format );
-
-
- if ( IVAS_SUCCESS != result )
- {
- fprintf( stderr, "Crend configuration parameters setting failed\n" );
- ivas_crend_close( &st_ivas );
- exit( -1 );
- }
-
- /*------------------------------------------------------------------------------------------*
- * State memory allocation for Common renderer
- *------------------------------------------------------------------------------------------*/
- decoder_config.Opt_Headrotation = 0;
- ivas_crend_open( &st_ivas );
-
- /*------------------------------------------------------------------------------------------*
- * In/out buffer memory allocation for encoder
- *------------------------------------------------------------------------------------------*/
- int32_t in_ch = ivas_get_num_channels( pIo_params->in_fmt );
- int32_t out_ch = ivas_get_num_channels( pIo_params->out_fmt );
-
- Smixer = (float *) calloc( in_ch, sizeof( float ) );
- powvec = (float *) calloc( in_ch, sizeof( float ) );
-
- /* init - ignore FLC */
- for ( i = 0; i < in_ch; i++ )
- {
- powvec[i] = 0.0f;
- }
-
- /*------------------------------------------------------------------------------------------*
- * Loop for every frame of input data
- * - Read the input data
- * - Run the Common renderer
- * - Write the parameters into output bitstream file
- *------------------------------------------------------------------------------------------*/
-
-#define _FIND_MAX_
-#ifdef _FIND_MAX_
- float valMax = 0;
- float valEner = 0;
-#endif
-
- while ( ( ( result = ivas_wrapper_get_in_buf( pIo_params, ppPcm_in ) ) == IVAS_SUCCESS ) ) /* process loop */
- {
-#ifdef USE_PCM_OUT
- int16_t pcm;
-#else
- int16_t pcm[MAX_OUTPUT_CHANNELS];
-#endif
- result = IVAS_SUCCESS;
-
- /* get the mixing matrix.. */
- get_prox_downmix_mixer( (int16_t) PROXIMITY_USER_ID, Smixer, userLoc, in_ch, ppPcm_in, frame_len, powvec );
-
- result = ivas_crend_mixer( ppPcm_in, ppPcm_out, in_ch, out_ch, Smixer, frame_len );
-
- if ( IVAS_SUCCESS != result )
- {
- fprintf( stderr, "Error: ivas_crend_process failed with %d \n\n", (int32_t) result );
- ivas_crend_close( &st_ivas );
- exit( -1 );
- }
-
- float valMaxLoc = 0;
-
- for ( j = 0; j < frame_len; j++ )
- {
-
- for ( i = 0; i < out_ch; i++ )
- {
-
- float temp = roundf( ppPcm_out[i][j] * PCM16_TO_FLT_FAC );
-#ifdef _FIND_MAX_
-
- valMaxLoc = ( ppPcm_out[i][j] > valMaxLoc ) ? ppPcm_out[i][j] : ( ppPcm_out[i][j] < -valMaxLoc ) ? -ppPcm_out[i][j]
- : valMaxLoc;
- /* if (valMaxLoc > 1.0) printf("Saturation valMax = %f at frame_len = %ld sample = %ld \n", valMaxLoc, frame_len, i); */
-
- if ( valMax < valMaxLoc )
- {
- valMax = valMaxLoc;
- }
- valEner += ppPcm_out[i][j] * ppPcm_out[i][j];
-#endif
-
-#ifdef USE_PCM_OUT
- pcm = ( temp > MAX16B_FLT ) ? MAX16B : ( temp < MIN16B_FLT ) ? MIN16B
- : (short) temp;
- fwrite( &pcm, sizeof( int16_t ), 1, pIo_params->fOut );
-#else
- pcm[i] = ( temp > MAX16B_FLT ) ? MAX16B : ( temp < MIN16B_FLT ) ? MIN16B
- : (short) temp;
-
-#endif
- }
-#ifndef USE_PCM_OUT
- AudioFileWriter_write( pIo_params->fOut, pcm, out_ch );
-#endif
- }
-
- frame_count++;
- }
- free( powvec );
- free( Smixer );
-
-#ifdef _FIND_MAX_
- valEner = sqrt( valEner / ( frame_count * frame_len ) );
- printf( "valMax = %f valEner = %f \n", 20.f * log10( valMax ), 20.f * log10( valEner ) );
-#endif
- printf( "Total Frames Processed : %lld\n", (long long int) frame_count );
-
- ivas_crend_close( &st_ivas );
-
- return IVAS_SUCCESS;
-}
diff --git a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_prox_mix.h b/scripts/ivas_pytests/tests/unit_tests/crend/ivas_prox_mix.h
deleted file mode 100644
index 8aa4b5713007eda8d72c05f64b9f8cb2b15909b3..0000000000000000000000000000000000000000
--- a/scripts/ivas_pytests/tests/unit_tests/crend/ivas_prox_mix.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/******************************************************************************************************
-
- (C) 2022 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository. All Rights Reserved.
-
- This software is protected by copyright law and by international treaties.
- The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
- Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
- Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
- Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
- contributors to this repository retain full ownership rights in their respective contributions in
- the software. This notice grants no license of any kind, including but not limited to patent
- license, nor is any license granted by implication, estoppel or otherwise.
-
- Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
- contributions.
-
- This software is provided "AS IS", without any express or implied warranties. The software is in the
- development stage. It is intended exclusively for experts who have experience with such software and
- solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
- and fitness for a particular purpose are hereby disclaimed and excluded.
-
- Any dispute, controversy or claim arising under or in relation to providing this software shall be
- submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
- accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
- the United Nations Convention on Contracts on the International Sales of Goods.
-
-*******************************************************************************************************/
-
-
-#ifndef IVAS_PROX_MIX_H
-#define IVAS_PROX_MIX_H
-
-/****************************************************************************
-* File description -
-* This header file contains declarations which are common between IVAS
-* spatial decoding tools
-****************************************************************************/
-
-/*------------------------------------------------------------------------------------------*
-* include header files
-*------------------------------------------------------------------------------------------*/
-#include "stdio.h"
-#include "stdlib.h"
-#include "string.h"
-#include "ivas_stat_dec.h"
-#include "ivas_result_t.h"
-
-/*------------------------------------------------------------------------------------------*
-* PreProcessor
-*------------------------------------------------------------------------------------------*/
-
-/*------------------------------------------------------------------------------------------*
- * Global variables
- *------------------------------------------------------------------------------------------*/
-#define LOC_BITSTREAM_DELIMITER ( 128 )
-#define MAX_BITSTREAM_LEN ( 128 )
-#define POWER_FACT ( 1.2f )
-#define POWER_SMOOTH_HI ( 0.8f )
-#define POWER_SMOOTH_LO ( 0.95f )
-
-/*------------------------------------------------------------------------------------------*
- * function declarations
- *------------------------------------------------------------------------------------------*/
-ivas_result_t get_users_locations( uint8_t *bitstream, int32_t len, int16_t *userLoc );
-ivas_result_t get_prox_downmix_mixer( int16_t userID, float *pMixer, int16_t *userLoc, int32_t nChan, float ppPcm_in[][L_FRAME48k], int32_t frame_len, float *powvec );
-
-#endif
diff --git a/scripts/testv/prox_mixing_on.cfg b/scripts/testv/prox_mixing_on.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..35b767fbe533591df604213f2043b90601419c65
--- /dev/null
+++ b/scripts/testv/prox_mixing_on.cfg
@@ -0,0 +1,4 @@
+[objectProximity]
+proximityMixing = true;
+objectLocations = [1, 1, 2, 0];
+listenerLocation= 3;
diff --git a/scripts/testv/stv3ISM48_prox_mix.pcm b/scripts/testv/stv3ISM48_prox_mix.pcm
new file mode 100644
index 0000000000000000000000000000000000000000..7f06f33cde9b1951b5bd31bc22f866886b9c3326
--- /dev/null
+++ b/scripts/testv/stv3ISM48_prox_mix.pcm
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:d5a67ac509ddc07812a9d7e710e5fb7cc3e475d40b52a298c51dd0c6e233330a
+size 5534490
diff --git a/scripts/testv/stv4ISM48_prox_mix.pcm b/scripts/testv/stv4ISM48_prox_mix.pcm
new file mode 100644
index 0000000000000000000000000000000000000000..f9f667c546a1caf9890b1f85ca8400e1d87ac362
--- /dev/null
+++ b/scripts/testv/stv4ISM48_prox_mix.pcm
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:6fd80116f953bcb95ddc3c49f511d556ca30e7a22027723aa534c01d430ae35e
+size 7379320