void MultitapEchoControls::lpSamplesChanged( int begin, int end ) { //qDebug( "b/e %d - %d", begin, end ); const float * samples = m_lpGraph.samples(); for( int i = begin; i <= end; ++i ) { m_effect->m_lpFreq[i] = 20.0f * exp10f( samples[i] ); } m_effect->updateFilters( begin, end ); }
static double my_exp10f(int n) { #if (defined WIN32) || (defined __APPLE__) double res=1. ; for ( int i=0; i < n; ++i) res *= 10. ; return res ; #else return exp10f(n) ; #endif }
static float FromDecibel(float dB) { float Gain = exp10f(dB / 20.f); return Gain < 0.0001f ? 0 : Gain; }
__host__ void single_precision_math_functions() { int iX; float fX, fY; acosf(1.0f); acoshf(1.0f); asinf(0.0f); asinhf(0.0f); atan2f(0.0f, 1.0f); atanf(0.0f); atanhf(0.0f); cbrtf(0.0f); ceilf(0.0f); copysignf(1.0f, -2.0f); cosf(0.0f); coshf(0.0f); //cospif(0.0f); //cyl_bessel_i0f(0.0f); //cyl_bessel_i1f(0.0f); erfcf(0.0f); //erfcinvf(2.0f); //erfcxf(0.0f); erff(0.0f); //erfinvf(1.0f); exp10f(0.0f); exp2f(0.0f); expf(0.0f); expm1f(0.0f); fabsf(1.0f); fdimf(1.0f, 0.0f); //fdividef(0.0f, 1.0f); floorf(0.0f); fmaf(1.0f, 2.0f, 3.0f); fmaxf(0.0f, 0.0f); fminf(0.0f, 0.0f); fmodf(0.0f, 1.0f); frexpf(0.0f, &iX); hypotf(1.0f, 0.0f); ilogbf(1.0f); isfinite(0.0f); isinf(0.0f); isnan(0.0f); ///j0f(0.0f); ///j1f(0.0f); ///jnf(-1.0f, 1.0f); ldexpf(0.0f, 0); ///lgammaf(1.0f); ///llrintf(0.0f); ///llroundf(0.0f); log10f(1.0f); log1pf(-1.0f); log2f(1.0f); logbf(1.0f); logf(1.0f); ///lrintf(0.0f); ///lroundf(0.0f); modff(0.0f, &fX); ///nanf("1"); nearbyintf(0.0f); //nextafterf(0.0f); //norm3df(1.0f, 0.0f, 0.0f); //norm4df(1.0f, 0.0f, 0.0f, 0.0f); //normcdff(0.0f); //normcdfinvf(1.0f); //fX = 1.0f; normf(1, &fX); powf(1.0f, 0.0f); //rcbrtf(1.0f); remainderf(2.0f, 1.0f); remquof(1.0f, 2.0f, &iX); //rhypotf(0.0f, 1.0f); ///rintf(1.0f); //rnorm3df(0.0f, 0.0f, 1.0f); //rnorm4df(0.0f, 0.0f, 0.0f, 1.0f); //fX = 1.0f; rnormf(1, &fX); roundf(0.0f); //rsqrtf(1.0f); ///scalblnf(0.0f, 1); scalbnf(0.0f, 1); signbit(1.0f); sincosf(0.0f, &fX, &fY); //sincospif(0.0f, &fX, &fY); sinf(0.0f); sinhf(0.0f); //sinpif(0.0f); sqrtf(0.0f); tanf(0.0f); tanhf(0.0f); tgammaf(2.0f); truncf(0.0f); ///y0f(1.0f); ///y1f(1.0f); ///ynf(1, 1.0f); }
static inline void calc_coeffs4 (double *bcoeff, double *acoeff, double w0, double Dw, double gain) { double G = exp10f(gain/20.f); // bandwidth gain is set to half gain double GB = exp10f(gain/40.f); double c0 = cosf(w0); double WB = tanf(Dw/2); double e = sqrtf((G*G-GB*GB)/(GB*GB-1.f)); double g = powf(G, 0.25f); double a = powf(e, 0.25f); #define si1 0.382683432365089781779f; #define si2 0.923879532511286738483f; //Ba(1+i,:) = [g^2*WB^2*v, 2*g*b*si*WB, b^2*v] //Aa(1+i,:) = [WB^2*v, 2*a*si*WB, a^2*v] double Aa0 = WB*WB; double Aatmp = 2*a*WB; double Aa10 = Aatmp * si1; double Aa11 = Aatmp * si2; double as = a*a; double Ba0 = Aa0 * g*g; double Batmp = 2*g * a * WB; double Ba10 = Batmp * si1; double Ba11 = Batmp * si2; // fprintf(stdout, "%f %f %f %f %f %f %f\n", Aa0, Aa10, Aa11, Ba0, Ba10, Ba11, as); // double Bhat0 = Ba0/Aa0; // D = A0(i)+A1(i)+A2(i) double D1 = Aa0+Aa11+as; double D0 = Aa0+Aa10+as; //Bhat(i,1) = (B0(i)+B1(i)+B2(i))./D //(B0(i)+B1(i)+B2(i))./D double tmp = Ba0+as; double x; double Bhat00 = (Ba10+tmp)/D0; double Bhat01 = (Ba11+tmp)/D1; x=2.f*(Ba0-as); double Bhat10 = x/D0; double Bhat11 = x/D1; double Bhat20 = (tmp-Ba10)/D0; double Bhat21 = (tmp-Ba11)/D1; //Ahat(i,1) = 1 //Ahat(i,2) = 2*(A0(i)-A2(i))./D //Ahat(i,3) = (A0(i)-A1(i)+A2(i))./D x = 2.f*(Aa0-as); double Ahat10 = x/D0; double Ahat11 = x/D1; double Ahat20 = (Aa0-Aa10+as)/D0; double Ahat21 = (Aa0-Aa11+as)/D1; // fprintf(stdout, "%f %f %f %f %f\n %f %f %f %f\n\n",Bhat00, Bhat01, Bhat10, Bhat11, Bhat21, Ahat11, Ahat10, Ahat20, Ahat21); // B(i,2) = c0*(Bhat(i,2)-2*Bhat(i,1)) bcoeff[0] = Bhat00; bcoeff[5] = Bhat01; bcoeff[1] = c0*(Bhat10-2.f*Bhat00); bcoeff[6] = c0*(Bhat11-2.f*Bhat01); bcoeff[2] = (Bhat00-Bhat10+Bhat20)*c0*c0- Bhat10; bcoeff[7] = (Bhat01-Bhat11+Bhat21)*c0*c0 - Bhat11; bcoeff[3] = c0*(Bhat10-2.f*Bhat20); bcoeff[8] = c0*(Bhat11-2.f*Bhat21); bcoeff[4] = Bhat20; bcoeff[9] = Bhat21; // fprintf(stdout, "%f %f %f %f %f\n %f %f %f %f %f\n", Bres00, Bres10, Bres20, Bres30, Bres40, Bres01, Bres11, Bres21, Bres31, Bres41); acoeff[0]= c0*(Ahat10-2.f); acoeff[4]= c0*(Ahat11-2.f); acoeff[1]= (1.f-Ahat10+Ahat20)*c0*c0 - Ahat10; acoeff[5]= (1.f-Ahat11+Ahat21)*c0*c0- Ahat11; acoeff[2]= c0*(Ahat10-2.f*Ahat20); acoeff[6]= c0*(Ahat11-2.f*Ahat21); acoeff[3]= Ahat20; acoeff[7]= Ahat21; // fprintf(stdout, "%f %f %f %f %f\n %f %f %f %f %f\n", Ares00, Ares10, Ares20, Ares30, Ares40, Ares01, Ares11, Ares21, Ares31, Ares41); }
__global__ void FloatMathPrecise() { int iX; float fX, fY; acosf(1.0f); acoshf(1.0f); asinf(0.0f); asinhf(0.0f); atan2f(0.0f, 1.0f); atanf(0.0f); atanhf(0.0f); cbrtf(0.0f); fX = ceilf(0.0f); fX = copysignf(1.0f, -2.0f); cosf(0.0f); coshf(0.0f); cospif(0.0f); cyl_bessel_i0f(0.0f); cyl_bessel_i1f(0.0f); erfcf(0.0f); erfcinvf(2.0f); erfcxf(0.0f); erff(0.0f); erfinvf(1.0f); exp10f(0.0f); exp2f(0.0f); expf(0.0f); expm1f(0.0f); fX = fabsf(1.0f); fdimf(1.0f, 0.0f); fdividef(0.0f, 1.0f); fX = floorf(0.0f); fmaf(1.0f, 2.0f, 3.0f); fX = fmaxf(0.0f, 0.0f); fX = fminf(0.0f, 0.0f); fmodf(0.0f, 1.0f); frexpf(0.0f, &iX); hypotf(1.0f, 0.0f); ilogbf(1.0f); isfinite(0.0f); fX = isinf(0.0f); fX = isnan(0.0f); j0f(0.0f); j1f(0.0f); jnf(-1.0f, 1.0f); ldexpf(0.0f, 0); lgammaf(1.0f); llrintf(0.0f); llroundf(0.0f); log10f(1.0f); log1pf(-1.0f); log2f(1.0f); logbf(1.0f); logf(1.0f); lrintf(0.0f); lroundf(0.0f); modff(0.0f, &fX); fX = nanf("1"); fX = nearbyintf(0.0f); nextafterf(0.0f, 0.0f); norm3df(1.0f, 0.0f, 0.0f); norm4df(1.0f, 0.0f, 0.0f, 0.0f); normcdff(0.0f); normcdfinvf(1.0f); fX = 1.0f; normf(1, &fX); powf(1.0f, 0.0f); rcbrtf(1.0f); remainderf(2.0f, 1.0f); remquof(1.0f, 2.0f, &iX); rhypotf(0.0f, 1.0f); fY = rintf(1.0f); rnorm3df(0.0f, 0.0f, 1.0f); rnorm4df(0.0f, 0.0f, 0.0f, 1.0f); fX = 1.0f; rnormf(1, &fX); fY = roundf(0.0f); rsqrtf(1.0f); scalblnf(0.0f, 1); scalbnf(0.0f, 1); signbit(1.0f); sincosf(0.0f, &fX, &fY); sincospif(0.0f, &fX, &fY); sinf(0.0f); sinhf(0.0f); sinpif(0.0f); sqrtf(0.0f); tanf(0.0f); tanhf(0.0f); tgammaf(2.0f); fY = truncf(0.0f); y0f(1.0f); y1f(1.0f); ynf(1, 1.0f); }