Skip to content

Commit

Permalink
2.1.0.230: uniq math operations
Browse files Browse the repository at this point in the history
  • Loading branch information
zvezdochiot committed Jul 17, 2019
1 parent 9a03fce commit 2d8a250
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
5 changes: 5 additions & 0 deletions libfalabaac/fa_fastmath.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ static float fast_atan (float value)
return result;
}

float fa_fast_atan (float value)
{
return fast_atan (value);
}

float fa_fast_atan2(float y, float x)
{
float sita;
Expand Down
3 changes: 3 additions & 0 deletions libfalabaac/fa_fastmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,18 @@ extern "C"
//No2. angle fast function
float fa_fast_sin(float angle);
float fa_fast_cos(float angle);
float fa_fast_atan (float value);
float fa_fast_atan2(float y, float x);

#ifdef FA_USE_FASTANGLE
#define FA_SIN(x) (fa_fast_sin(x))
#define FA_COS(x) (fa_fast_cos(x))
#define FA_ATAN(x) (fa_fast_atan(x))
#define FA_ATAN2(y,x) (fa_fast_atan2(y,x))
#else
#define FA_SIN(x) (sin(x))
#define FA_COS(x) (cos(x))
#define FA_ATAN(x) (atan(x))
#define FA_ATAN2(y,x) (atan2(y,x))
#endif

Expand Down
8 changes: 3 additions & 5 deletions libfalabaac/fa_psychomodel1.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,8 @@ static float db_inv(float db)
{
#ifdef TEST_MAXMINDB
/*printf("db=%f\n", db);*/
if (db > dbmax)
dbmax = db;
if (db < dbmin)
dbmin = db;
dbmax = FA_MAX(db, dbmax);
dbmin = FA_MIN(db, dbmin);
#endif

#ifdef DB_FAST
Expand Down Expand Up @@ -171,7 +169,7 @@ static float freq2bark(float freq)
if (freq < 0)
freq = 0;
freq = freq * 0.001;
return 13.0 * atan(.76 * freq) + 3.5 * atan(freq * freq / (7.5 * 7.5));
return 13.0 * FA_ATAN(.76 * freq) + 3.5 * FA_ATAN(freq * freq / (7.5 * 7.5));
}

/*cover f(Hz) to SPL(dB)*/
Expand Down
2 changes: 1 addition & 1 deletion libfalabaac/fa_tns.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int truncate_cof(int order, float threshold, float * kcof)
for (i = order; i >= 0; i--)
{
/*printf("kcof[%d]=%f\n", i, kcof[i]);*/
kcof[i] = (fabs(kcof[i])>threshold) ? kcof[i] : 0.0;
kcof[i] = (FA_ABS(kcof[i])>threshold) ? kcof[i] : 0.0;
if (kcof[i]!=0.0) return i;
}

Expand Down

0 comments on commit 2d8a250

Please sign in to comment.