Commit d1180a96 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch 'ivas_ism_dec_fxd_3' into 'main'

Add changes for ivas_er_init_handle

See merge request !163
parents 2849a179 315eb259
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1787,6 +1787,9 @@ typedef enum
#define ER_LIST_ORIGIN_X                        (0.0f)
#define ER_LIST_ORIGIN_Y                        (0.0f)
#define ER_LIST_HEIGHT                          (1.6f)
#ifdef IVAS_FLOAT_FIXED
#define ER_LIST_HEIGHT_FX                          26214
#endif // IVAS_FLOAT_FIXED


/*----------------------------------------------------------------------------------*
+266 −0
Original line number Diff line number Diff line
@@ -2101,6 +2101,37 @@ static ivas_error ivas_rend_initCrend(
 * Initialize shoebox_data_t handle
 *------------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
static ivas_error ivas_shoebox_data_init(
    shoebox_data_t *hShoeboxData /* i/o: shoebox_data_t handle     */
)
{
    Word16 i;

    IF ( hShoeboxData == NULL )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    FOR ( i = 0; i < 150; i++ )
    {
        hShoeboxData->data_fx[i] = 0;
        move32();
    }
    FOR ( i = 0; i < 1; i++ )
    {
        hShoeboxData->size[i] = 0;
        move16();
    }
#if 1/*To be removed later:floating point initialization*/
    FOR ( i = 0; i < 150; i++ )
    {
        hShoeboxData->data[i] = 0.0f;
    }
#endif
    return IVAS_ERR_OK;
}
#else
static ivas_error ivas_shoebox_data_init(
    shoebox_data_t *hShoeboxData /* i/o: shoebox_data_t handle     */
)
@@ -2124,12 +2155,51 @@ static ivas_error ivas_shoebox_data_init(
    return IVAS_ERR_OK;
}

#endif

/*-------------------------------------------------------------------------
 * ivas_shoebox_output_init()
 *
 * Initialize shoebox_output_t handle
 *------------------------------------------------------------------------*/
