Commit 6b34bf7f authored by emerit's avatar emerit
Browse files

merge with main

parent 80e12d23
Loading
Loading
Loading
Loading
+16 −17
Original line number Diff line number Diff line
@@ -774,9 +774,9 @@ static ivas_error DefaultBSplineModel_fx(
    move16();
    model->elevSegSamples = defaultHRIR_rom_model_configuration[4];
    move16();
    model->elevBsLen = defaultHRIR_rom_elevBsLen;
    model->elevBsLen = (const int16_t *) defaultHRIR_rom_elevBsLen;
    move16();
    model->elevBsStart = defaultHRIR_rom_elevBsStart;
    model->elevBsStart = (const int16_t *) defaultHRIR_rom_elevBsStart;
    move16();
#else
    model->UseItdModel = 1;
@@ -860,7 +860,7 @@ static ivas_error DefaultBSplineModel_fx(
    }
    FOR( i = 0; i < model->elevDim3; i++ )
    {
        IF( ( model->azimKSeq[i] = (float *) malloc( ( model->azimDim3[i] + 1 ) * sizeof( float * ) ) ) == NULL )
        IF( ( model->azimKSeq_fx[i] = (Word32 *) malloc( ( model->azimDim3[i] + 1 ) * sizeof( Word32 * ) ) ) == NULL )
        {
            return ( IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Can not allocate memory for Binaural TD renderer\n" ) );
        }
@@ -875,7 +875,7 @@ static ivas_error DefaultBSplineModel_fx(
        assert( azimSegSamples == 360.0f / model->azimDim3[i] );
        FOR( j = 0; j < model->azimDim3[i] + 1; j++ )
        {
            model->azimKSeq[i][j] = azimSegSamples * j;
            model->azimKSeq_fx[i][j] = azimSegSamples * j;
        }
    }
#else
@@ -935,7 +935,6 @@ static ivas_error DefaultBSplineModel_fx(
            assert( azimSegSamples == 360.0f / model->azimDim3[i] );
            for ( j = 0; j < model->azimDim3[i] + 1; j++ )
            {
                model->azimKSeq[i][j] = azimSegSamples * j;
                model->azimKSeq_fx[i][j] = L_shl( L_mult0( defaultHRIR_rom_azimSegSamples[0], j ), Q22 );
            }
        }
@@ -1105,11 +1104,11 @@ static ivas_error DefaultBSplineModel_fx(
    move16();
#endif
#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    modelITD->elevKSeq = (const float *) defaultHRIR_rom_ITD_elevKSeq;
    modelITD->elevKSeq_fx = (const Word32 *) defaultHRIR_rom_ITD_elevKSeq_fx;
    modelITD->azimBsLen = defaultHRIR_rom_ITD_azimBsLen;
    modelITD->azimBsStart = defaultHRIR_rom_ITD_azimBsStart;

    modelITD->azimKSeq = (const float *) defaultHRIR_rom_ITD_azimKSeq;
    modelITD->azimKSeq_fx = (const Word32 *) defaultHRIR_rom_ITD_azimKSeq_fx;
#else
#if 0 /*To be removed later : floating point pointer initialization*/
    modelITD->elevKSeq = defaultHRIR_rom_ITD_elevKSeq;
@@ -1137,9 +1136,9 @@ static ivas_error DefaultBSplineModel_fx(
    move16();
#endif
#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    modelITD->W = (const float *) defaultHRIR_rom_ITD_W;
    modelITD->azimBsShape = (const float *) defaultHRIR_rom_ITD_azimBsShape;
    modelITD->elevBsShape = (const float *) defaultHRIR_rom_ITD_elevBsShape;
    modelITD->W_fx = (const Word32 *) defaultHRIR_rom_ITD_W_fx;
    modelITD->azimBsShape_fx = (const Word32 *) defaultHRIR_rom_ITD_azimBsShape_fx;
    modelITD->elevBsShape_fx = (const Word32 *) defaultHRIR_rom_ITD_elevBsShape_fx;
#endif
#if 0 /*To be removed later : floating point pointer initialization*/
    modelITD->azimKSeq = defaultHRIR_rom_ITD_azimKSeq;
+58 −18
Original line number Diff line number Diff line
@@ -1640,20 +1640,28 @@ typedef struct
    int16_t modelROM;    /* Flag that indicates that the model resides in ROM (controls init/dealloc). */
    int16_t UseItdModel; /* Controls whether ITD model is used. */
    int16_t K;           /* Length of filter */
#ifndef FIX_TDREND_HRTF_FILE_FORMAT
    int16_t elevDim2;
#endif
    int16_t elevDim3;
    int16_t AlphaN; /* Number of rows in Alpha matrices */
    int16_t num_unique_azim_splines;
    int16_t elevSegSamples;

#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    const int16_t *elevBsLen;
    const int16_t *elevBsStart;
#else
    int16_t elevBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS];
    int16_t elevBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS];
    const int16_t *azimDim2;
#endif
    const int16_t *azimDim3;
    const int16_t *azim_start_idx;
    const int16_t *azimSegSamples;
    const int16_t *azimShapeIdx;
    const int16_t *azimShapeSampFactor;

    const float *elevKSeq; /* Array, N x elevDim2 x elevDim3 */
#ifdef IVAS_FLOAT_FIXED
    const Word32 *elevKSeq_fx; /* Array, N x elevDim2 x elevDim3 */
    const Word32 *elevBsShape_fx;
@@ -1667,24 +1675,29 @@ typedef struct
    Word16 EL_e;
    const Word32 *ER_fx; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */
    Word16 ER_e;
#endif                   // IVAS_FLOAT_FIXED
#else
    const float *elevKSeq; /* Array, N x elevDim2 x elevDim3 */
    const float *AlphaL;   /* Array, size AlphaN x K */
    const float *AlphaR;   /* Array, size AlphaN x K */
    const float *elevBsShape;
    float **azimKSeq; /* Array, length azimDim3+1            */
    const float **azimBsShape;
#endif // IVAS_FLOAT_FIXED

    int16_t azimDim3Max;
    int16_t iSecFirst[HRTF_MODEL_N_SECTIONS]; /* Indices for start of sections */
    int16_t iSecLast[HRTF_MODEL_N_SECTIONS];  /* Indices for end of sections */
#ifndef IVAS_FLOAT_FIXED
    const float *EL; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */
    const float *ER; /* Array, size (AlphaN*HRTF_MODEL_N_SECTIONS) */

#endif
    /* Pointers for allocation of dynamic memory  */
#ifndef IVAS_FLOAT_FIXED
    float *AlphaL_dyn;
    float *AlphaR_dyn;
    float *EL_dyn;
    float *ER_dyn;
#endif
#ifdef IVAS_FLOAT_FIXED
    Word32 *AlphaL_dyn_fx;
    Word32 *AlphaR_dyn_fx;
@@ -1695,13 +1708,14 @@ typedef struct
    Word32 *ER_dyn_fx;
    Word16 ER_dyn_e;
#endif
    float *elevBsShape_dyn;
    float *elevKSeq_dyn;
    int16_t *elevBsLen_dyn;
    int16_t *elevBsStart_dyn;
#ifdef IVAS_FLOAT_FIXED
    Word32 *elevBsShape_dyn_fx;
    Word32 *elevKSeq_dyn_fx;
#else
    float *elevKSeq_dyn;
    float *elevBsShape_dyn;
#endif
    int16_t *azimDim2_dyn;
    int16_t *azimDim3_dyn;
@@ -1709,29 +1723,55 @@ typedef struct
    int16_t *azimSegSamples_dyn;
    int16_t *azimShapeIdx_dyn;
    int16_t *azimShapeSampFactor_dyn;
    float **azimBsShape_dyn;
#ifdef IVAS_FLOAT_FIXED
    Word32 **azimBsShape_dyn_fx;
#else
    float **azimBsShape_dyn;
#endif

} ModelParams_t;

typedef struct
{
#ifndef FIX_TDREND_HRTF_FILE_FORMAT
    int16_t N; /* Polynomial degree */

    int16_t elevDim2;
#endif
    int16_t elevDim3;
#ifndef FIX_TDREND_HRTF_FILE_FORMAT
#ifndef IVAS_FLOAT_FIXED
    const float *elevKSeq; /* Array, length elevDim3-2       */
#endif
    int16_t azimDim2;
#endif
    int16_t azimDim3;
#ifndef IVAS_FLOAT_FIXED
    const float *azimKSeq; /* Array, length azimDim3-2            */
    const float *W;        /* Array, size (elevDim3*azimDim3) x K */

#endif
#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    const int16_t *azimBsLen;
    const int16_t *azimBsStart;
#else
    int16_t azimBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS];
    int16_t azimBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS];
#endif
#ifndef IVAS_FLOAT_FIXED
    const float *azimBsShape;
#endif
    int16_t azimSegSamples;

#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    const int16_t *elevBsLen;
    const int16_t *elevBsStart;
#else
    int16_t elevBsLen[HRTF_MODEL_BSPLINE_NUM_COEFFS];
    int16_t elevBsStart[HRTF_MODEL_BSPLINE_NUM_COEFFS];
#endif
#ifndef IVAS_FLOAT_FIXED
    const float *elevBsShape;
#endif
    int16_t elevSegSamples;
#ifndef IVAS_FLOAT_FIXED
    float resamp_factor;
@@ -1748,31 +1788,31 @@ typedef struct
#endif // IVAS_FLOAT_FIXED

    /* Pointers for allocation of dynamic memory  */
    float *elevKSeq_dyn;
#ifdef IVAS_FLOAT_FIXED
    Word32 *elevKSeq_dyn_fx;
    Word32 *azimKSeq_dyn_fx;
#endif
#else
    float *elevKSeq_dyn;
    float *azimKSeq_dyn;
    float *W_dyn;
    float *azimBsShape_dyn;
#endif
#ifdef IVAS_FLOAT_FIXED
    Word32 *W_dyn_fx;
    Word16 W_dyn_e;
    Word32 *azimBsShape_dyn_fx;
#endif
    float *elevBsShape_dyn;
    int16_t *azimBsLen_dyn;
    int16_t *azimBsStart_dyn;
    int16_t *elevBsLen_dyn;
    int16_t *elevBsStart_dyn;
#ifdef IVAS_FLOAT_FIXED
    Word32 *elevBsShape_dyn_fx;
#ifdef FIX_TDREND_HRTF_FILE_FORMAT
    int16_t *azimBsLen_dyn_fx;
    int16_t *azimBsStart_dyn_fx;
    int16_t *elevBsLen_dyn_fx;
    int16_t *elevBsStart_dyn_fx;
#endif
#else
    float *elevBsShape_dyn;
#endif

} ModelParamsITD_t;