Commit e20fd7ec authored by liksonov's avatar liksonov
Browse files

Use config instead of const/define for use locations in proximity mixing.

parent b45c1791
Loading
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -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 )

/*----------------------------------------------------------------------------------*
@@ -102,7 +103,9 @@ typedef struct _IVAS_ROOM_ACOUSTICS_CONFIG
    int16_t use_brir;
    int16_t late_reverb_on;
#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
    int16_t do_proximity_mixing;
    int16_t do_proximity_mixing;                              /* Flag to turn ON proximity-based mixing */
    int16_t prox_mix_user_locations[IVAS_MAX_INPUT_CHANNELS]; /* user locations array for proximity-based mixing */
    int16_t prox_mix_listener_location;                       /* listener location for proximity-based mixing */
#endif
    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: */
+3 −1
Original line number Diff line number Diff line
@@ -4771,7 +4771,9 @@ void computeReferencePower_enc(
#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
ivas_error ivas_mono_dmx_renderer_open(
    Decoder_Struct *st_ivas,                                    /* i/o: IVAS decoder structure                           */
    const int16_t do_proximity_mixing                           /* i  : flag to enable proximity-based mixing            */
    const int16_t do_proximity_mixing,                          /* i  : flag to enable proximity-based mixing            */
    const int16_t *prox_mix_user_locations,                     /* i  : user locations array for proximity-based mixing  */
    const int16_t prox_mix_listener_location                    /* i  : listener location for proximity-based mixing     */
);
#else /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
ivas_error ivas_mono_dmx_renderer_open(
+2 −1
Original line number Diff line number Diff line
@@ -1250,7 +1250,8 @@ ivas_error ivas_init_decoder(
    else if ( st_ivas->renderer_type == RENDERER_MONO_DOWNMIX )
    {
#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
        if ( ( error = ivas_mono_dmx_renderer_open( st_ivas, st_ivas->hRenderConfig->roomAcoustics.do_proximity_mixing ) ) != IVAS_ERR_OK )
        if ( ( error = ivas_mono_dmx_renderer_open( st_ivas, st_ivas->hRenderConfig->roomAcoustics.do_proximity_mixing,
            st_ivas->hRenderConfig->roomAcoustics.prox_mix_user_locations, st_ivas->hRenderConfig->roomAcoustics.prox_mix_listener_location) ) != IVAS_ERR_OK )
#else
        if ( ( error = ivas_mono_dmx_renderer_open( st_ivas ) ) != IVAS_ERR_OK )
#endif
+7 −8
Original line number Diff line number Diff line
@@ -50,10 +50,6 @@
#define DOWNMIX_MAX_GAIN                      4.0f  /* Maximum allowed gain  */
#define MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS 4

#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
#define PROXIMITY_USER_ID ( 3 )
const int16_t userLoc_prox_mix_test_const[MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS] = { 1, 1, 2, 0 };
#endif /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */

/*-------------------------------------------------------------------------
 * ivas_mono_dmx_renderer_open()
@@ -64,7 +60,9 @@ const int16_t userLoc_prox_mix_test_const[MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS]
#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
ivas_error ivas_mono_dmx_renderer_open(
    Decoder_Struct *st_ivas,                   /* i/o: IVAS decoder structure                */
    const int16_t do_proximity_mixing    /* i  : flag to enable proximity-based mixing */
    const int16_t do_proximity_mixing,         /* i  : flag to enable proximity-based mixing */
    const int16_t *prox_mix_user_locations,    /* i  : user locations array for proximity-based mixing */
    const int16_t prox_mix_listener_location   /* i  : listener location for proximity-based mixing */
)
#else /* I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER */
ivas_error ivas_mono_dmx_renderer_open(
@@ -94,8 +92,9 @@ ivas_error ivas_mono_dmx_renderer_open(
        set_zero( hDownmix->powvec, MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS );
        for ( channel_idx = 0 ; channel_idx < MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS; channel_idx++ )
        {
            hDownmix->userLoc[channel_idx] = userLoc_prox_mix_test_const[channel_idx];
            hDownmix->userLoc[channel_idx] = prox_mix_user_locations[channel_idx];
        }
        hDownmix->listenerLoc = prox_mix_listener_location;

#ifdef DEBUG_PROX_MIX_INFO
        for ( channel_idx = 0 ; channel_idx < MONO_DOWNMIX_RENDERER_MAX_INPUT_CHANS; channel_idx++ )
@@ -137,7 +136,7 @@ void ivas_mono_downmix_render_passive(
    if ( hDownmix->do_proximity_mixing )
    {
        /* get the mixing matrix.. */
        ivas_prox_mixer_compute_gains( ( int16_t )PROXIMITY_USER_ID, prox_mixer_gains, hDownmix->userLoc, numInputChannels, output_f, output_frame, hDownmix->powvec );
        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  =  ");
+2 −0
Original line number Diff line number Diff line
@@ -106,6 +106,8 @@ ivas_error ivas_render_config_init_from_rom(
#endif
#ifdef I15_IMPLEMENT_PROX_MIXING_FOR_ISM_DECODER
    ( *hRenderConfig )->roomAcoustics.do_proximity_mixing = false;
    set_s( ( *hRenderConfig )->roomAcoustics.prox_mix_user_locations, 0, MAX_INPUT_CHANNELS );
    ( *hRenderConfig )->roomAcoustics.prox_mix_listener_location = 0;
#endif
    ( *hRenderConfig )->roomAcoustics.override = false;
    ( *hRenderConfig )->roomAcoustics.use_brir = room_flag_on;
Loading