Displaying 20 results from an estimated 76 matches for "m_pi".
2014 Apr 15
6
[PATCH 0/3] misc. cleanup
Hello,
some misc. cleanup patches for speexdsp, nothing big
I'm not sure about how to submit patches, so this is a test balloon :)
ultimately, I'd like to fix the FIXED_POINT issue, see
http://lists.xiph.org/pipermail/speex-dev/2013-December/008465.html
currently, I think the only way to find out how speexdsp has been compiled is
to resample some bytes and observe the output; which is
2007 Jun 18
1
two bessel function bugs for nu<0
...for nu<0 and expon.scaled=TRUE
#tested with R-devel (2007-06-17 r41981)
x <- 2.3
nu <- -0.4
print(paste(besselI(x, nu, TRUE), "=", exp(-x)*besselI(x, nu, FALSE)))
#fix:
#$ diff bessel_i_old.c bessel_i_new.c
#57c57
#< bessel_k(x, -alpha, expo) * ((ize == 1)? 2. : 2.*exp(-x))/M_PI
#---
#> bessel_k(x, -alpha, expo) * ((ize == 1)? 2. : 2.*exp(-2.0*x))/M_PI
#bug 2: besselY() for nu<0
#don't know how to check in R; a few random checks against mathematica 5.2
#fix:
#$ diff bessel_y_old.c bessel_y_new.c
#55c55
#< return(bessel_y(x, -alpha) + bessel_j(x, -alpha) *...
2014 Apr 15
0
[PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
...;*/
float xx = x * cutoff;
- if (fabs(x)<1e-6f)
+ if (fabsf(x)<1e-6f)
return WORD2INT(32768.*cutoff);
- else if (fabs(x) > .5f*N)
+ else if (fabsf(x) > .5f*N)
return 0;
/*FIXME: Can it really be any slower than this? */
- return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabs(2.*x/N), window_func));
+ return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) * compute_func(fabsf(2.*x/N), window_func));
}
#else
/* The slow way of computing a sinc for the table. Should improve that some day */
@@ -286,12 +286,12 @@ static spx_word16_t sin...
2013 Sep 25
1
PATCH: move M_PI definition to share/compat.h
Analogous to M_LN2 patch: the patch moves definition of M_PI
from src/libFLAC/window.c and src/test_streams/main.c to include/share/compat.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: M_PI.patch
Type: application/octet-stream
Size: 1581 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/flac-dev/attachme...
2014 Apr 15
2
[PATCH 2/3] Use fabsf() instead of fabs() since we have floats, not double
...if (fabs(x)<1e-6f)
> + if (fabsf(x)<1e-6f)
> return WORD2INT(32768.*cutoff);
> - else if (fabs(x) > .5f*N)
> + else if (fabsf(x) > .5f*N)
> return 0;
> /*FIXME: Can it really be any slower than this? */
> - return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) *
> compute_func(fabs(2.*x/N), window_func));
> + return WORD2INT(32768.*cutoff*sin(M_PI*xx)/(M_PI*xx) *
> compute_func(fabsf(2.*x/N), window_func));
> }
> #else
> /* The slow way of computing a sinc for the table. Should improve that
> some day */
> @@ -2...
2002 Aug 16
2
Setting up the trig tables.
As some of you know, I'm creating a hardware MDCT core. At the moment
I'm working out the best way to create a lookup table for the trig
values, as set up in mdct_init:
/* trig lookups... */
for(i=0;i<n/4;i++){
T[i*2]=FLOAT_CONV(cos((M_PI/n)*(4*i)));
T[i*2+1]=FLOAT_CONV(-sin((M_PI/n)*(4*i)));
T[n2+i*2]=FLOAT_CONV(cos((M_PI/(2*n))*(2*i+1)));
T[n2+i*2+1]=FLOAT_CONV(sin((M_PI/(2*n))*(2*i+1)));
}
for(i=0;i<n/8;i++){
T[n+i*2]=FLOAT_CONV(cos((M_PI/n)*(4*i+2))*.5);
T[n+i*2+1]=FLOAT_CONV(-sin((M_PI/n)*(4*i+2))*.5)...
2003 Jun 25
1
indication tones and callwaiting chirp too loud
I am wondering if anyone could help me figure out how to turn down the volume on all the dial tones, indications, etc.. and especially the call-waiting CHIRP!
I don't want to change the txgain and rxgain because they are working at levels that I would like. However, when voice conversations and voicemail recordings are at good levels then the dial tones, busy tones, etc are way too loud.
2011 Mar 03
1
fixed point code
...r you may kindly provide us with ROM tables of the array for each possible combination of frame size and sampling freq...?
CELTMode *celt_mode_create(celt_int32 Fs, int frame_size, int *error)
{
....
....
#ifndef FIXED_POINT
for (i=0;i<mode->overlap;i++)
window[i] = Q15ONE*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap));
#else
for (i=0;i<mode->overlap;i++)
window[i] = MIN32(32767,floor(.5+32768.*sin(.5*M_PI* sin(.5*M_PI*(i+.5)/mode->overlap) * sin(.5*M_PI*(i+.5)/mode->overlap))));
#endif
.....
.....
}
[2] Usage on...
2010 Jun 07
0
No subject
...oat *) malloc(sizeof(*x) * n2);
=A0=A0 memcpy(x, buffer, sizeof(*x) * n2);
=A0=A0 for (i=3D0; i < n; ++i) {
=A0=A0=A0=A0=A0 float acc =3D 0;
=A0=A0=A0=A0=A0 for (j=3D0; j < n2; ++j)
=A0=A0=A0=A0=A0=A0=A0=A0 // formula from paper:
=A0=A0=A0=A0=A0=A0=A0=A0 //acc +=3D n/4.0f * x[j] * (float) cos(M_PI / 2 / =
n * (2 * i + 1 + n/2.0)*(2*j+1));
=A0=A0=A0=A0=A0=A0=A0=A0 // formula from wikipedia
=A0=A0=A0=A0=A0=A0=A0=A0 //acc +=3D 2.0f / n2 * x[j] * (float) cos(M_PI/n2 =
* (i + 0.5 + n2/2)*(j + 0.5));
=A0=A0=A0=A0=A0=A0=A0=A0 // these are equivalent, except the formula from t=
he paper inverts the...
2008 Sep 15
2
1.2rc1
...x 1.2rc1 to a project of mine, not
via compiling as a static library yet including the source and
compiling with my own to create a dynamic link library. This worked
fine with the last beta release yet is causing problems with this
release candidate. The problem is in the file scal.c which is about
M_PI being undefined, this file was added to speex in said version. Is
there a work around to this which does not involve editing the source
of speex or does the library no require that it be compiled
separately?
Thanks.
2019 May 27
0
opus-1.3.1 patch for ARM Cortex-M4F (single precision)
...))>>15)
diff -Naupr opus-1.3.1-vanilla/celt/modes.c opus-1.3.1/celt/modes.c
--- opus-1.3.1-vanilla/celt/modes.c 2018-09-26 14:49:41 +0800
+++ opus-1.3.1/celt/modes.c 2019-05-27 17:18:26 +0800
@@ -71,7 +71,7 @@ static const unsigned char band_allocati
#endif /* CUSTOM_MODES_ONLY */
#ifndef M_PI
-#define M_PI 3.141592653
+#define M_PI 3.14159265358979f
#endif
#ifdef CUSTOM_MODES
diff -Naupr opus-1.3.1-vanilla/silk/SigProc_FIX.h opus-1.3.1/silk/SigProc_FIX.h
--- opus-1.3.1-vanilla/silk/SigProc_FIX.h 2018-09-26 14:49:41 +0800
+++ opus-1.3.1/silk/SigProc_FIX.h 2019-05-27 17:18:59 +0800
@@...
2007 Oct 13
2
the use of the .C function
...) {
s += 1.0/(xa+k);
}
xa += n;
}
x2 = 1.0/(xa*xa);
ps = log(xa)-0.5/xa+x2*(((((((a[7]*x2+a[6])*x2+a[5])*x2+
a[4])*x2+a[3])*x2+a[2])*x2+a[1])*x2+a[0]);
ps -= s;
}
if (x < 0.0)
ps = ps - M_PI*cos(M_PI*x)/sin(M_PI*x)-1.0/x;
return ps;
}
However, when applicated the codes
>digamma(-0.9)
[1] -9.312644 OK!
But when
> dyn.load("psi.so")
> out<-.C("psi", as.double(-0.9))
Erro en .C("psi", as.double(-0.9)) : C symbol name "psi"...
2013 Aug 27
1
Error in simulation. NAN
...SEXP acc_index_k_r
//
){
/*****************************************
Varie ed eventuali
*****************************************/
// indici
int i,j,k,l,h,t,f,info,MCMC_iter,MCMC_iter2;
int nProtect= 0;
int indice_adapt=0;
double duepi = (2*M_PI);
// costanti
char const *lower = "L";
char const *upper = "U";
char const *ntran = "N";
char const *ytran = "T";
char const *rside = "R";
char const *lside = "L";
const double one = 1.0;
const...
1999 Nov 15
1
(no subject)
...->endbyte;
}
value&=mask[bits];
bits+=b->endbit;
////////////////////////////////////////////////////
// { because of this
b->ptr[0]|=value<<b->endbit;
// }
////////////////////////////////////////////////////
2.)
undefined under win32 so define them:
#define M_PI (3.14159265359)
#define rint(x) (floor((x)+0.5)) // is this correct?
3.)
thousands of tons things like that had become
double out[winsize/2];
to
double *out=(double *) _alloca((winsize/2)*sizeof(double));
4.)
I found different behaviour between gcc and msvc when dividing very small doubles (like...
2019 Jun 14
0
resample of libopusenc-0.2.1 outputs all zeros if define FIXED_POINT
...ibopusenc-0.2.1-vanilla/src/resample.c libopusenc-0.2.1/src/resample.c
--- libopusenc-0.2.1-vanilla/src/resample.c 2018-09-15 10:35:06 +0800
+++ libopusenc-0.2.1/src/resample.c 2019-06-15 01:32:37 +0800
@@ -82,7 +82,7 @@ static void speex_free(void *ptr) {free(
#include <limits.h>
#ifndef M_PI
-#define M_PI 3.14159265358979323846
+#define M_PI 3.14159265358979323846f
#endif
#define IMAX(a,b) ((a) > (b) ? (a) : (b))
@@ -1000,7 +1000,8 @@ EXPORT int speex_resampler_process_int(S
if (in) {
for(j=0;j<ichunk;++j)
#ifdef FIXED_POINT
- x[j+st->filt_len-...
2016 Dec 01
1
Different results for cos,sin,tan and cospi,sinpi,tanpi
hi,
my environment...
> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)
locale:
[1] LC_CTYPE=ja_JP.UTF-8 LC_NUMERIC=C
[3] LC_TIME=ja_JP.UTF-8 LC_COLLATE=ja_JP.UTF-8
[5] LC_MONETARY=ja_JP.UTF-8 LC_MESSAGES=ja_JP.UTF-8
[7] LC_PAPER=ja_JP.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C
2016 Dec 01
2
Different results for cos,sin,tan and cospi,sinpi,tanpi
...ath/cospi.c 2016-12-01 13:54:38.863357149 +0900
@@ -35,7 +35,11 @@
#endif
if(!R_FINITE(x)) ML_ERR_return_NAN;
- x = fmod(fabs(x), 2.);// cos() symmetric; cos(pi(x + 2k)) ==
cos(pi x) for all integer k
+ x = fabs(x);
+ if ( x > 9007199254740991 ) /* 2^53-1 */
+ return cos(M_PI * x);
+
+ x = fmod(x, 2.);// cos() symmetric; cos(pi(x + 2k)) == cos(pi x)
for all integer k
if(fmod(x, 1.) == 0.5) return 0.;
if( x == 1.) return -1.;
if( x == 0.) return 1.;
@@ -57,6 +61,9 @@
#endif
if(!R_FINITE(x)) ML_ERR_return_NAN;
+ if (( x > 90071...
2011 Oct 20
0
[LLVMdev] Re : ANN: libclc (OpenCL C library implementation)
...ving a Python script "compiling" a set of built-ins into four files. For example, this declaration (REPL is a macro that does a simple for()) :
----
def vecf : float2 float3 float4 float8 float16
native $type acospi $vecf : x:$type
REPL($vecdim)
result[i] = std::acos(x[i]) / M_PI;
end
----
Is compiled to these fragments, one for each vector type (float2, float3, etc) :
----
// In stdlib_def.h : what the OpenCL C kernel sees
float2 OVERLOAD acospi(float2 x);
// In stdlib_impl.h : what gets compiled to LLVM IR at Clover compile time, and then linked to each kernel
void __c...
2004 Aug 06
2
What is the format of the PCM/WAV dataforspeex_encode & speex_decode?
I thought it would be more update/better/faster, any thing wrong?
In the future, would you use short, and forget about float?
If so, I use 1.1.4, I wouldn't need to change my code in the future, right?
You said, it's unstable, yes, I got compiling errors with MsVC6 and MsVC.net
And I modified it a bit to get it compiled. Should I post the errors here?
<p>-----Original Message-----
2004 Apr 11
3
pcauchy precision (PR#6756)
...elinder
Version: snapshot
OS:
Submission from: (NULL) (65.213.85.129)
Two things are wrong.
1. There is nan test outside IEEE_754.
2. The meat part of the function should really be something like...
if (!lower_tail)
x = -x;
if (fabs (x) > 1) {
double temp = atan (1 / x) / M_PI;
return (x > 0) ? R_D_Clog (temp) : R_D_val (-temp);
} else
return R_D_val (0.5 + atan (x) / M_PI);
...instead of the current heavily truncated series expansion. The above is
much
simpler and more precise. (Thanks to Ian Smith for pointing the in-hindsight-
obvious 1/x trick out...