#ifdef IVAS_FLOAT_FIXED
static ivas_error ivas_shoebox_output_init(
    shoebox_output_t *hShoeboxOutput /* i/o: shoebox_output_t handle     */
)
{
    ivas_error error;

    IF ( hShoeboxOutput == NULL )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    hShoeboxOutput->n_sources = 0;
    hShoeboxOutput->n_ref = 0;

    IF ( ( error = ivas_shoebox_data_init( &hShoeboxOutput->times ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    IF ( ( error = ivas_shoebox_data_init( &hShoeboxOutput->gains ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    IF ( ( error = ivas_shoebox_data_init( &hShoeboxOutput->az_angle ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    IF ( ( error = ivas_shoebox_data_init( &hShoeboxOutput->el_angle ) ) != IVAS_ERR_OK )
    {
        return error;
    }

    return IVAS_ERR_OK;
}
#else

static ivas_error ivas_shoebox_output_init(
    shoebox_output_t *hShoeboxOutput /* i/o: shoebox_output_t handle     */
@@ -2167,6 +2237,7 @@ static ivas_error ivas_shoebox_output_init(

    return IVAS_ERR_OK;
}
#endif


/*-------------------------------------------------------------------------
@@ -2175,6 +2246,50 @@ static ivas_error ivas_shoebox_output_init(
 * Initialize shoebox_config_t handle
 *------------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
static ivas_error ivas_shoebox_config_init_params(
    shoebox_config_t *hShoeboxConfig /* i/o: shoebox_config_t handle     */
)
{
    Word16 i;

    IF ( hShoeboxConfig == NULL )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    hShoeboxConfig->room_L_fx = 0;
    hShoeboxConfig->room_W_fx = 0;
    hShoeboxConfig->room_H_fx = 0;
    move16();
    move16();
    move16();
    FOR ( i = 0; i < IVAS_ROOM_ABS_COEFF; i++ )
    {
        hShoeboxConfig->abs_coeff_fx[i] = 0;
        move16();
    }
    FOR( i = 0; i < 3; i++ )
    {
        hShoeboxConfig->list_orig_fx[i] = 0;
        move16();
    }
#if 1/*To be removed later :floating point initializations*/
    hShoeboxConfig->room_L = 0.0f;
    hShoeboxConfig->room_W = 0.0f;
    hShoeboxConfig->room_H = 0.0f;
    FOR ( i = 0; i < IVAS_ROOM_ABS_COEFF; i++ )
    {
        hShoeboxConfig->abs_coeff[i] = 0.0f;
    }
    FOR ( i = 0; i < 3; i++ )
    {
        hShoeboxConfig->list_orig[i] = 0.0f;
    }
#endif
    return IVAS_ERR_OK;
}
#else
static ivas_error ivas_shoebox_config_init_params(
    shoebox_config_t *hShoeboxConfig /* i/o: shoebox_config_t handle     */
)
@@ -2201,6 +2316,7 @@ static ivas_error ivas_shoebox_config_init_params(

    return IVAS_ERR_OK;
}
#endif


/*-------------------------------------------------------------------------
@@ -2209,6 +2325,85 @@ static ivas_error ivas_shoebox_config_init_params(
 * Initialize shoebox_obj_t handle
 *------------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
static ivas_error ivas_shoebox_obj_init(
    shoebox_obj_t *hShoeboxObj /* i/o: shoebox_obj_t handle     */
)
{
    Word16 i;
    ivas_error error;

    IF ( hShoeboxObj == NULL )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }

    hShoeboxObj->isCartesian = 0;
    hShoeboxObj->isRelative = 0;
    hShoeboxObj->isZHeight = 0;
    hShoeboxObj->isRadians = 0;
    hShoeboxObj->MAX_SOURCES = 0;
    hShoeboxObj->max_bands = 0;
    hShoeboxObj->REF_ORDER = 0;
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    FOR ( i = 0; i < 75; i++ )
    {
        hShoeboxObj->src_pos_fx[i] = 0;
        move16();
    }
    FOR ( i = 0; i < 25; i++ )
    {
        hShoeboxObj->src_dist_fx[i] = 0;
        move16();
    }
    FOR( i = 0; i < 3; i++ )
    {
        hShoeboxObj->list_pos_fx[i] = 0;
        move16();
    }

    hShoeboxObj->nSrc = 0;
    hShoeboxObj->radius_fx = 0;
    hShoeboxObj->min_wall_dist_fx = 0;
    hShoeboxObj->soundspeed_fx = 0;
    hShoeboxObj->air_coeff_fx = 0;
    move16();
    move16();
    move16();
    move16();
    move16();

    IF ( ( error = ivas_shoebox_config_init_params( &hShoeboxObj->cal ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#if 1/*To be removed later: Floating point initializations*/
    FOR ( i = 0; i < 75; i++ )
    {
        hShoeboxObj->src_pos[i] = 0.0f;
    }
    FOR ( i = 0; i < 25; i++ )
    {
        hShoeboxObj->src_dist[i] = 0.0f;
    }
    FOR ( i = 0; i < 3; i++ )
    {
        hShoeboxObj->list_pos[i] = 0.0f;
    }
    hShoeboxObj->radius = 0.0f;
    hShoeboxObj->min_wall_dist = 0.0f;
    hShoeboxObj->soundspeed = 0.0f;
    hShoeboxObj->air_coeff = 0.0f;
#endif
    return IVAS_ERR_OK;
}
#else
static ivas_error ivas_shoebox_obj_init(
    shoebox_obj_t *hShoeboxObj /* i/o: shoebox_obj_t handle     */
)
@@ -2255,6 +2450,7 @@ static ivas_error ivas_shoebox_obj_init(

    return IVAS_ERR_OK;
}
#endif


/*-------------------------------------------------------------------------
@@ -2263,6 +2459,75 @@ static ivas_error ivas_shoebox_obj_init(
 * Initialize early reflections handle
 *------------------------------------------------------------------------*/

#ifdef IVAS_FLOAT_FIXED
static ivas_error ivas_er_init_handle(
    er_struct_t *reflections /* i/o: early reflections handle     */
)
{
    Word16 i;
    ivas_error error;
    IF ( reflections == NULL )
    {
        return IVAS_ERR_WRONG_PARAMS;
    }
    reflections->audio_config = IVAS_AUDIO_CONFIG_INVALID;
    reflections->use_er = 0;
    reflections->is_ready = 0;
    reflections->circ_len = 0;
    reflections->circ_insert = 0;
    reflections->n_total_reflections = 0;
    reflections->is_cartesian = 0;
    reflections->is_relative = 0;
    reflections->max_frame_size = 0;
    reflections->output_Fs_fx = 0;
    move16();
    move16();
    move16();
    move16();
    move16();
    move16();
    move32();
    move32();
    FOR ( i = 0; i < 75; i++ )
    {
        reflections->source_positions_fx[i] = 0;
        move16();
    }
    FOR ( i = 0; i < 3; i++ )
    {
        reflections->user_origin_fx[i] = 0;
        move16();
        IF ( EQ_16(i , 2) )
        {
            reflections->user_origin_fx[i] = ER_LIST_HEIGHT_FX;
            move16();
        }
    }
    reflections->circ_buffers = NULL;
    reflections->closest_ch_idx = NULL;

    IF ( ( error = ivas_shoebox_output_init( &reflections->shoebox_data ) ) != IVAS_ERR_OK )
    {
        return error;
    }
    IF ( ( error = ivas_shoebox_obj_init( &reflections->shoebox_lib ) ) != IVAS_ERR_OK )
    {
        return error;
    }
#if 1
    reflections->output_Fs = 0.0f;
    FOR ( i = 0; i < 75; i++ )
    {
        reflections->source_positions[i] = 0.0f;
    }
    FOR ( i = 0; i < 3; i++ )
    {
        reflections->user_origin[i] = fixedToFloat( reflections->user_origin_fx[i], 14 );
    }
#endif
    return IVAS_ERR_OK;
}
#else
static ivas_error ivas_er_init_handle(
    er_struct_t *reflections /* i/o: early reflections handle     */
)
@@ -2314,6 +2579,7 @@ static ivas_error ivas_er_init_handle(

    return IVAS_ERR_OK;
}
#endif // IVAS_FLOAT_FIXED

#ifdef IVAS_FLOAT_FIXED
/*-------------------------------------------------------------------------
+14 −0
Original line number Diff line number Diff line
@@ -1239,6 +1239,15 @@ typedef struct
    float src_pos[75];
    float src_dist[25];
    float list_pos[3];
#ifdef IVAS_FLOAT_FIXED
    Word32 src_dist_fx[25];
    Word32 list_pos_fx[3];
    Word32 src_pos_fx[75];
    Word32 radius_fx;
    Word32 min_wall_dist_fx;
    Word32 soundspeed_fx;
    Word32 air_coeff_fx;
#endif // IVAS_FLOAT_FIXED
    uint16_t nSrc;
    float radius;
    float min_wall_dist;
@@ -1295,6 +1304,11 @@ typedef struct er_struct_t
    UWord16 is_cartesian;
    UWord16 is_relative;
    UWord32 max_frame_size;
#ifdef IVAS_FLOAT_FIXED
    Word32 output_Fs_fx;
    Word16 source_positions_fx[75];
    Word16 user_origin_fx[3];
#endif
    float output_Fs;
    float source_positions[75];
    float user_origin[3];