Unverified Commit ebda710c authored by norvell's avatar norvell
Browse files

Fix for model->W_fx

parent e30e9652
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -603,7 +603,11 @@ static void GenerateITD_fx(
    {
        index = BM_idx[i];
        move32();
#ifdef FIX_2235_TD_RENDERER_WORD16
        temp = W_add( temp, Mpy_32_16_1( modelEval->BM_ITD_fx[i], model->W_fx[index] ) );
#else
        temp = W_add( temp, Mpy_32_32( modelEval->BM_ITD_fx[i], model->W_fx[index] ) );
#endif
    }
    itdMod_e = W_norm( temp );
    itdMod_e = sub( itdMod_e, 32 );
+4 −0
Original line number Diff line number Diff line
@@ -706,6 +706,9 @@ static ivas_error DefaultBSplineModel_fx(
    Copy_Scale_sig_16_32_r( defaultHRIR_rom_ITD_azimKSeq_fx, modelITD->azimKSeq_dyn_fx, ( ( modelITD->azimDim3 + 1 ) / 2 - 2 ), Q22 - defaultHRIR_rom_ITD_azimKSeq_Q_fx ); // Q22
    modelITD->azimKSeq_fx = modelITD->azimKSeq_dyn_fx;
#endif
#ifdef FIX_2235_TD_RENDERER_WORD16
    modelITD->W_fx = defaultHRIR_rom_ITD_W_fx;
#else
    modelITD->W_dyn_fx = (Word32 *) malloc( sizeof( defaultHRIR_rom_ITD_W_fx ) * sizeof( Word32 ) / sizeof( Word16 ) ); /* basis functions are flipped around 180 deg, number of basis functions above/below is (N+1)/2 */
    IF( modelITD->W_dyn_fx == NULL )
    {
@@ -713,6 +716,7 @@ static ivas_error DefaultBSplineModel_fx(
    }
    Copy_Scale_sig_16_32_r( defaultHRIR_rom_ITD_W_fx, modelITD->W_dyn_fx, sizeof( defaultHRIR_rom_ITD_W_fx ) / sizeof( Word16 ), Q25 - defaultHRIR_rom_ITD_W_Q_fx ); // Q22
    modelITD->W_fx = modelITD->W_dyn_fx;
#endif
    modelITD->W_e = Q15 - defaultHRIR_rom_ITD_W_Q_fx;
    move16();
#ifdef FIX_2235_TD_RENDERER_WORD16
+5 −2
Original line number Diff line number Diff line
@@ -1129,11 +1129,13 @@ typedef struct
    Word16 elevKSeq_Q_fx;      /* Q-value of elevKSeq_fx */
    const Word16 *azimKSeq_fx; /* Array, length azimDim3-2            */
    Word16 azimKSeq_Q_fx;      /* Q-value of azimKSeq_fx */
    const Word16 *W_fx;        /* Array, size (elevDim3*azimDim3) x K */
#else
    const Word32 *elevKSeq_fx; /* Array, length elevDim3-2       */
    const Word32 *azimKSeq_fx; /* Array, length azimDim3-2            */
#endif
    const Word32 *W_fx;        /* Array, size (elevDim3*azimDim3) x K */
#endif

    Word16 W_e;
#ifdef FIX_2235_TD_RENDERER_WORD16
    const Word16 *azimBsShape_fx;
@@ -1149,11 +1151,12 @@ typedef struct
#ifdef FIX_2235_TD_RENDERER_WORD16
    Word16 *elevKSeq_dyn_fx;
    Word16 *azimKSeq_dyn_fx;
    Word16 *W_dyn_fx;
#else
    Word32 *elevKSeq_dyn_fx;
    Word32 *azimKSeq_dyn_fx;
#endif
    Word32 *W_dyn_fx;
#endif
#ifdef FIX_2235_TD_RENDERER_WORD16
    Word16 *azimBsShape_dyn_fx;
    Word16 *elevBsShape_dyn_fx;
+16 −2
Original line number Diff line number Diff line
@@ -286,9 +286,12 @@ static ivas_error TDREND_LoadBSplineBinaryITD(
    FILE *f_hrtf                /* i  : HR filter data file handle    */
)
{

    Word16 tmp, factor_Q;
#ifndef FIX_2235_TD_RENDERER_WORD16
    Word16 *v_tmp16;
    Word16 j;
#endif

    if ( modelITD == NULL || f_hrtf == NULL )
    {
@@ -346,6 +349,16 @@ static ivas_error TDREND_LoadBSplineBinaryITD(
#endif

    fread( &tmp, sizeof( Word16 ), 1, f_hrtf );
#ifdef FIX_2235_TD_RENDERER_WORD16
    ivas_HRTF_binary_open_buffers_int16( &modelITD->W_dyn_fx, tmp * sizeof( Word16 ) );
    if ( modelITD->W_dyn_fx == NULL )
    {
        return IVAS_ERROR( IVAS_ERR_FAILED_ALLOC, "Could not allocate memory for hrtf data" );
    }
    fread( &factor_Q, sizeof( Word16 ), 1, f_hrtf );
    modelITD->W_e = Q15 - factor_Q;
    fread( modelITD->W_dyn_fx, sizeof( Word16 ), tmp, f_hrtf );
#else
    ivas_HRTF_binary_open_buffers_int32( &modelITD->W_dyn_fx, tmp * sizeof( Word32 ) );
    if ( modelITD->W_dyn_fx == NULL )
    {
@@ -366,7 +379,7 @@ static ivas_error TDREND_LoadBSplineBinaryITD(
        modelITD->W_dyn_fx[j] = L_shl_r( L_deposit_l( v_tmp16[j] ), Q25 - factor_Q );
    }
    free( v_tmp16 );

#endif
    /* azimuth */
    ivas_HRTF_binary_open_buffers_int16( &modelITD->azimBsLen_dyn_fx, HRTF_MODEL_BSPLINE_NUM_COEFFS * sizeof( Word16 ) );
    if ( modelITD->azimBsLen_dyn_fx == NULL )
@@ -456,11 +469,12 @@ static ivas_error TDREND_LoadBSplineBinaryITD(
#ifdef FIX_2235_TD_RENDERER_WORD16
    modelITD->elevKSeq_fx = (const Word16 *) modelITD->elevKSeq_dyn_fx;
    modelITD->azimKSeq_fx = (const Word16 *) modelITD->azimKSeq_dyn_fx;
    modelITD->W_fx = (const Word16 *) modelITD->W_dyn_fx;
#else
    modelITD->elevKSeq_fx = (const Word32 *) modelITD->elevKSeq_dyn_fx;
    modelITD->azimKSeq_fx = (const Word32 *) modelITD->azimKSeq_dyn_fx;
#endif
    modelITD->W_fx = (const Word32 *) modelITD->W_dyn_fx;
#endif
#ifdef FIX_2235_TD_RENDERER_WORD16
    modelITD->azimBsShape_fx = (const Word16 *) modelITD->azimBsShape_dyn_fx;
    modelITD->elevBsShape_fx = (const Word16 *) modelITD->elevBsShape_dyn_fx;