Unverified Commit 9cb51f0f authored by norvell's avatar norvell
Browse files

Start of changing knot_interval to Word16

parent 98cba803
Loading
Loading
Loading
Loading
+27 −9
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@


#ifdef FIX_2235_TD_RENDERER_WORD16
static void getPeriodicBSplineSampVec_fx( Word32 *BfVec_fx, Word16 *AzIdx, const Word16 NumBFs, const Word32 t_fx, Word16 *num_az_idx, const Word32 knot_interval_fx, const Word16 azimKSeq_0_fx, const Word16 azimSegSamples, const Word16 *azimBsShape_fx, const Word16 subSampFactor );
static void getPeriodicBSplineSampVec_fx( Word32 *BfVec_fx, Word16 *AzIdx, const Word16 NumBFs, const Word32 t_fx, Word16 *num_az_idx, const Word16 knot_interval_fx, const Word16 azimKSeq_0_fx, const Word16 azimSegSamples, const Word16 *azimBsShape_fx, const Word16 subSampFactor );
static void getStandardBSplineSampVec_fx( Word32 *BfVec_fx, Word16 *NzIdx, Word16 *num_idx, const Word16 NumBFs, const Word32 t_fx, const Word16 *KSeq_fx, const Word16 KSeq_Q_fx, const Word16 SegSamples, const Word16 *BsLen, const Word16 *BsStart, const Word16 *BsShape_fx );
#else
static void getPeriodicBSplineSampVec_fx( Word32 *BfVec_fx, Word16 *AzIdx, const Word16 NumBFs, const Word32 t_fx, Word16 *num_az_idx, const Word32 knot_interval_fx, const Word32 azimKSeq_0_fx, const Word16 azimSegSamples, const Word32 *azimBsShape_fx, const Word16 subSampFactor );
@@ -210,7 +210,11 @@ static void GenerateFilter_fx(
    Word16 num_az_idx[HRTF_MODEL_BSPLINE_NUM_COEFFS];
    Word16 num_ev_idx;
    Word16 BM_idx[HRTF_MODEL_BSPLINE_NUM_COEFFS_SQ];
#ifdef FIX_2235_TD_RENDERER_WORD16
    Word16 knot_interval; /* Q6 */
#else
    Word32 knot_interval;
#endif
    Word32 ETotL, ETotR, ESynL, ESynR;
    Word16 ETotL_e, ETotR_e, ESynL_e, ESynR_e;
    Word32 ScaleL, ScaleR;
@@ -258,13 +262,12 @@ static void GenerateFilter_fx(
            move16();

#ifdef FIX_2235_TD_RENDERER_WORD16
            knot_interval = L_deposit_h( BASOP_Util_Divide3216_Scale( L_sub( L_deposit_l( model->azimKSeq_fx[k][model->azimDim3[k]] ), L_deposit_l( model->azimKSeq_fx[k][0] ) ), model->azimDim3[k], &tmp_e ) );
            tmp_e = add( tmp_e, 16 + 9 - 15 );
            knot_interval = sub( model->azimKSeq_fx[k][1], model->azimKSeq_fx[k][0] ); /* Q6 */
#else
            knot_interval = L_deposit_h( BASOP_Util_Divide3216_Scale( L_sub( model->azimKSeq_fx[k][model->azimDim3[k]], model->azimKSeq_fx[k][0] ), model->azimDim3[k], &tmp_e ) );
            tmp_e = add( tmp_e, 9 - 15 );
#endif
            knot_interval = L_shr( knot_interval, sub( 9, tmp_e ) ); // variable Q to Q22
#endif

#ifdef FIX_2235_TD_RENDERER_WORD16
            getPeriodicBSplineSampVec_fx( modelEval->azimBfVec_fx[p], AzIdx[p], model->azimDim3[k], azim, &num_az_idx[p],
@@ -647,10 +650,11 @@ static void getPeriodicBSplineSampVec_fx(
    const Word16 NumBFs,           /* i  : the number of basis functions = third index of Bf.    */
    const Word32 t_fx,             /* i  : azimuth                                           Q22 */
    Word16 *num_az_idx,            /* o  : Number of azimuth indices                             */
    const Word32 knot_interval_fx, /* i  : The knot interval                                 Q22 */
#ifdef FIX_2235_TD_RENDERER_WORD16
    const Word16 azimKSeq_0_fx, /* i  : Knot sequence                             Q azimKSeq_Q_fx*/
    const Word16 knot_interval_fx, /* i  : The knot interval                                  Q6 */
    const Word16 azimKSeq_0_fx,    /* i  : Knot sequence                                      Q6 */
#else
    const Word32 knot_interval_fx, /* i  : The knot interval                                 Q22 */
    const Word32 azimKSeq_0_fx,   /* i  : Knot sequence                                     Q22 */
#endif
    const Word16 azimSegSamples, /* i  : Samples per segment                                   */
@@ -682,7 +686,11 @@ static void getPeriodicBSplineSampVec_fx(
    }
    ELSE
    {
#ifdef FIX_2235_TD_RENDERER_WORD16
        tmp32 = L_deposit_h( BASOP_Util_Divide1616_Scale( knot_interval_fx, SegSamples, &tmp_e1 ) );
#else
        tmp32 = L_deposit_h( BASOP_Util_Divide3216_Scale( knot_interval_fx, SegSamples, &tmp_e1 ) );
#endif
        tmp_e1 = add( tmp_e1, 9 - 15 );
#ifdef FIX_2235_TD_RENDERER_WORD16
        tmp32 = L_deposit_h( BASOP_Util_Divide3232_Scale( L_sub( t_fx, L_shl( L_deposit_l( azimKSeq_0_fx ), Q22 - Q6 ) ), tmp32, &tmp_e2 ) );
@@ -758,22 +766,32 @@ static void getStandardBSplineSampVec_fx(
)
{
    Word16 i, nI;
#ifdef FIX_2235_TD_RENDERER_WORD16
    Word16 knot_interval_fx;
#else
    Word32 knot_interval_fx;
#endif
    Word16 d0, d, shape_idx, start_idx;
    Word16 tmp_e1, tmp_e2, tmp_e3;
    Word32 tmp32;

    /* assuming triple knot at the first knot */
#ifdef FIX_2235_TD_RENDERER_WORD16
    tmp32 = L_shl( L_sub( L_deposit_l( KSeq_fx[NumBFs - 3] ), L_deposit_l( KSeq_fx[0] ) ), sub( 22, KSeq_Q_fx ) ); /* Q22 */
    knot_interval_fx = L_deposit_h( BASOP_Util_Divide3216_Scale( tmp32, sub( NumBFs, 3 ), &tmp_e1 ) );
    //tmp32 = L_shl( L_sub( L_deposit_l( KSeq_fx[NumBFs - 3] ), L_deposit_l( KSeq_fx[0] ) ), sub( 22, KSeq_Q_fx ) ); /* Q22 */
    //knot_interval_fx = L_deposit_h( BASOP_Util_Divide3216_Scale( tmp32, sub( NumBFs, 3 ), &tmp_e1 ) );
    knot_interval_fx = shl( sub( KSeq_fx[1], KSeq_fx[0] ), Q6 - KSeq_Q_fx ); /* Variable Q -> Q6 */
    tmp_e1 = 9;
#else
    knot_interval_fx = L_deposit_h( BASOP_Util_Divide3216_Scale( L_sub( KSeq_fx[NumBFs - 3], KSeq_fx[0] ), sub( NumBFs, 3 ), &tmp_e1 ) );
#endif
    tmp_e1 = add( tmp_e1, 9 - 15 );
#endif

    /* index of closest sample point */
#ifdef FIX_2235_TD_RENDERER_WORD16
    tmp32 = L_deposit_h( BASOP_Util_Divide1616_Scale( knot_interval_fx, SegSamples, &tmp_e2 ) );
#else
    tmp32 = L_deposit_h( BASOP_Util_Divide3216_Scale( knot_interval_fx, SegSamples, &tmp_e2 ) );
#endif
    tmp_e2 = add( tmp_e2, sub( tmp_e1, 15 ) );
#ifdef FIX_2235_TD_RENDERER_WORD16
    tmp32 = L_deposit_h( BASOP_Util_Divide3232_Scale( L_sub( t_fx, L_shl( L_deposit_l( KSeq_fx[0] ), sub( 22, KSeq_Q_fx ) ) ), tmp32, &tmp_e3 ) );