public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/4126: optimization
@ 2001-08-25 13:16 gerold.jury
0 siblings, 0 replies; 2+ messages in thread
From: gerold.jury @ 2001-08-25 13:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 4126
>Category: optimization
>Synopsis: optimization
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Sat Aug 25 13:16:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Gerold Jury
>Release: 3.0.1
>Organization:
at home
>Environment:
System: Linux gurke 2.4.9-xfs #2 Fri Aug 24 17:15:26 CEST 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --prefix=/usr --enable-shared --enable-threads --enable-languages=c++,objc,java --disable-checking
>Description:
when compiled with
c++ -O3 -march=i686 -c uff.cpp
the code at the end of the message fails with
resample.cpp: In function `void pre_resample(Sample*)':
resample.cpp:1274: warning: assignment to `short int' from `double'
resample.cpp:1274: warning: argument to `short int' from `double'
resample.cpp:1298: Internal compiler error in print_rtl_and_abort, at flow.c:
6446
with O2 or march=i586 it does not happen any more
>How-To-Repeat:
c++ -O3 -march=i686 -c uff.cpp
>Fix:
the preprocessed source
# 24 "resample.cpp"
# 1 "/usr/include/math.h" 1 3
# 27 "/usr/include/math.h" 3
# 1 "/usr/include/features.h" 1 3
# 283 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 284 "/usr/include/features.h" 2 3
# 312 "/usr/include/features.h" 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 313 "/usr/include/features.h" 2 3
# 28 "/usr/include/math.h" 2 3
extern "C" {
# 1 "/usr/include/bits/huge_val.h" 1 3
# 25 "/usr/include/bits/huge_val.h" 3
# 1 "/usr/include/features.h" 1 3
# 26 "/usr/include/bits/huge_val.h" 2 3
# 34 "/usr/include/math.h" 2 3
# 1 "/usr/include/bits/nan.h" 1 3
# 38 "/usr/include/math.h" 2 3
# 1 "/usr/include/bits/mathdef.h" 1 3
# 29 "/usr/include/bits/mathdef.h" 3
typedef long double float_t;
typedef long double double_t;
# 41 "/usr/include/math.h" 2 3
# 63 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern double acos (double __x) throw (); extern double __acos (double __x) throw ();
extern double asin (double __x) throw (); extern double __asin (double __x) throw ();
extern double atan (double __x) throw (); extern double __atan (double __x) throw ();
extern double atan2 (double __y, double __x) throw (); extern double __atan2 (double __y, double __x) throw ();
extern double cos (double __x) throw (); extern double __cos (double __x) throw ();
extern double sin (double __x) throw (); extern double __sin (double __x) throw ();
extern double tan (double __x) throw (); extern double __tan (double __x) throw ();
extern void sincos (double __x, double *__sinx, double *__cosx) throw (); extern void __sincos (double __x, double *__sinx, double *__cosx) throw ();
extern double cosh (double __x) throw (); extern double __cosh (double __x) throw ();
extern double sinh (double __x) throw (); extern double __sinh (double __x) throw ();
extern double tanh (double __x) throw (); extern double __tanh (double __x) throw ();
extern double acosh (double __x) throw (); extern double __acosh (double __x) throw ();
extern double asinh (double __x) throw (); extern double __asinh (double __x) throw ();
extern double atanh (double __x) throw (); extern double __atanh (double __x) throw ();
extern double exp (double __x) throw (); extern double __exp (double __x) throw ();
extern double exp10 (double __x) throw (); extern double __exp10 (double __x) throw ();
extern double pow10 (double __x) throw (); extern double __pow10 (double __x) throw ();
extern double frexp (double __x, int *__exponent) throw (); extern double __frexp (double __x, int *__exponent) throw ();
extern double ldexp (double __x, int __exponent) throw (); extern double __ldexp (double __x, int __exponent) throw ();
extern double log (double __x) throw (); extern double __log (double __x) throw ();
extern double log10 (double __x) throw (); extern double __log10 (double __x) throw ();
extern double modf (double __x, double *__iptr) throw (); extern double __modf (double __x, double *__iptr) throw ();
extern double expm1 (double __x) throw (); extern double __expm1 (double __x) throw ();
extern double log1p (double __x) throw (); extern double __log1p (double __x) throw ();
extern double logb (double __x) throw (); extern double __logb (double __x) throw ();
extern double exp2 (double __x) throw (); extern double __exp2 (double __x) throw ();
extern double log2 (double __x) throw (); extern double __log2 (double __x) throw ();
extern double pow (double __x, double __y) throw (); extern double __pow (double __x, double __y) throw ();
extern double sqrt (double __x) throw (); extern double __sqrt (double __x) throw ();
extern double hypot (double __x, double __y) throw (); extern double __hypot (double __x, double __y) throw ();
extern double cbrt (double __x) throw (); extern double __cbrt (double __x) throw ();
extern double ceil (double __x) throw (); extern double __ceil (double __x) throw ();
extern double fabs (double __x) throw () __attribute__ ((__const__)); extern double __fabs (double __x) throw () __attribute__ ((__const__));
extern double floor (double __x) throw (); extern double __floor (double __x) throw ();
extern double fmod (double __x, double __y) throw (); extern double __fmod (double __x, double __y) throw ();
extern int __isinf (double __value) throw () __attribute__ ((__const__));
extern int __finite (double __value) throw () __attribute__ ((__const__));
extern int isinf (double __value) throw () __attribute__ ((__const__));
extern int finite (double __value) throw () __attribute__ ((__const__));
extern double drem (double __x, double __y) throw (); extern double __drem (double __x, double __y) throw ();
extern double significand (double __x) throw (); extern double __significand (double __x) throw ();
extern double copysign (double __x, double __y) throw () __attribute__ ((__const__)); extern double __copysign (double __x, double __y) throw () __attribute__ ((__const__));
extern double nan (__const char *__tagb) throw () __attribute__ ((__const__)); extern double __nan (__const char *__tagb) throw () __attribute__ ((__const__));
extern int __isnan (double __value) throw () __attribute__ ((__const__));
extern int isnan (double __value) throw () __attribute__ ((__const__));
extern double j0 (double) throw (); extern double __j0 (double) throw ();
extern double j1 (double) throw (); extern double __j1 (double) throw ();
extern double jn (int, double) throw (); extern double __jn (int, double) throw ();
extern double y0 (double) throw (); extern double __y0 (double) throw ();
extern double y1 (double) throw (); extern double __y1 (double) throw ();
extern double yn (int, double) throw (); extern double __yn (int, double) throw ();
extern double erf (double) throw (); extern double __erf (double) throw ();
extern double erfc (double) throw (); extern double __erfc (double) throw ();
extern double lgamma (double) throw (); extern double __lgamma (double) throw ();
extern double tgamma (double) throw (); extern double __tgamma (double) throw ();
extern double gamma (double) throw (); extern double __gamma (double) throw ();
extern double lgamma_r (double, int *__signgamp) throw (); extern double __lgamma_r (double, int *__signgamp) throw ();
extern double rint (double __x) throw (); extern double __rint (double __x) throw ();
extern double nextafter (double __x, double __y) throw () __attribute__ ((__const__)); extern double __nextafter (double __x, double __y) throw () __attribute__ ((__const__));
extern double nexttoward (double __x, long double __y) throw () __attribute__ ((__const__)); extern double __nexttoward (double __x, long double __y) throw () __attribute__ ((__const__));
extern double remainder (double __x, double __y) throw (); extern double __remainder (double __x, double __y) throw ();
extern double scalb (double __x, double __n) throw (); extern double __scalb (double __x, double __n) throw ();
extern double scalbn (double __x, int __n) throw (); extern double __scalbn (double __x, int __n) throw ();
extern int ilogb (double __x) throw (); extern int __ilogb (double __x) throw ();
extern double scalbln (double __x, long int __n) throw (); extern double __scalbln (double __x, long int __n) throw ();
extern double nearbyint (double __x) throw (); extern double __nearbyint (double __x) throw ();
extern double round (double __x) throw (); extern double __round (double __x) throw ();
extern double trunc (double __x) throw () __attribute__ ((__const__)); extern double __trunc (double __x) throw () __attribute__ ((__const__));
extern double remquo (double __x, double __y, int *__quo) throw (); extern double __remquo (double __x, double __y, int *__quo) throw ();
extern long int lrint (double __x) throw (); extern long int __lrint (double __x) throw ();
extern long long int llrint (double __x) throw (); extern long long int __llrint (double __x) throw ();
extern long int lround (double __x) throw (); extern long int __lround (double __x) throw ();
extern long long int llround (double __x) throw (); extern long long int __llround (double __x) throw ();
extern double fdim (double __x, double __y) throw (); extern double __fdim (double __x, double __y) throw ();
extern double fmax (double __x, double __y) throw (); extern double __fmax (double __x, double __y) throw ();
extern double fmin (double __x, double __y) throw (); extern double __fmin (double __x, double __y) throw ();
extern int __fpclassify (double __value) throw ()
__attribute__ ((__const__));
extern int __signbit (double __value) throw ()
__attribute__ ((__const__));
extern double fma (double __x, double __y, double __z) throw (); extern double __fma (double __x, double __y, double __z) throw ();
# 64 "/usr/include/math.h" 2 3
# 82 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern float acosf (float __x) throw (); extern float __acosf (float __x) throw ();
extern float asinf (float __x) throw (); extern float __asinf (float __x) throw ();
extern float atanf (float __x) throw (); extern float __atanf (float __x) throw ();
extern float atan2f (float __y, float __x) throw (); extern float __atan2f (float __y, float __x) throw ();
extern float cosf (float __x) throw (); extern float __cosf (float __x) throw ();
extern float sinf (float __x) throw (); extern float __sinf (float __x) throw ();
extern float tanf (float __x) throw (); extern float __tanf (float __x) throw ();
extern void sincosf (float __x, float *__sinx, float *__cosx) throw (); extern void __sincosf (float __x, float *__sinx, float *__cosx) throw ();
extern float coshf (float __x) throw (); extern float __coshf (float __x) throw ();
extern float sinhf (float __x) throw (); extern float __sinhf (float __x) throw ();
extern float tanhf (float __x) throw (); extern float __tanhf (float __x) throw ();
extern float acoshf (float __x) throw (); extern float __acoshf (float __x) throw ();
extern float asinhf (float __x) throw (); extern float __asinhf (float __x) throw ();
extern float atanhf (float __x) throw (); extern float __atanhf (float __x) throw ();
extern float expf (float __x) throw (); extern float __expf (float __x) throw ();
extern float exp10f (float __x) throw (); extern float __exp10f (float __x) throw ();
extern float pow10f (float __x) throw (); extern float __pow10f (float __x) throw ();
extern float frexpf (float __x, int *__exponent) throw (); extern float __frexpf (float __x, int *__exponent) throw ();
extern float ldexpf (float __x, int __exponent) throw (); extern float __ldexpf (float __x, int __exponent) throw ();
extern float logf (float __x) throw (); extern float __logf (float __x) throw ();
extern float log10f (float __x) throw (); extern float __log10f (float __x) throw ();
extern float modff (float __x, float *__iptr) throw (); extern float __modff (float __x, float *__iptr) throw ();
extern float expm1f (float __x) throw (); extern float __expm1f (float __x) throw ();
extern float log1pf (float __x) throw (); extern float __log1pf (float __x) throw ();
extern float logbf (float __x) throw (); extern float __logbf (float __x) throw ();
extern float exp2f (float __x) throw (); extern float __exp2f (float __x) throw ();
extern float log2f (float __x) throw (); extern float __log2f (float __x) throw ();
extern float powf (float __x, float __y) throw (); extern float __powf (float __x, float __y) throw ();
extern float sqrtf (float __x) throw (); extern float __sqrtf (float __x) throw ();
extern float hypotf (float __x, float __y) throw (); extern float __hypotf (float __x, float __y) throw ();
extern float cbrtf (float __x) throw (); extern float __cbrtf (float __x) throw ();
extern float ceilf (float __x) throw (); extern float __ceilf (float __x) throw ();
extern float fabsf (float __x) throw () __attribute__ ((__const__)); extern float __fabsf (float __x) throw () __attribute__ ((__const__));
extern float floorf (float __x) throw (); extern float __floorf (float __x) throw ();
extern float fmodf (float __x, float __y) throw (); extern float __fmodf (float __x, float __y) throw ();
extern int __isinff (float __value) throw () __attribute__ ((__const__));
extern int __finitef (float __value) throw () __attribute__ ((__const__));
extern int isinff (float __value) throw () __attribute__ ((__const__));
extern int finitef (float __value) throw () __attribute__ ((__const__));
extern float dremf (float __x, float __y) throw (); extern float __dremf (float __x, float __y) throw ();
extern float significandf (float __x) throw (); extern float __significandf (float __x) throw ();
extern float copysignf (float __x, float __y) throw () __attribute__ ((__const__)); extern float __copysignf (float __x, float __y) throw () __attribute__ ((__const__));
extern float nanf (__const char *__tagb) throw () __attribute__ ((__const__)); extern float __nanf (__const char *__tagb) throw () __attribute__ ((__const__));
extern int __isnanf (float __value) throw () __attribute__ ((__const__));
extern int isnanf (float __value) throw () __attribute__ ((__const__));
extern float j0f (float) throw (); extern float __j0f (float) throw ();
extern float j1f (float) throw (); extern float __j1f (float) throw ();
extern float jnf (int, float) throw (); extern float __jnf (int, float) throw ();
extern float y0f (float) throw (); extern float __y0f (float) throw ();
extern float y1f (float) throw (); extern float __y1f (float) throw ();
extern float ynf (int, float) throw (); extern float __ynf (int, float) throw ();
extern float erff (float) throw (); extern float __erff (float) throw ();
extern float erfcf (float) throw (); extern float __erfcf (float) throw ();
extern float lgammaf (float) throw (); extern float __lgammaf (float) throw ();
extern float tgammaf (float) throw (); extern float __tgammaf (float) throw ();
extern float gammaf (float) throw (); extern float __gammaf (float) throw ();
extern float lgammaf_r (float, int *__signgamp) throw (); extern float __lgammaf_r (float, int *__signgamp) throw ();
extern float rintf (float __x) throw (); extern float __rintf (float __x) throw ();
extern float nextafterf (float __x, float __y) throw () __attribute__ ((__const__)); extern float __nextafterf (float __x, float __y) throw () __attribute__ ((__const__));
extern float nexttowardf (float __x, long double __y) throw () __attribute__ ((__const__)); extern float __nexttowardf (float __x, long double __y) throw () __attribute__ ((__const__));
extern float remainderf (float __x, float __y) throw (); extern float __remainderf (float __x, float __y) throw ();
extern float scalbf (float __x, float __n) throw (); extern float __scalbf (float __x, float __n) throw ();
extern float scalbnf (float __x, int __n) throw (); extern float __scalbnf (float __x, int __n) throw ();
extern int ilogbf (float __x) throw (); extern int __ilogbf (float __x) throw ();
extern float scalblnf (float __x, long int __n) throw (); extern float __scalblnf (float __x, long int __n) throw ();
extern float nearbyintf (float __x) throw (); extern float __nearbyintf (float __x) throw ();
extern float roundf (float __x) throw (); extern float __roundf (float __x) throw ();
extern float truncf (float __x) throw () __attribute__ ((__const__)); extern float __truncf (float __x) throw () __attribute__ ((__const__));
extern float remquof (float __x, float __y, int *__quo) throw (); extern float __remquof (float __x, float __y, int *__quo) throw ();
extern long int lrintf (float __x) throw (); extern long int __lrintf (float __x) throw ();
extern long long int llrintf (float __x) throw (); extern long long int __llrintf (float __x) throw ();
extern long int lroundf (float __x) throw (); extern long int __lroundf (float __x) throw ();
extern long long int llroundf (float __x) throw (); extern long long int __llroundf (float __x) throw ();
extern float fdimf (float __x, float __y) throw (); extern float __fdimf (float __x, float __y) throw ();
extern float fmaxf (float __x, float __y) throw (); extern float __fmaxf (float __x, float __y) throw ();
extern float fminf (float __x, float __y) throw (); extern float __fminf (float __x, float __y) throw ();
extern int __fpclassifyf (float __value) throw ()
__attribute__ ((__const__));
extern int __signbitf (float __value) throw ()
__attribute__ ((__const__));
extern float fmaf (float __x, float __y, float __z) throw (); extern float __fmaf (float __x, float __y, float __z) throw ();
# 83 "/usr/include/math.h" 2 3
# 99 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern long double acosl (long double __x) throw (); extern long double __acosl (long double __x) throw ();
extern long double asinl (long double __x) throw (); extern long double __asinl (long double __x) throw ();
extern long double atanl (long double __x) throw (); extern long double __atanl (long double __x) throw ();
extern long double atan2l (long double __y, long double __x) throw (); extern long double __atan2l (long double __y, long double __x) throw ();
extern long double cosl (long double __x) throw (); extern long double __cosl (long double __x) throw ();
extern long double sinl (long double __x) throw (); extern long double __sinl (long double __x) throw ();
extern long double tanl (long double __x) throw (); extern long double __tanl (long double __x) throw ();
extern void sincosl (long double __x, long double *__sinx, long double *__cosx) throw (); extern void __sincosl (long double __x, long double *__sinx, long double *__cosx) throw ();
extern long double coshl (long double __x) throw (); extern long double __coshl (long double __x) throw ();
extern long double sinhl (long double __x) throw (); extern long double __sinhl (long double __x) throw ();
extern long double tanhl (long double __x) throw (); extern long double __tanhl (long double __x) throw ();
extern long double acoshl (long double __x) throw (); extern long double __acoshl (long double __x) throw ();
extern long double asinhl (long double __x) throw (); extern long double __asinhl (long double __x) throw ();
extern long double atanhl (long double __x) throw (); extern long double __atanhl (long double __x) throw ();
extern long double expl (long double __x) throw (); extern long double __expl (long double __x) throw ();
extern long double exp10l (long double __x) throw (); extern long double __exp10l (long double __x) throw ();
extern long double pow10l (long double __x) throw (); extern long double __pow10l (long double __x) throw ();
extern long double frexpl (long double __x, int *__exponent) throw (); extern long double __frexpl (long double __x, int *__exponent) throw ();
extern long double ldexpl (long double __x, int __exponent) throw (); extern long double __ldexpl (long double __x, int __exponent) throw ();
extern long double logl (long double __x) throw (); extern long double __logl (long double __x) throw ();
extern long double log10l (long double __x) throw (); extern long double __log10l (long double __x) throw ();
extern long double modfl (long double __x, long double *__iptr) throw (); extern long double __modfl (long double __x, long double *__iptr) throw ();
extern long double expm1l (long double __x) throw (); extern long double __expm1l (long double __x) throw ();
extern long double log1pl (long double __x) throw (); extern long double __log1pl (long double __x) throw ();
extern long double logbl (long double __x) throw (); extern long double __logbl (long double __x) throw ();
extern long double exp2l (long double __x) throw (); extern long double __exp2l (long double __x) throw ();
extern long double log2l (long double __x) throw (); extern long double __log2l (long double __x) throw ();
extern long double powl (long double __x, long double __y) throw (); extern long double __powl (long double __x, long double __y) throw ();
extern long double sqrtl (long double __x) throw (); extern long double __sqrtl (long double __x) throw ();
extern long double hypotl (long double __x, long double __y) throw (); extern long double __hypotl (long double __x, long double __y) throw ();
extern long double cbrtl (long double __x) throw (); extern long double __cbrtl (long double __x) throw ();
extern long double ceill (long double __x) throw (); extern long double __ceill (long double __x) throw ();
extern long double fabsl (long double __x) throw () __attribute__ ((__const__)); extern long double __fabsl (long double __x) throw () __attribute__ ((__const__));
extern long double floorl (long double __x) throw (); extern long double __floorl (long double __x) throw ();
extern long double fmodl (long double __x, long double __y) throw (); extern long double __fmodl (long double __x, long double __y) throw ();
extern int __isinfl (long double __value) throw () __attribute__ ((__const__));
extern int __finitel (long double __value) throw () __attribute__ ((__const__));
extern int isinfl (long double __value) throw () __attribute__ ((__const__));
extern int finitel (long double __value) throw () __attribute__ ((__const__));
extern long double dreml (long double __x, long double __y) throw (); extern long double __dreml (long double __x, long double __y) throw ();
extern long double significandl (long double __x) throw (); extern long double __significandl (long double __x) throw ();
extern long double copysignl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double __copysignl (long double __x, long double __y) throw () __attribute__ ((__const__));
extern long double nanl (__const char *__tagb) throw () __attribute__ ((__const__)); extern long double __nanl (__const char *__tagb) throw () __attribute__ ((__const__));
extern int __isnanl (long double __value) throw () __attribute__ ((__const__));
extern int isnanl (long double __value) throw () __attribute__ ((__const__));
extern long double j0l (long double) throw (); extern long double __j0l (long double) throw ();
extern long double j1l (long double) throw (); extern long double __j1l (long double) throw ();
extern long double jnl (int, long double) throw (); extern long double __jnl (int, long double) throw ();
extern long double y0l (long double) throw (); extern long double __y0l (long double) throw ();
extern long double y1l (long double) throw (); extern long double __y1l (long double) throw ();
extern long double ynl (int, long double) throw (); extern long double __ynl (int, long double) throw ();
extern long double erfl (long double) throw (); extern long double __erfl (long double) throw ();
extern long double erfcl (long double) throw (); extern long double __erfcl (long double) throw ();
extern long double lgammal (long double) throw (); extern long double __lgammal (long double) throw ();
extern long double tgammal (long double) throw (); extern long double __tgammal (long double) throw ();
extern long double gammal (long double) throw (); extern long double __gammal (long double) throw ();
extern long double lgammal_r (long double, int *__signgamp) throw (); extern long double __lgammal_r (long double, int *__signgamp) throw ();
extern long double rintl (long double __x) throw (); extern long double __rintl (long double __x) throw ();
extern long double nextafterl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double __nextafterl (long double __x, long double __y) throw () __attribute__ ((__const__));
extern long double nexttowardl (long double __x, long double __y) throw () __attribute__ ((__const__)); extern long double __nexttowardl (long double __x, long double __y) throw () __attribute__ ((__const__));
extern long double remainderl (long double __x, long double __y) throw (); extern long double __remainderl (long double __x, long double __y) throw ();
extern long double scalbl (long double __x, long double __n) throw (); extern long double __scalbl (long double __x, long double __n) throw ();
extern long double scalbnl (long double __x, int __n) throw (); extern long double __scalbnl (long double __x, int __n) throw ();
extern int ilogbl (long double __x) throw (); extern int __ilogbl (long double __x) throw ();
extern long double scalblnl (long double __x, long int __n) throw (); extern long double __scalblnl (long double __x, long int __n) throw ();
extern long double nearbyintl (long double __x) throw (); extern long double __nearbyintl (long double __x) throw ();
extern long double roundl (long double __x) throw (); extern long double __roundl (long double __x) throw ();
extern long double truncl (long double __x) throw () __attribute__ ((__const__)); extern long double __truncl (long double __x) throw () __attribute__ ((__const__));
extern long double remquol (long double __x, long double __y, int *__quo) throw (); extern long double __remquol (long double __x, long double __y, int *__quo) throw ();
extern long int lrintl (long double __x) throw (); extern long int __lrintl (long double __x) throw ();
extern long long int llrintl (long double __x) throw (); extern long long int __llrintl (long double __x) throw ();
extern long int lroundl (long double __x) throw (); extern long int __lroundl (long double __x) throw ();
extern long long int llroundl (long double __x) throw (); extern long long int __llroundl (long double __x) throw ();
extern long double fdiml (long double __x, long double __y) throw (); extern long double __fdiml (long double __x, long double __y) throw ();
extern long double fmaxl (long double __x, long double __y) throw (); extern long double __fmaxl (long double __x, long double __y) throw ();
extern long double fminl (long double __x, long double __y) throw (); extern long double __fminl (long double __x, long double __y) throw ();
extern int __fpclassifyl (long double __value) throw ()
__attribute__ ((__const__));
extern int __signbitl (long double __value) throw ()
__attribute__ ((__const__));
extern long double fmal (long double __x, long double __y, long double __z) throw (); extern long double __fmal (long double __x, long double __y, long double __z) throw ();
# 100 "/usr/include/math.h" 2 3
# 113 "/usr/include/math.h" 3
extern int signgam;
# 154 "/usr/include/math.h" 3
enum
{
FP_NAN,
FP_INFINITE,
FP_ZERO,
FP_SUBNORMAL,
FP_NORMAL
};
# 240 "/usr/include/math.h" 3
typedef enum
{
_IEEE_ = -1,
_SVID_,
_XOPEN_,
_POSIX_,
_ISOC_
} _LIB_VERSION_TYPE;
extern _LIB_VERSION_TYPE _LIB_VERSION;
# 263 "/usr/include/math.h" 3
struct __exception
{
int type;
char *name;
double arg1;
double arg2;
double retval;
};
extern int matherr (struct __exception *__exc) throw ();
# 350 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathinline.h" 1 3
# 127 "/usr/include/bits/mathinline.h" 3
__inline int
__signbitf (float __x) throw ()
{
__extension__ union { float __f; int __i; } __u = { __f: __x };
return __u.__i < 0;
}
__inline int
__signbit (double __x) throw ()
{
__extension__ union { double __d; int __i[2]; } __u = { __d: __x };
return __u.__i[1] < 0;
}
__inline int
__signbitl (long double __x) throw ()
{
__extension__ union { long double __l; int __i[3]; } __u = { __l: __x };
return (__u.__i[2] & 0x8000) != 0;
}
# 291 "/usr/include/bits/mathinline.h" 3
__inline double __sgn (double) throw (); __inline double __sgn (double __x) throw () { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); } __inline float __sgnf (float) throw (); __inline float __sgnf (float __x) throw () { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); } __inline long double __sgnl (long double) throw (); __inline long double __sgnl (long double __x) throw () { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); }
__inline double __pow2 (double) throw (); __inline double __pow2 (double __x) throw () { register long double __value; register long double __exponent; __extension__ long long int __p = (long long int) __x; if (__x == (long double) __p) { __asm __volatile__ ("fscale" : "=t" (__value) : "0" (1.0), "u" (__x)); return __value; } __asm __volatile__ ("fld %%st(0)\n\t" "frndint # int(x)\n\t" "fxch\n\t" "fsub %%st(1) # fract(x)\n\t" "f2xm1 # 2^(fract(x)) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; } __inline float __pow2f (float) throw (); __inline float __pow2f (float __x) throw () { register long double __value; register long double __exponent; __extension__ long long int __p = (long long int) __x; if (__x == (long double) __p) { __asm __volatile__ ("fscale" : "=t" (__value) : "0" (1.0), "u" (__x)); return __value; } __asm __volatile__ ("fld %%st(0)\!
n\t" "frndint # int(x)\n\t" "fxch\n\t" "fsub %%st(1) # fract(x)\n\t" "f2xm1 # 2^(fract(x)) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; } __inline long double __pow2l (long double) throw (); __inline long double __pow2l (long double __x) throw () { register long double __value; register long double __exponent; __extension__ long long int __p = (long long int) __x; if (__x == (long double) __p) { __asm __volatile__ ("fscale" : "=t" (__value) : "0" (1.0), "u" (__x)); return __value; } __asm __volatile__ ("fld %%st(0)\n\t" "frndint # int(x)\n\t" "fxch\n\t" "fsub %%st(1) # fract(x)\n\t" "f2xm1 # 2^(fract(x)) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; }
# 343 "/usr/include/bits/mathinline.h" 3
__inline void
__sincos (double __x, double *__sinx, double *__cosx) throw ()
{
register long double __cosr; register long double __sinr; __asm __volatile__ ("fsincos\n\t" "fnstsw %%ax\n\t" "testl $0x400, %%eax\n\t" "jz 1f\n\t" "fldpi\n\t" "fadd %%st(0)\n\t" "fxch %%st(1)\n\t" "2: fprem1\n\t" "fnstsw %%ax\n\t" "testl $0x400, %%eax\n\t" "jnz 2b\n\t" "fstp %%st(1)\n\t" "fsincos\n\t" "1:" : "=t" (__cosr), "=u" (__sinr) : "0" (__x)); *__sinx = __sinr; *__cosx = __cosr;
}
__inline void
__sincosf (float __x, float *__sinx, float *__cosx) throw ()
{
register long double __cosr; register long double __sinr; __asm __volatile__ ("fsincos\n\t" "fnstsw %%ax\n\t" "testl $0x400, %%eax\n\t" "jz 1f\n\t" "fldpi\n\t" "fadd %%st(0)\n\t" "fxch %%st(1)\n\t" "2: fprem1\n\t" "fnstsw %%ax\n\t" "testl $0x400, %%eax\n\t" "jnz 2b\n\t" "fstp %%st(1)\n\t" "fsincos\n\t" "1:" : "=t" (__cosr), "=u" (__sinr) : "0" (__x)); *__sinx = __sinr; *__cosx = __cosr;
}
__inline void
__sincosl (long double __x, long double *__sinx, long double *__cosx) throw ()
{
register long double __cosr; register long double __sinr; __asm __volatile__ ("fsincos\n\t" "fnstsw %%ax\n\t" "testl $0x400, %%eax\n\t" "jz 1f\n\t" "fldpi\n\t" "fadd %%st(0)\n\t" "fxch %%st(1)\n\t" "2: fprem1\n\t" "fnstsw %%ax\n\t" "testl $0x400, %%eax\n\t" "jnz 2b\n\t" "fstp %%st(1)\n\t" "fsincos\n\t" "1:" : "=t" (__cosr), "=u" (__sinr) : "0" (__x)); *__sinx = __sinr; *__cosx = __cosr;
}
# 385 "/usr/include/bits/mathinline.h" 3
__inline long double __expm1l (long double __x) throw () { register long double __value; register long double __exponent; register long double __temp; __asm __volatile__ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" "fmul %%st(1) # x * log2(e)\n\t" "fst %%st(1)\n\t" "frndint # int(x * log2(e))\n\t" "fxch\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t" "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __asm __volatile__ ("fscale # 2^int(x * log2(e))\n\t" : "=t" (__temp) : "0" (1.0), "u" (__exponent)); __temp -= 1.0; return __temp + __value ?: __x; }
# 405 "/usr/include/bits/mathinline.h" 3
__inline double exp (double __x) throw () { register long double __value; register long double __exponent; __asm __volatile__ ("fldl2e # e^x = 2^(x * log2(e))\n\t" "fmul %%st(1) # x * log2(e)\n\t" "fst %%st(1)\n\t" "frndint # int(x * log2(e))\n\t" "fxch\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t" "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; } __inline float expf (float __x) throw () { register long double __value; register long double __exponent; __asm __volatile__ ("fldl2e # e^x = 2^(x * log2(e))\n\t" "fmul %%st(1) # x * log2(e)\n\t" "fst %%st(1)\n\t" "frndint # int(x * log2(e))\n\t" "fxch\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t" "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "!
u" (__exponent)); return __value; } __inline long double expl (long double __x) throw () { register long double __value; register long double __exponent; __asm __volatile__ ("fldl2e # e^x = 2^(x * log2(e))\n\t" "fmul %%st(1) # x * log2(e)\n\t" "fst %%st(1)\n\t" "frndint # int(x * log2(e))\n\t" "fxch\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t" "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; }
__inline long double __expl (long double __x) throw () { register long double __value; register long double __exponent; __asm __volatile__ ("fldl2e # e^x = 2^(x * log2(e))\n\t" "fmul %%st(1) # x * log2(e)\n\t" "fst %%st(1)\n\t" "frndint # int(x * log2(e))\n\t" "fxch\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t" "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __value += 1.0; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__value), "u" (__exponent)); return __value; }
__inline double tan (double __x) throw () { register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__ ("fptan" : "=t" (__value2), "=u" (__value) : "0" (__x)); return __value; } __inline float tanf (float __x) throw () { register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__ ("fptan" : "=t" (__value2), "=u" (__value) : "0" (__x)); return __value; } __inline long double tanl (long double __x) throw () { register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__ ("fptan" : "=t" (__value2), "=u" (__value) : "0" (__x)); return __value; }
# 425 "/usr/include/bits/mathinline.h" 3
__inline double atan2 (double __y, double __x) throw () { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; } __inline float atan2f (float __y, float __x) throw () { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; } __inline long double atan2l (long double __y, long double __x) throw () { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; }
__inline long double __atan2l (long double __y, long double __x) throw () { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; }
__inline double fmod (double __x, double __y) throw () { register long double __value; __asm __volatile__ ("1: fprem\n\t" "fnstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; } __inline float fmodf (float __x, float __y) throw () { register long double __value; __asm __volatile__ ("1: fprem\n\t" "fnstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; } __inline long double fmodl (long double __x, long double __y) throw () { register long double __value; __asm __volatile__ ("1: fprem\n\t" "fnstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; }
# 440 "/usr/include/bits/mathinline.h" 3
__inline double sqrt (double __x) throw () { register double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; } __inline float sqrtf (float __x) throw () { register float __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; } __inline long double sqrtl (long double __x) throw () { register long double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; }
__inline long double __sqrtl (long double __x) throw () { register long double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; }
__inline double fabs (double __x) throw () { return __builtin_fabs (__x); }
__inline float fabsf (float __x) throw () { return __builtin_fabsf (__x); }
__inline long double fabsl (long double __x) throw () { return __builtin_fabsl (__x); }
__inline long double __fabsl (long double __x) throw () { return __builtin_fabsl (__x); }
__inline double sin (double __x) throw () { register double __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; } __inline float sinf (float __x) throw () { register float __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; } __inline long double sinl (long double __x) throw () { register long double __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; }
__inline double cos (double __x) throw () { register double __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; } __inline float cosf (float __x) throw () { register float __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; } __inline long double cosl (long double __x) throw () { register long double __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; }
__inline double log (double __x) throw () { register double __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } __inline float logf (float __x) throw () { register float __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } __inline long double logl (long double __x) throw () { register long double __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
__inline double log10 (double __x) throw () { register double __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } __inline float log10f (float __x) throw () { register float __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } __inline long double log10l (long double __x) throw () { register long double __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
__inline double asin (double __x) throw () { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); } __inline float asinf (float __x) throw () { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); } __inline long double asinl (long double __x) throw () { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); }
__inline double acos (double __x) throw () { return __atan2l (__sqrtl (1.0 - __x * __x), __x); } __inline float acosf (float __x) throw () { return __atan2l (__sqrtl (1.0 - __x * __x), __x); } __inline long double acosl (long double __x) throw () { return __atan2l (__sqrtl (1.0 - __x * __x), __x); }
__inline double atan (double __x) throw () { register double __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } __inline float atanf (float __x) throw () { register float __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } __inline long double atanl (long double __x) throw () { register long double __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
__inline long double __sgn1l (long double) throw (); __inline long double __sgn1l (long double __x) throw () { __extension__ union { long double __xld; unsigned int __xi[3]; } __n = { __xld: __x }; __n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; __n.__xi[1] = 0x80000000; __n.__xi[0] = 0; return __n.__xld; }
# 479 "/usr/include/bits/mathinline.h" 3
__inline double sinh (double __x) throw () { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); } __inline float sinhf (float __x) throw () { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); } __inline long double sinhl (long double __x) throw () { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); }
__inline double cosh (double __x) throw () { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); } __inline float coshf (float __x) throw () { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); } __inline long double coshl (long double __x) throw () { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); }
__inline double tanh (double __x) throw () { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); } __inline float tanhf (float __x) throw () { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); } __inline long double tanhl (long double __x) throw () { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); }
__inline double floor (double __x) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } __inline float floorf (float __x) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } __inline long double floorl (long double __x) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("f!
nstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; }
# 503 "/usr/include/bits/mathinline.h" 3
__inline double ceil (double __x) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } __inline float ceilf (float __x) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } __inline long double ceill (long double __x) throw () { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnst!
cw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; }
# 521 "/usr/include/bits/mathinline.h" 3
__inline double
ldexp (double __x, int __y) throw ()
{
register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}
__inline double expm1 (double __x) throw () { register long double __value; register long double __exponent; register long double __temp; __asm __volatile__ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" "fmul %%st(1) # x * log2(e)\n\t" "fst %%st(1)\n\t" "frndint # int(x * log2(e))\n\t" "fxch\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t" "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __asm __volatile__ ("fscale # 2^int(x * log2(e))\n\t" : "=t" (__temp) : "0" (1.0), "u" (__exponent)); __temp -= 1.0; return __temp + __value ?: __x; } __inline float expm1f (float __x) throw () { register long double __value; register long double __exponent; register long double __temp; __asm __volatile__ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" "fmul %%st(1) # x * log2(e)\n\t" "fst %%st(1)\n\t" "frndint # int(x * log2(e))\n\t" "fxch\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t" "f!
2xm1 # 2^(fract(x * log2(e))) - 1\n\t" "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __asm __volatile__ ("fscale # 2^int(x * log2(e))\n\t" : "=t" (__temp) : "0" (1.0), "u" (__exponent)); __temp -= 1.0; return __temp + __value ?: __x; } __inline long double expm1l (long double __x) throw () { register long double __value; register long double __exponent; register long double __temp; __asm __volatile__ ("fldl2e # e^x - 1 = 2^(x * log2(e)) - 1\n\t" "fmul %%st(1) # x * log2(e)\n\t" "fst %%st(1)\n\t" "frndint # int(x * log2(e))\n\t" "fxch\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t" "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" "fscale # 2^(x * log2(e)) - 2^(int(x * log2(e)))\n\t" : "=t" (__value), "=u" (__exponent) : "0" (__x)); __asm __volatile__ ("fscale # 2^int(x * log2(e))\n\t" : "=t" (__temp) : "0" (1.0), "u" (__exponent)); __temp -= 1.0; return __temp + __value ?: __x; }
__inline double log1p (double __x) throw () { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; } __inline float log1pf (float __x) throw () { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; } __inline long double log1pl (long double __x) throw () { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; }
# 553 "/usr/include/bits/mathinline.h" 3
__inline double asinh (double __x) throw () { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); } __inline float asinhf (float __x) throw () { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); } __inline long double asinhl (long double __x) throw () { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); }
__inline double acosh (double __x) throw () { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); } __inline float acoshf (float __x) throw () { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); } __inline long double acoshl (long double __x) throw () { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); }
__inline double atanh (double __x) throw () { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); } __inline float atanhf (float __x) throw () { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); } __inline long double atanhl (long double __x) throw () { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); }
__inline double hypot (double __x, double __y) throw () { return __sqrtl (__x * __x + __y * __y); } __inline float hypotf (float __x, float __y) throw () { return __sqrtl (__x * __x + __y * __y); } __inline long double hypotl (long double __x, long double __y) throw () { return __sqrtl (__x * __x + __y * __y); }
__inline double logb (double __x) throw () { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; } __inline float logbf (float __x) throw () { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; } __inline long double logbl (long double __x) throw () { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; }
# 580 "/usr/include/bits/mathinline.h" 3
__inline double log2 (double __x) throw () { register double __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } __inline float log2f (float __x) throw () { register float __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } __inline long double log2l (long double __x) throw () { register long double __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
__inline float
ldexpf (float __x, int __y) throw ()
{
register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}
__inline long double
ldexpl (long double __x, int __y) throw ()
{
register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}
__inline double fma (double __x, double __y, double __z) throw () { return (__x * __y) + __z; } __inline float fmaf (float __x, float __y, float __z) throw () { return (__x * __y) + __z; } __inline long double fmal (long double __x, long double __y, long double __z) throw () { return (__x * __y) + __z; }
__inline double rint (double __x) throw () { register double __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; } __inline float rintf (float __x) throw () { register float __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; } __inline long double rintl (long double __x) throw () { register long double __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; }
# 607 "/usr/include/bits/mathinline.h" 3
__inline long int
lrintf (float __x) throw ()
{
long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
__inline long int
lrint (double __x) throw ()
{
long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
__inline long int
lrintl (long double __x) throw ()
{
long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
# 630 "/usr/include/bits/mathinline.h" 3
__inline long long int
llrintf (float __x) throw ()
{
long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}
__inline long long int
llrint (double __x) throw ()
{
long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}
__inline long long int
llrintl (long double __x) throw ()
{
long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}
__inline double drem (double __x, double __y) throw () { register double __value; register int __clobbered; __asm __volatile__ ("1: fprem1\n\t" "fstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; } __inline float dremf (float __x, float __y) throw () { register double __value; register int __clobbered; __asm __volatile__ ("1: fprem1\n\t" "fstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; } __inline long double dreml (long double __x, long double __y) throw () { register double __value; register int __clobbered; __asm __volatile__ ("1: fprem1\n\t" "fstsw %%ax\n\t" "sahf\n\t" "jp 1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; }
# 665 "/usr/include/bits/mathinline.h" 3
__inline int
__finite (double __x) throw ()
{
return (__extension__
(((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
| 0x800fffffu) + 1) >> 31));
}
__inline double __coshm1 (double) throw (); __inline double __coshm1 (double __x) throw () { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; } __inline float __coshm1f (float) throw (); __inline float __coshm1f (float __x) throw () { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; } __inline long double __coshm1l (long double) throw (); __inline long double __coshm1l (long double __x) throw () { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; }
__inline double __acosh1p (double) throw (); __inline double __acosh1p (double __x) throw () { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); } __inline float __acosh1pf (float) throw (); __inline float __acosh1pf (float __x) throw () { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); } __inline long double __acosh1pl (long double) throw (); __inline long double __acosh1pl (long double __x) throw () { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); }
# 351 "/usr/include/math.h" 2 3
# 411 "/usr/include/math.h" 3
}
# 25 "resample.cpp" 2
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 1 3
# 37 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
# 1 "/usr/include/features.h" 1 3
# 38 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 2 3
extern "C" {
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 199 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 3
typedef unsigned int size_t;
# 44 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 2 3
# 1 "/usr/include/bits/types.h" 1 3
# 26 "/usr/include/bits/types.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/bits/types.h" 2 3
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 30 "/usr/include/bits/types.h" 2 3
typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;
__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
# 49 "/usr/include/bits/types.h" 3
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;
__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;
typedef __quad_t *__qaddr_t;
typedef __u_quad_t __dev_t;
typedef __u_int __uid_t;
typedef __u_int __gid_t;
typedef __u_long __ino_t;
typedef __u_int __mode_t;
typedef __u_int __nlink_t;
typedef long int __off_t;
typedef __quad_t __loff_t;
typedef int __pid_t;
typedef int __ssize_t;
typedef __u_long __rlim_t;
typedef __u_quad_t __rlim64_t;
typedef __u_int __id_t;
typedef struct
{
int __val[2];
} __fsid_t;
typedef int __daddr_t;
typedef char *__caddr_t;
typedef long int __time_t;
typedef unsigned int __useconds_t;
typedef long int __suseconds_t;
typedef long int __swblk_t;
typedef long int __clock_t;
typedef int __clockid_t;
typedef int __timer_t;
typedef int __key_t;
typedef unsigned short int __ipc_pid_t;
typedef long int __blksize_t;
typedef long int __blkcnt_t;
typedef __quad_t __blkcnt64_t;
typedef __u_long __fsblkcnt_t;
typedef __u_quad_t __fsblkcnt64_t;
typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;
typedef __u_quad_t __ino64_t;
typedef __loff_t __off64_t;
typedef long int __t_scalar_t;
typedef unsigned long int __t_uscalar_t;
typedef int __intptr_t;
typedef unsigned int __socklen_t;
# 1 "/usr/include/bits/pthreadtypes.h" 1 3
# 23 "/usr/include/bits/pthreadtypes.h" 3
# 1 "/usr/include/bits/sched.h" 1 3
# 68 "/usr/include/bits/sched.h" 3
struct __sched_param
{
int __sched_priority;
};
# 24 "/usr/include/bits/pthreadtypes.h" 2 3
struct _pthread_fastlock
{
long int __status;
int __spinlock;
};
typedef struct _pthread_descr_struct *_pthread_descr;
typedef struct __pthread_attr_s
{
int __detachstate;
int __schedpolicy;
struct __sched_param __schedparam;
int __inheritsched;
int __scope;
size_t __guardsize;
int __stackaddr_set;
void *__stackaddr;
size_t __stacksize;
} pthread_attr_t;
typedef struct
{
struct _pthread_fastlock __c_lock;
_pthread_descr __c_waiting;
} pthread_cond_t;
typedef struct
{
int __dummy;
} pthread_condattr_t;
typedef unsigned int pthread_key_t;
typedef struct
{
int __m_reserved;
int __m_count;
_pthread_descr __m_owner;
int __m_kind;
struct _pthread_fastlock __m_lock;
} pthread_mutex_t;
typedef struct
{
int __mutexkind;
} pthread_mutexattr_t;
typedef int pthread_once_t;
typedef struct _pthread_rwlock_t
{
struct _pthread_fastlock __rw_lock;
int __rw_readers;
_pthread_descr __rw_writer;
_pthread_descr __rw_read_waiting;
_pthread_descr __rw_write_waiting;
int __rw_kind;
int __rw_pshared;
} pthread_rwlock_t;
typedef struct
{
int __lockkind;
int __pshared;
} pthread_rwlockattr_t;
typedef volatile int pthread_spinlock_t;
typedef struct {
struct _pthread_fastlock __ba_lock;
int __ba_required;
int __ba_present;
_pthread_descr __ba_waiting;
} pthread_barrier_t;
typedef struct {
int __pshared;
} pthread_barrierattr_t;
typedef unsigned long int pthread_t;
# 144 "/usr/include/bits/types.h" 2 3
# 46 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 2 3
# 54 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
typedef struct _IO_FILE FILE;
# 64 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
typedef struct _IO_FILE __FILE;
# 74 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
# 1 "/usr/include/libio.h" 1 3
# 32 "/usr/include/libio.h" 3
# 1 "/usr/include/_G_config.h" 1 3
# 9 "/usr/include/_G_config.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 10 "/usr/include/_G_config.h" 2 3
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 312 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 3
typedef unsigned int wint_t;
# 15 "/usr/include/_G_config.h" 2 3
# 24 "/usr/include/_G_config.h" 3
# 1 "/usr/include/wchar.h" 1 3
# 48 "/usr/include/wchar.h" 3
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 49 "/usr/include/wchar.h" 2 3
# 1 "/usr/include/bits/wchar.h" 1 3
# 51 "/usr/include/wchar.h" 2 3
# 67 "/usr/include/wchar.h" 3
typedef struct
{
int __count;
union
{
wint_t __wch;
char __wchb[4];
} __value;
} __mbstate_t;
# 25 "/usr/include/_G_config.h" 2 3
typedef struct
{
__off_t __pos;
__mbstate_t __state;
} _G_fpos_t;
typedef struct
{
__off64_t __pos;
__mbstate_t __state;
} _G_fpos64_t;
# 44 "/usr/include/_G_config.h" 3
# 1 "/usr/include/gconv.h" 1 3
# 26 "/usr/include/gconv.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/gconv.h" 2 3
# 1 "/usr/include/wchar.h" 1 3
# 48 "/usr/include/wchar.h" 3
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 49 "/usr/include/wchar.h" 2 3
# 1 "/usr/include/bits/wchar.h" 1 3
# 51 "/usr/include/wchar.h" 2 3
# 29 "/usr/include/gconv.h" 2 3
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 31 "/usr/include/gconv.h" 2 3
enum
{
__GCONV_OK = 0,
__GCONV_NOCONV,
__GCONV_NODB,
__GCONV_NOMEM,
__GCONV_EMPTY_INPUT,
__GCONV_FULL_OUTPUT,
__GCONV_ILLEGAL_INPUT,
__GCONV_INCOMPLETE_INPUT,
__GCONV_ILLEGAL_DESCRIPTOR,
__GCONV_INTERNAL_ERROR
};
enum
{
__GCONV_IS_LAST = 0x0001,
__GCONV_IGNORE_ERRORS = 0x0002
};
struct __gconv_step;
struct __gconv_step_data;
struct __gconv_loaded_object;
struct __gconv_trans_data;
typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
__const unsigned char **, __const unsigned char *,
unsigned char **, size_t *, int, int);
typedef int (*__gconv_init_fct) (struct __gconv_step *);
typedef void (*__gconv_end_fct) (struct __gconv_step *);
typedef int (*__gconv_trans_fct) (struct __gconv_step *,
struct __gconv_step_data *, void *,
__const unsigned char *,
__const unsigned char **,
__const unsigned char *, unsigned char **,
size_t *);
typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *,
__const unsigned char *,
unsigned char *, unsigned char *);
typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***,
size_t *);
typedef int (*__gconv_trans_init_fct) (void **, const char *);
typedef void (*__gconv_trans_end_fct) (void *);
struct __gconv_trans_data
{
__gconv_trans_fct __trans_fct;
__gconv_trans_context_fct __trans_context_fct;
__gconv_trans_end_fct __trans_end_fct;
void *__data;
struct __gconv_trans_data *__next;
};
struct __gconv_step
{
struct __gconv_loaded_object *__shlib_handle;
__const char *__modname;
int __counter;
char *__from_name;
char *__to_name;
__gconv_fct __fct;
__gconv_init_fct __init_fct;
__gconv_end_fct __end_fct;
int __min_needed_from;
int __max_needed_from;
int __min_needed_to;
int __max_needed_to;
int __stateful;
void *__data;
};
struct __gconv_step_data
{
unsigned char *__outbuf;
unsigned char *__outbufend;
int __flags;
int __invocation_counter;
int __internal_use;
__mbstate_t *__statep;
__mbstate_t __state;
struct __gconv_trans_data *__trans;
};
typedef struct __gconv_info
{
size_t __nsteps;
struct __gconv_step *__steps;
__extension__ struct __gconv_step_data __data [];
} *__gconv_t;
# 45 "/usr/include/_G_config.h" 2 3
typedef union
{
struct __gconv_info __cd;
struct
{
struct __gconv_info __cd;
struct __gconv_step_data __data;
} __combined;
} _G_iconv_t;
typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 33 "/usr/include/libio.h" 2 3
# 53 "/usr/include/libio.h" 3
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdarg.h" 1 3
# 43 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdarg.h" 3
typedef __builtin_va_list __gnuc_va_list;
# 54 "/usr/include/libio.h" 2 3
# 160 "/usr/include/libio.h" 3
struct _IO_jump_t; struct _IO_FILE;
# 170 "/usr/include/libio.h" 3
typedef void _IO_lock_t;
struct _IO_marker {
struct _IO_marker *_next;
struct _IO_FILE *_sbuf;
int _pos;
# 193 "/usr/include/libio.h" 3
};
enum __codecvt_result
{
__codecvt_ok,
__codecvt_partial,
__codecvt_error,
__codecvt_noconv
};
# 261 "/usr/include/libio.h" 3
struct _IO_FILE {
int _flags;
char* _IO_read_ptr;
char* _IO_read_end;
char* _IO_read_base;
char* _IO_write_base;
char* _IO_write_ptr;
char* _IO_write_end;
char* _IO_buf_base;
char* _IO_buf_end;
char *_IO_save_base;
char *_IO_backup_base;
char *_IO_save_end;
struct _IO_marker *_markers;
struct _IO_FILE *_chain;
int _fileno;
int _blksize;
__off_t _old_offset;
unsigned short _cur_column;
signed char _vtable_offset;
char _shortbuf[1];
_IO_lock_t *_lock;
# 305 "/usr/include/libio.h" 3
__off64_t _offset;
void *__pad1;
void *__pad2;
int _mode;
char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];
};
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
# 344 "/usr/include/libio.h" 3
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
size_t __n);
typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
typedef int __io_close_fn (void *__cookie);
typedef __io_read_fn cookie_read_function_t;
typedef __io_write_fn cookie_write_function_t;
typedef __io_seek_fn cookie_seek_function_t;
typedef __io_close_fn cookie_close_function_t;
typedef struct
{
__io_read_fn *read;
__io_write_fn *write;
__io_seek_fn *seek;
__io_close_fn *close;
} _IO_cookie_io_functions_t;
typedef _IO_cookie_io_functions_t cookie_io_functions_t;
struct _IO_cookie_file;
extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
void *__cookie, _IO_cookie_io_functions_t __fns);
extern "C" {
extern int __underflow (_IO_FILE *) throw ();
extern int __uflow (_IO_FILE *) throw ();
extern int __overflow (_IO_FILE *, int) throw ();
extern wint_t __wunderflow (_IO_FILE *) throw ();
extern wint_t __wuflow (_IO_FILE *) throw ();
extern wint_t __woverflow (_IO_FILE *, wint_t) throw ();
# 426 "/usr/include/libio.h" 3
extern int _IO_getc (_IO_FILE *__fp) throw ();
extern int _IO_putc (int __c, _IO_FILE *__fp) throw ();
extern int _IO_feof (_IO_FILE *__fp) throw ();
extern int _IO_ferror (_IO_FILE *__fp) throw ();
extern int _IO_peekc_locked (_IO_FILE *__fp) throw ();
extern void _IO_flockfile (_IO_FILE *) throw ();
extern void _IO_funlockfile (_IO_FILE *) throw ();
extern int _IO_ftrylockfile (_IO_FILE *) throw ();
# 456 "/usr/include/libio.h" 3
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
__gnuc_va_list, int *__restrict) throw ();
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
__gnuc_va_list) throw ();
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t) throw ();
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t) throw ();
extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int) throw ();
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int) throw ();
extern void _IO_free_backup_area (_IO_FILE *) throw ();
# 514 "/usr/include/libio.h" 3
}
# 75 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 2 3
typedef __gnuc_va_list __not_va_list__;
# 89 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
typedef _G_fpos_t fpos_t;
typedef _G_fpos64_t fpos64_t;
# 138 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
# 1 "/usr/include/bits/stdio_lim.h" 1 3
# 139 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 2 3
extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;
extern int remove (__const char *__filename) throw ();
extern int rename (__const char *__old, __const char *__new) throw ();
extern FILE *tmpfile (void) throw ();
# 167 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
extern FILE *tmpfile64 (void) throw ();
extern char *tmpnam (char *__s) throw ();
extern char *tmpnam_r (char *__s) throw ();
# 187 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
extern char *tempnam (__const char *__dir, __const char *__pfx)
throw () __attribute__ ((__malloc__));
extern int fclose (FILE *__stream) throw ();
extern int fflush (FILE *__stream) throw ();
extern int fflush_unlocked (FILE *__stream) throw ();
extern int fcloseall (void) throw ();
extern FILE *fopen (__const char *__restrict __filename,
__const char *__restrict __modes) throw ();
extern FILE *freopen (__const char *__restrict __filename,
__const char *__restrict __modes,
FILE *__restrict __stream) throw ();
# 231 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
extern FILE *fopen64 (__const char *__restrict __filename,
__const char *__restrict __modes) throw ();
extern FILE *freopen64 (__const char *__restrict __filename,
__const char *__restrict __modes,
FILE *__restrict __stream) throw ();
extern FILE *fdopen (int __fd, __const char *__modes) throw ();
extern FILE *fopencookie (void *__restrict __magic_cookie,
__const char *__restrict __modes,
_IO_cookie_io_functions_t __io_funcs) throw ();
extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) throw ();
extern FILE *open_memstream (char **__restrict __bufloc,
size_t *__restrict __sizeloc) throw ();
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) throw ();
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
int __modes, size_t __n) throw ();
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
size_t __size) throw ();
extern void setlinebuf (FILE *__stream) throw ();
extern int fprintf (FILE *__restrict __stream,
__const char *__restrict __format, ...) throw ();
extern int printf (__const char *__restrict __format, ...) throw ();
extern int sprintf (char *__restrict __s,
__const char *__restrict __format, ...) throw ();
extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg) throw ();
extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
throw ();
extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg) throw ();
extern int snprintf (char *__restrict __s, size_t __maxlen,
__const char *__restrict __format, ...)
throw () __attribute__ ((__format__ (__printf__, 3, 4)));
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
__const char *__restrict __format, __gnuc_va_list __arg)
throw () __attribute__ ((__format__ (__printf__, 3, 0)));
extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
__gnuc_va_list __arg)
throw () __attribute__ ((__format__ (__printf__, 2, 0)));
extern int __asprintf (char **__restrict __ptr,
__const char *__restrict __fmt, ...)
throw () __attribute__ ((__format__ (__printf__, 2, 3)));
extern int asprintf (char **__restrict __ptr,
__const char *__restrict __fmt, ...)
throw () __attribute__ ((__format__ (__printf__, 2, 3)));
extern int vdprintf (int __fd, __const char *__restrict __fmt,
__gnuc_va_list __arg)
throw () __attribute__ ((__format__ (__printf__, 2, 0)));
extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
throw () __attribute__ ((__format__ (__printf__, 2, 3)));
extern int fscanf (FILE *__restrict __stream,
__const char *__restrict __format, ...) throw ();
extern int scanf (__const char *__restrict __format, ...) throw ();
extern int sscanf (__const char *__restrict __s,
__const char *__restrict __format, ...) throw ();
extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg)
throw () __attribute__ ((__format__ (__scanf__, 2, 0)));
extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
throw () __attribute__ ((__format__ (__scanf__, 1, 0)));
extern int vsscanf (__const char *__restrict __s,
__const char *__restrict __format, __gnuc_va_list __arg)
throw () __attribute__ ((__format__ (__scanf__, 2, 0)));
extern int fgetc (FILE *__stream) throw ();
extern int getc (FILE *__stream) throw ();
extern int getchar (void) throw ();
extern int getc_unlocked (FILE *__stream) throw ();
extern int getchar_unlocked (void) throw ();
extern int fgetc_unlocked (FILE *__stream) throw ();
extern int fputc (int __c, FILE *__stream) throw ();
extern int putc (int __c, FILE *__stream) throw ();
extern int putchar (int __c) throw ();
extern int fputc_unlocked (int __c, FILE *__stream) throw ();
extern int putc_unlocked (int __c, FILE *__stream) throw ();
extern int putchar_unlocked (int __c) throw ();
extern int getw (FILE *__stream) throw ();
extern int putw (int __w, FILE *__stream) throw ();
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
throw ();
extern char *fgets_unlocked (char *__restrict __s, int __n,
FILE *__restrict __stream) throw ();
extern char *gets (char *__s) throw ();
# 435 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
extern __ssize_t __getdelim (char **__restrict __lineptr,
size_t *__restrict __n, int __delimiter,
FILE *__restrict __stream) throw ();
extern __ssize_t getdelim (char **__restrict __lineptr,
size_t *__restrict __n, int __delimiter,
FILE *__restrict __stream) throw ();
extern __ssize_t getline (char **__restrict __lineptr,
size_t *__restrict __n,
FILE *__restrict __stream) throw ();
extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
throw ();
extern int fputs_unlocked (__const char *__restrict __s,
FILE *__restrict __stream) throw ();
extern int puts (__const char *__s) throw ();
extern int ungetc (int __c, FILE *__stream) throw ();
extern size_t fread (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) throw ();
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __s) throw ();
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) throw ();
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) throw ();
extern int fseek (FILE *__stream, long int __off, int __whence) throw ();
extern long int ftell (FILE *__stream) throw ();
extern void rewind (FILE *__stream) throw ();
# 498 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
extern int fseeko (FILE *__stream, __off_t __off, int __whence) throw ();
extern __off_t ftello (FILE *__stream) throw ();
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
throw ();
extern int fsetpos (FILE *__stream, __const fpos_t *__pos) throw ();
# 532 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) throw ();
extern __off64_t ftello64 (FILE *__stream) throw ();
extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos)
throw ();
extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos) throw ();
extern void clearerr (FILE *__stream) throw ();
extern int feof (FILE *__stream) throw ();
extern int ferror (FILE *__stream) throw ();
extern void clearerr_unlocked (FILE *__stream) throw ();
extern int feof_unlocked (FILE *__stream) throw ();
extern int ferror_unlocked (FILE *__stream) throw ();
extern void perror (__const char *__s) throw ();
extern int sys_nerr;
extern __const char *__const sys_errlist[];
extern int _sys_nerr;
extern __const char *__const _sys_errlist[];
extern int fileno (FILE *__stream) throw ();
extern int fileno_unlocked (FILE *__stream) throw ();
extern FILE *popen (__const char *__command, __const char *__modes) throw ();
extern int pclose (FILE *__stream) throw ();
extern char *ctermid (char *__s) throw ();
extern char *cuserid (char *__s) throw ();
struct obstack;
extern int obstack_printf (struct obstack *__restrict __obstack,
__const char *__restrict __format, ...) throw ();
extern int obstack_vprintf (struct obstack *__restrict __obstack,
__const char *__restrict __format,
__gnuc_va_list __args) throw ();
extern void flockfile (FILE *__stream) throw ();
extern int ftrylockfile (FILE *__stream) throw ();
extern void funlockfile (FILE *__stream) throw ();
# 639 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 3
# 1 "/usr/include/bits/stdio.h" 1 3
# 33 "/usr/include/bits/stdio.h" 3
inline int
vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg) throw ()
{
return vfprintf (stdout, __fmt, __arg);
}
inline int
getchar (void) throw ()
{
return _IO_getc (stdin);
}
inline int
getc_unlocked (FILE *__fp) throw ()
{
return ((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
}
inline int
getchar_unlocked (void) throw ()
{
return ((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
}
inline int
putchar (int __c) throw ()
{
return _IO_putc (__c, stdout);
}
inline int
fputc_unlocked (int __c, FILE *__stream) throw ()
{
return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}
inline int
putc_unlocked (int __c, FILE *__stream) throw ()
{
return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}
inline int
putchar_unlocked (int __c) throw ()
{
return (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
}
inline __ssize_t
getline (char **__lineptr, size_t *__n, FILE *__stream) throw ()
{
return __getdelim (__lineptr, __n, '\n', __stream);
}
inline int
feof_unlocked (FILE *__stream) throw ()
{
return (((__stream)->_flags & 0x10) != 0);
}
inline int
ferror_unlocked (FILE *__stream) throw ()
{
return (((__stream)->_flags & 0x20) != 0);
}
# 640 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 2 3
}
# 26 "resample.cpp" 2
# 1 "/usr/include/stdlib.h" 1 3
# 25 "/usr/include/stdlib.h" 3
# 1 "/usr/include/features.h" 1 3
# 26 "/usr/include/stdlib.h" 2 3
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 34 "/usr/include/stdlib.h" 2 3
extern "C" {
# 1 "/usr/include/bits/waitflags.h" 1 3
# 43 "/usr/include/stdlib.h" 2 3
# 1 "/usr/include/bits/waitstatus.h" 1 3
# 63 "/usr/include/bits/waitstatus.h" 3
# 1 "/usr/include/endian.h" 1 3
# 22 "/usr/include/endian.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/endian.h" 2 3
# 37 "/usr/include/endian.h" 3
# 1 "/usr/include/bits/endian.h" 1 3
# 38 "/usr/include/endian.h" 2 3
# 64 "/usr/include/bits/waitstatus.h" 2 3
union wait
{
int w_status;
struct
{
unsigned int __w_termsig:7;
unsigned int __w_coredump:1;
unsigned int __w_retcode:8;
unsigned int:16;
} __wait_terminated;
struct
{
unsigned int __w_stopval:8;
unsigned int __w_stopsig:8;
unsigned int:16;
} __wait_stopped;
};
# 44 "/usr/include/stdlib.h" 2 3
# 94 "/usr/include/stdlib.h" 3
typedef struct
{
int quot;
int rem;
} div_t;
typedef struct
{
long int quot;
long int rem;
} ldiv_t;
__extension__ typedef struct
{
long long int quot;
long long int rem;
} lldiv_t;
# 133 "/usr/include/stdlib.h" 3
extern size_t __ctype_get_mb_cur_max (void) throw ();
extern double atof (__const char *__nptr) throw () __attribute__ ((__pure__));
extern int atoi (__const char *__nptr) throw () __attribute__ ((__pure__));
extern long int atol (__const char *__nptr) throw () __attribute__ ((__pure__));
__extension__ extern long long int atoll (__const char *__nptr)
throw () __attribute__ ((__pure__));
extern double strtod (__const char *__restrict __nptr,
char **__restrict __endptr) throw ();
extern float strtof (__const char *__restrict __nptr,
char **__restrict __endptr) throw ();
extern long double strtold (__const char *__restrict __nptr,
char **__restrict __endptr) throw ();
extern long int strtol (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) throw ();
extern unsigned long int strtoul (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw ();
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) throw ();
__extension__
extern unsigned long long int strtouq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw ();
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) throw ();
__extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
throw ();
# 211 "/usr/include/stdlib.h" 3
# 1 "/usr/include/xlocale.h" 1 3
# 28 "/usr/include/xlocale.h" 3
typedef struct __locale_struct
{
struct locale_data *__locales[13];
const unsigned short int *__ctype_b;
const int *__ctype_tolower;
const int *__ctype_toupper;
} *__locale_t;
# 212 "/usr/include/stdlib.h" 2 3
extern long int __strtol_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc) throw ();
extern unsigned long int __strtoul_l (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc) throw ();
__extension__
extern long long int __strtoll_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc) throw ();
__extension__
extern unsigned long long int __strtoull_l (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
throw ();
extern double __strtod_l (__const char *__restrict __nptr,
char **__restrict __endptr, __locale_t __loc)
throw ();
extern float __strtof_l (__const char *__restrict __nptr,
char **__restrict __endptr, __locale_t __loc) throw ();
extern long double __strtold_l (__const char *__restrict __nptr,
char **__restrict __endptr,
__locale_t __loc) throw ();
extern double __strtod_internal (__const char *__restrict __nptr,
char **__restrict __endptr, int __group)
throw ();
extern float __strtof_internal (__const char *__restrict __nptr,
char **__restrict __endptr, int __group)
throw ();
extern long double __strtold_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __group) throw ();
extern long int __strtol_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) throw ();
extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) throw ();
__extension__
extern long long int __strtoll_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) throw ();
__extension__
extern unsigned long long int __strtoull_internal (__const char *
__restrict __nptr,
char **__restrict __endptr,
int __base, int __group)
throw ();
extern __inline double
strtod (__const char *__restrict __nptr, char **__restrict __endptr) throw ()
{
return __strtod_internal (__nptr, __endptr, 0);
}
extern __inline long int
strtol (__const char *__restrict __nptr, char **__restrict __endptr,
int __base) throw ()
{
return __strtol_internal (__nptr, __endptr, __base, 0);
}
extern __inline unsigned long int
strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
int __base) throw ()
{
return __strtoul_internal (__nptr, __endptr, __base, 0);
}
extern __inline float
strtof (__const char *__restrict __nptr, char **__restrict __endptr) throw ()
{
return __strtof_internal (__nptr, __endptr, 0);
}
extern __inline long double
strtold (__const char *__restrict __nptr, char **__restrict __endptr) throw ()
{
return __strtold_internal (__nptr, __endptr, 0);
}
__extension__ extern __inline long long int
strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
int __base) throw ()
{
return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
int __base) throw ()
{
return __strtoull_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline long long int
strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
int __base) throw ()
{
return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
int __base) throw ()
{
return __strtoull_internal (__nptr, __endptr, __base, 0);
}
extern __inline double
atof (__const char *__nptr) throw ()
{
return strtod (__nptr, (char **) __null);
}
extern __inline int
atoi (__const char *__nptr) throw ()
{
return (int) strtol (__nptr, (char **) __null, 10);
}
extern __inline long int
atol (__const char *__nptr) throw ()
{
return strtol (__nptr, (char **) __null, 10);
}
__extension__ extern __inline long long int
atoll (__const char *__nptr) throw ()
{
return strtoll (__nptr, (char **) __null, 10);
}
# 384 "/usr/include/stdlib.h" 3
extern char *l64a (long int __n) throw ();
extern long int a64l (__const char *__s) throw () __attribute__ ((__pure__));
# 1 "/usr/include/sys/types.h" 1 3
# 26 "/usr/include/sys/types.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/sys/types.h" 2 3
extern "C" {
# 1 "/usr/include/bits/types.h" 1 3
# 31 "/usr/include/sys/types.h" 2 3
typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;
typedef __loff_t loff_t;
typedef __ino_t ino_t;
typedef __ino64_t ino64_t;
typedef __dev_t dev_t;
typedef __gid_t gid_t;
typedef __mode_t mode_t;
typedef __nlink_t nlink_t;
typedef __uid_t uid_t;
typedef __off_t off_t;
typedef __off64_t off64_t;
typedef __pid_t pid_t;
typedef __id_t id_t;
typedef __ssize_t ssize_t;
typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;
typedef __key_t key_t;
# 132 "/usr/include/sys/types.h" 3
# 1 "/usr/include/time.h" 1 3
# 56 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 57 "/usr/include/time.h" 2 3
typedef __clock_t clock_t;
# 1 "/usr/include/bits/types.h" 1 3
# 68 "/usr/include/time.h" 2 3
typedef __time_t time_t;
# 79 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 80 "/usr/include/time.h" 2 3
typedef __clockid_t clockid_t;
# 91 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 92 "/usr/include/time.h" 2 3
typedef __timer_t timer_t;
# 133 "/usr/include/sys/types.h" 2 3
typedef __useconds_t useconds_t;
typedef __suseconds_t suseconds_t;
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 147 "/usr/include/sys/types.h" 2 3
typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 190 "/usr/include/sys/types.h" 3
typedef int int8_t __attribute__ ((__mode__ (__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef int int64_t __attribute__ ((__mode__ (__DI__)));
typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
typedef int register_t __attribute__ ((__mode__ (__word__)));
# 212 "/usr/include/sys/types.h" 3
# 1 "/usr/include/endian.h" 1 3
# 213 "/usr/include/sys/types.h" 2 3
# 1 "/usr/include/sys/select.h" 1 3
# 25 "/usr/include/sys/select.h" 3
# 1 "/usr/include/features.h" 1 3
# 26 "/usr/include/sys/select.h" 2 3
# 1 "/usr/include/bits/types.h" 1 3
# 29 "/usr/include/sys/select.h" 2 3
# 1 "/usr/include/bits/select.h" 1 3
# 32 "/usr/include/sys/select.h" 2 3
# 1 "/usr/include/bits/sigset.h" 1 3
# 23 "/usr/include/bits/sigset.h" 3
typedef int __sig_atomic_t;
typedef struct
{
unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
} __sigset_t;
# 35 "/usr/include/sys/select.h" 2 3
typedef __sigset_t sigset_t;
# 1 "/usr/include/time.h" 1 3
# 106 "/usr/include/time.h" 3
struct timespec
{
long int tv_sec;
long int tv_nsec;
};
# 44 "/usr/include/sys/select.h" 2 3
# 1 "/usr/include/bits/time.h" 1 3
# 63 "/usr/include/bits/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 64 "/usr/include/bits/time.h" 2 3
struct timeval
{
__time_t tv_sec;
__suseconds_t tv_usec;
};
# 46 "/usr/include/sys/select.h" 2 3
typedef long int __fd_mask;
typedef struct
{
__fd_mask fds_bits[1024 / (8 * sizeof (__fd_mask))];
} fd_set;
typedef __fd_mask fd_mask;
# 89 "/usr/include/sys/select.h" 3
extern "C" {
extern int select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout) throw ();
extern int pselect (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
const struct timespec *__restrict __timeout,
const __sigset_t *__restrict __sigmask) throw ();
}
# 216 "/usr/include/sys/types.h" 2 3
# 1 "/usr/include/sys/sysmacros.h" 1 3
# 219 "/usr/include/sys/types.h" 2 3
typedef __blksize_t blksize_t;
typedef __blkcnt_t blkcnt_t;
typedef __fsblkcnt_t fsblkcnt_t;
typedef __fsfilcnt_t fsfilcnt_t;
# 257 "/usr/include/sys/types.h" 3
typedef __blkcnt64_t blkcnt64_t;
typedef __fsblkcnt64_t fsblkcnt64_t;
typedef __fsfilcnt64_t fsfilcnt64_t;
}
# 391 "/usr/include/stdlib.h" 2 3
extern long int random (void) throw ();
extern void srandom (unsigned int __seed) throw ();
extern char *initstate (unsigned int __seed, char *__statebuf,
size_t __statelen) throw ();
extern char *setstate (char *__statebuf) throw ();
struct random_data
{
int32_t *fptr;
int32_t *rptr;
int32_t *state;
int rand_type;
int rand_deg;
int rand_sep;
int32_t *end_ptr;
};
extern int random_r (struct random_data *__restrict __buf,
int32_t *__restrict __result) throw ();
extern int srandom_r (unsigned int __seed, struct random_data *__buf) throw ();
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
size_t __statelen,
struct random_data *__restrict __buf) throw ();
extern int setstate_r (char *__restrict __statebuf,
struct random_data *__restrict __buf) throw ();
extern int rand (void) throw ();
extern void srand (unsigned int __seed) throw ();
extern int rand_r (unsigned int *__seed) throw ();
extern double drand48 (void) throw ();
extern double erand48 (unsigned short int __xsubi[3]) throw ();
extern long int lrand48 (void) throw ();
extern long int nrand48 (unsigned short int __xsubi[3]) throw ();
extern long int mrand48 (void) throw ();
extern long int jrand48 (unsigned short int __xsubi[3]) throw ();
extern void srand48 (long int __seedval) throw ();
extern unsigned short int *seed48 (unsigned short int __seed16v[3]) throw ();
extern void lcong48 (unsigned short int __param[7]) throw ();
struct drand48_data
{
unsigned short int __x[3];
unsigned short int __old_x[3];
unsigned short int __c;
unsigned short int __init;
unsigned long long int __a;
};
extern int drand48_r (struct drand48_data *__restrict __buffer,
double *__restrict __result) throw ();
extern int erand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
double *__restrict __result) throw ();
extern int lrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result) throw ();
extern int nrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result) throw ();
extern int mrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result) throw ();
extern int jrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result) throw ();
extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
throw ();
extern int seed48_r (unsigned short int __seed16v[3],
struct drand48_data *__buffer) throw ();
extern int lcong48_r (unsigned short int __param[7],
struct drand48_data *__buffer) throw ();
# 527 "/usr/include/stdlib.h" 3
extern void *malloc (size_t __size) throw () __attribute__ ((__malloc__));
extern void *calloc (size_t __nmemb, size_t __size)
throw () __attribute__ ((__malloc__));
extern void *realloc (void *__ptr, size_t __size) throw () __attribute__ ((__malloc__));
extern void free (void *__ptr) throw ();
extern void cfree (void *__ptr) throw ();
# 1 "/usr/include/alloca.h" 1 3
# 22 "/usr/include/alloca.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/alloca.h" 2 3
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stddef.h" 1 3
# 26 "/usr/include/alloca.h" 2 3
extern "C" {
extern void *alloca (size_t __size) throw ();
}
# 547 "/usr/include/stdlib.h" 2 3
extern void *valloc (size_t __size) throw () __attribute__ ((__malloc__));
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
throw () __attribute__ ((__malloc__));
extern void abort (void) throw () __attribute__ ((__noreturn__));
extern int atexit (void (*__func) (void)) throw ();
extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
throw ();
extern void exit (int __status) throw () __attribute__ ((__noreturn__));
extern void _Exit (int __status) throw () __attribute__ ((__noreturn__));
extern char *getenv (__const char *__name) throw ();
extern char *__secure_getenv (__const char *__name) throw ();
extern int putenv (char *__string) throw ();
extern int setenv (__const char *__name, __const char *__value, int __replace)
throw ();
extern int unsetenv (__const char *__name) throw ();
extern int clearenv (void) throw ();
# 623 "/usr/include/stdlib.h" 3
extern char *mktemp (char *__template) throw ();
extern int mkstemp (char *__template) throw ();
# 640 "/usr/include/stdlib.h" 3
extern int mkstemp64 (char *__template) throw ();
# 650 "/usr/include/stdlib.h" 3
extern char *mkdtemp (char *__template) throw ();
extern int system (__const char *__command) throw ();
extern char *canonicalize_file_name (__const char *__name) throw ();
# 672 "/usr/include/stdlib.h" 3
extern char *realpath (__const char *__restrict __name,
char *__restrict __resolved) throw ();
typedef int (*__compar_fn_t) (__const void *, __const void *);
typedef __compar_fn_t comparison_fn_t;
extern void *bsearch (__const void *__key, __const void *__base,
size_t __nmemb, size_t __size, __compar_fn_t __compar);
extern void qsort (void *__base, size_t __nmemb, size_t __size,
__compar_fn_t __compar);
extern int abs (int __x) throw () __attribute__ ((__const__));
extern long int labs (long int __x) throw () __attribute__ ((__const__));
__extension__ extern long long int llabs (long long int __x)
throw () __attribute__ ((__const__));
extern div_t div (int __numer, int __denom)
throw () __attribute__ ((__const__));
extern ldiv_t ldiv (long int __numer, long int __denom)
throw () __attribute__ ((__const__));
__extension__ extern lldiv_t lldiv (long long int __numer,
long long int __denom)
throw () __attribute__ ((__const__));
# 728 "/usr/include/stdlib.h" 3
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign) throw ();
extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign) throw ();
extern char *gcvt (double __value, int __ndigit, char *__buf) throw ();
extern char *qecvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign) throw ();
extern char *qfcvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign) throw ();
extern char *qgcvt (long double __value, int __ndigit, char *__buf) throw ();
extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len) throw ();
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len) throw ();
extern int qecvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len) throw ();
extern int qfcvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len) throw ();
extern int mblen (__const char *__s, size_t __n) throw ();
extern int mbtowc (wchar_t *__restrict __pwc,
__const char *__restrict __s, size_t __n) throw ();
extern int wctomb (char *__s, wchar_t __wchar) throw ();
extern size_t mbstowcs (wchar_t *__restrict __pwcs,
__const char *__restrict __s, size_t __n) throw ();
extern size_t wcstombs (char *__restrict __s,
__const wchar_t *__restrict __pwcs, size_t __n)
throw ();
extern int rpmatch (__const char *__response) throw ();
# 808 "/usr/include/stdlib.h" 3
extern int getsubopt (char **__restrict __optionp,
char *__const *__restrict __tokens,
char **__restrict __valuep) throw ();
extern void setkey (__const char *__key) throw ();
extern int posix_openpt (int __oflag) throw ();
extern int grantpt (int __fd) throw ();
extern int unlockpt (int __fd) throw ();
extern char *ptsname (int __fd) throw ();
extern int ptsname_r (int __fd, char *__buf, size_t __buflen) throw ();
extern int getpt (void) throw ();
extern int getloadavg (double __loadavg[], int __nelem) throw ();
}
# 27 "resample.cpp" 2
# 1 "config.h" 1
# 28 "config.h"
# 1 "../config.h" 1
# 29 "config.h" 2
# 99 "config.h"
typedef double FLOAT_T;
# 235 "config.h"
typedef unsigned long uint32;
typedef long int32;
typedef unsigned short uint16;
typedef short int16;
typedef unsigned char uint8;
typedef char int8;
# 320 "config.h"
typedef int16 sample_t;
typedef int32 final_volume_t;
# 29 "resample.cpp" 2
# 1 "common.h" 1
# 24 "common.h"
extern char *program_name, current_filename[];
extern int current_filedescriptor;
# 1 "/usr/lib/gcc-lib/i686-pc-linux-gnu/3.0.1/include/stdio.h" 1 3
# 28 "common.h" 2
extern FILE *msgfp;
typedef struct {
char *path;
void *next;
int level;
} PathList;
extern FILE *open_file(const char *name, int decompress, int noise_mode, int level);
extern void add_to_pathlist(char *s, int level);
extern void clear_pathlist(int level);
extern void close_file(FILE *fp);
extern void skip(FILE *fp, size_t len);
extern void *safe_malloc(size_t count);
# 30 "resample.cpp" 2
# 1 "instrum.h" 1
# 28 "instrum.h"
typedef struct {
uint32
loop_start, loop_end, data_length,
sample_rate, low_freq, high_freq, root_freq;
uint8
root_tune, fine_tune;
uint32
envelope_rate[7], envelope_offset[7],
modulation_rate[7], modulation_offset[7];
FLOAT_T
volume, resonance,
modEnvToFilterFc, modEnvToPitch, modLfoToFilterFc;
sample_t *data;
int32
tremolo_sweep_increment, tremolo_phase_increment,
lfo_sweep_increment, lfo_phase_increment,
vibrato_sweep_increment;
uint32
vibrato_control_ratio,
cutoff_freq;
uint8
reverberation, chorusdepth,
tremolo_depth, vibrato_depth,
modes;
uint8
panning, note_to_use, exclusiveClass;
int16
scale_tuning, keyToModEnvHold, keyToModEnvDecay,
keyToVolEnvHold, keyToVolEnvDecay;
uint8
attenuation, freq_center;
int32
freq_scale, vibrato_delay;
} Sample;
# 78 "instrum.h"
typedef struct {
int type;
int samples;
Sample *sample;
int left_samples;
Sample *left_sample;
int right_samples;
Sample *right_sample;
unsigned char *contents;
} Instrument;
typedef struct _InstrumentLayer {
uint8 lo, hi;
int size;
Instrument *instrument;
struct _InstrumentLayer *next;
} InstrumentLayer;
typedef struct {
const char *name;
InstrumentLayer *layer;
int font_type, sf_ix, last_used, tuning;
int note, amp, pan, strip_loop, strip_envelope, strip_tail;
} ToneBankElement;
# 121 "instrum.h"
typedef struct {
const char *name;
ToneBankElement tone[128];
} ToneBank;
extern char *sf_file;
extern ToneBank *tonebank[], *drumset[];
extern InstrumentLayer *default_instrument;
extern int default_program;
extern int antialiasing_allowed;
extern int fast_decay;
extern int free_instruments_afterwards;
extern int cutoff_allowed;
extern int load_missing_instruments(void);
extern void free_instruments(void);
extern void end_soundfont(void);
extern int set_default_instrument(char *name);
extern int32 convert_tremolo_sweep(uint8 sweep);
extern int32 convert_vibrato_sweep(uint8 sweep, int32 vib_control_ratio);
extern int32 convert_tremolo_rate(uint8 rate);
extern int32 convert_vibrato_rate(uint8 rate);
extern void init_soundfont(char *fname, int oldbank, int newbank, int level);
extern InstrumentLayer *load_sbk_patch(const char *name, int gm_num, int bank, int percussion,
int panning, int amp, int note_to_use, int sf_ix);
extern int current_tune_number;
extern int max_patch_memory;
extern int current_patch_memory;
# 31 "resample.cpp" 2
# 1 "playmidi.h" 1
# 28 "playmidi.h"
typedef struct {
uint32 time;
uint8 channel, type, a, b, polyphony;
} MidiEvent;
# 91 "playmidi.h"
typedef struct {
int
bank, kit, sfx, program, volume, sustain, panning, pitchbend, expression,
variationbank, mono,
portamento,
reverberation, chorusdepth, harmoniccontent, releasetime, attacktime, brightness,
pitchsens;
uint32 modulation_wheel;
FLOAT_T
pitchfactor;
uint8 portamento_time_msb, portamento_time_lsb;
uint8 tuning_msb, tuning_lsb;
int porta_control_ratio, porta_dpb;
int32 last_note_fine;
int32 vibrato_ratio, vibrato_delay;
int vibrato_depth;
char
transpose;
const char *name;
} Channel;
typedef struct {
uint8
status, channel, note, velocity, clone_type;
Sample *sample;
Sample *left_sample;
Sample *right_sample;
int32 clone_voice;
uint32
orig_frequency, frequency,
sample_offset, loop_start, loop_end;
int32
envelope_volume, modulation_volume;
uint32
envelope_target, modulation_target;
uint32
tremolo_sweep, tremolo_sweep_position, tremolo_phase,
lfo_sweep, lfo_sweep_position, lfo_phase,
vibrato_sweep, vibrato_sweep_position, vibrato_depth,
starttime, echo_delay_count;
int32
echo_delay,
sample_increment,
envelope_increment,
modulation_increment,
tremolo_phase_increment,
lfo_phase_increment;
final_volume_t left_mix, right_mix;
FLOAT_T
volume, left_amp, right_amp, tremolo_volume, lfo_volume,
modEnvToFilterFc, modLfoToFilterFc,
current_x0, current_x1, current_y0, current_y1;
int32
vibrato_sample_increment[32];
uint32
envelope_rate[7], envelope_offset[7];
uint32
vibrato_phase, vibrato_control_ratio, vibrato_control_counter,
vibrato_delay, orig_vibrato_control_ratio, modulation_wheel,
envelope_stage, modulation_stage, control_counter,
modulation_delay, modulation_counter, bw_index, panning, panned;
int porta_control_ratio, porta_control_counter, porta_dpb;
int32 porta_pb;
} Voice;
# 218 "playmidi.h"
extern Channel channel[64];
extern signed char drumvolume[64][128];
extern signed char drumpanpot[64][128];
extern signed char drumreverberation[64][128];
extern signed char drumchorusdepth[64][128];
extern Voice voice[128];
extern int32 control_ratio, amp_with_poly, amplification;
extern int32 drumchannels;
extern int adjust_panning_immediately;
extern int voices;
extern int note_key_offset;
extern FLOAT_T midi_time_ratio;
extern int opt_modulation_wheel;
extern int opt_portamento;
extern int opt_nrpn_vibrato;
extern int opt_reverb_control;
extern int opt_chorus_control;
extern int opt_channel_pressure;
extern int opt_overlap_voice_allow;
extern void recompute_freq(int v);
extern int dont_cspline;
extern int opt_dry;
extern int opt_expression_curve;
extern int opt_volume_curve;
extern int opt_stereo_surround;
extern int dont_filter_melodic;
extern int dont_filter_drums;
extern int command_cutoff_allowed;
extern int dont_chorus;
extern int dont_reverb;
extern int current_interpolation;
extern int dont_keep_looping;
extern int GM_System_On;
extern int XG_System_On;
extern int GS_System_On;
extern int XG_System_reverb_type;
extern int XG_System_chorus_type;
extern int XG_System_variation_type;
extern int play_midi(MidiEvent *el, uint32 events, uint32 samples);
extern int play_midi_file(const char *fn);
extern void dumb_pass_playing_list(int number_of_files, const char *list_of_files[]);
extern int read_config_file(const char *name, int prescanning);
extern char *current_config_file;
extern int reverb_options;
extern int global_reverb;
extern int global_chorus;
extern int global_echo;
extern int global_detune;
extern int cfg_select;
extern void clear_config(void);
extern void effect_activate( int iSwitch );
extern int have_commandline_midis;
# 32 "resample.cpp" 2
# 1 "output.h" 1
# 34 "output.h"
typedef struct {
uint32 rate, encoding;
int fd;
int32 extra_param[5];
const char *id_name;
char id_character;
const char *name;
int (*open_output)(void);
void (*close_output)(void);
void (*output_data)(int32 *buf, uint32 count);
int (*driver_output_data)(unsigned char *buf, uint32 count);
void (*flush_output)(void);
void (*purge_output)(void);
int (*output_count)(uint32 ct);
} PlayMode;
extern PlayMode *play_mode_list[], *play_mode;
extern char *cfg_names[];
extern int got_a_configuration;
extern int output_buffer_full;
extern int output_device_open;
extern int b_out_count(void);
extern void b_out(char id, int fd, int *buf, int ocount);
extern int output_clips;
extern void s32tos8(int32 *lp, uint32 c);
extern void s32tou8(int32 *lp, uint32 c);
extern void s32tos16(int32 *lp, uint32 c);
extern void s32tou16(int32 *lp, uint32 c);
extern void s32tos16x(int32 *lp, uint32 c);
extern void s32tou16x(int32 *lp, uint32 c);
extern void s32toulaw(int32 *lp, uint32 c);
# 33 "resample.cpp" 2
# 1 "controls.h" 1
# 127 "controls.h"
typedef struct {
const char *id_name;
char id_character;
int verbosity, trace_playing, opened;
int (*open)(int using_stdin, int using_stdout);
void (*pass_playing_list)(int number_of_files, const char *list_of_files[]);
void (*close)(void);
int (*read)(int32 *valp);
int (*cmsg)(int type, int verbosity_level, const char *fmt, ...);
void (*refresh)(void);
void (*reset)(void);
void (*file_name)(char *name);
void (*total_time)(uint32 tt);
void (*current_time)(uint32 ct);
void (*note)(int v);
void (*master_volume)(int mv);
void (*program)(int channel, int val, const char *name);
void (*volume)(int channel, int val);
void (*expression)(int channel, int val);
void (*panning)(int channel, int val);
void (*sustain)(int channel, int val);
void (*pitch_bend)(int channel, int val);
} ControlMode;
extern int last_rc_command;
extern int last_rc_arg;
extern ControlMode *ctl_list[], *ctl;
extern int check_for_rc(void);
# 34 "resample.cpp" 2
# 1 "tables.h" 1
# 27 "tables.h"
# 1 "/usr/include/math.h" 1 3
# 28 "tables.h" 2
extern uint32 freq_table[];
extern FLOAT_T *vol_table;
extern FLOAT_T def_vol_table[];
extern FLOAT_T gs_vol_table[];
extern FLOAT_T *xg_vol_table;
extern FLOAT_T expr_table[];
extern FLOAT_T bend_fine[];
extern FLOAT_T bend_coarse[];
extern FLOAT_T midi_time_table[], midi_time_table2[];
extern FLOAT_T butterworth[101][5];
extern uint8 *_l2u;
extern uint8 _l2u_[];
# 61 "tables.h"
extern void init_tables(void);
extern struct short_voice_type {
const char *vname;
char flags;
} gm_voice[];
# 35 "resample.cpp" 2
# 1 "resample.h" 1
# 23 "resample.h"
extern sample_t *resample_voice(int v, uint32 *countptr);
extern sample_t *resample_voice_lagrange(int v, uint32 *countptr);
extern sample_t *resample_voice_filter(int v, uint32 *countptr);
extern void pre_resample(Sample *sp);
extern void do_lowpass(Sample *sample, uint32 srate, sample_t *buf, uint32 count, uint32 freq, FLOAT_T resonance);
extern int recompute_modulation(int v);
extern sample_t resample_buffer[(1<<10)+100];
extern uint32 resample_buffer_offset;
extern int update_modulation(int v);
extern int update_modulation_signal(int v);
extern int32 calc_mod_freq(int v, int32 incr);
# 36 "resample.cpp" 2
# 54 "resample.cpp"
sample_t resample_buffer[(1<<10)+100];
uint32 resample_buffer_offset = 0;
static sample_t *vib_resample_voice(int, uint32 *, int);
static sample_t *normal_resample_voice(int, uint32 *, int);
int recompute_modulation(int v)
{
int stage;
stage = voice[v].modulation_stage;
if (stage>5)
{
voice[v].modulation_increment = 0;
return 1;
}
if ((voice[v].sample->modes & (1<<6)) && (voice[v].sample->modes & (1<<5)))
{
if (voice[v].status & ((1<<1) | (1<<2)))
{
if (stage>2)
{
voice[v].modulation_increment=0;
return 0;
}
}
}
voice[v].modulation_stage=stage+1;
if (voice[v].modulation_volume==(int)voice[v].sample->modulation_offset[stage] ||
(stage > 2 && voice[v].modulation_volume < (int)voice[v].sample->modulation_offset[stage]))
return recompute_modulation(v);
voice[v].modulation_target=voice[v].sample->modulation_offset[stage];
voice[v].modulation_increment = voice[v].sample->modulation_rate[stage];
if ((int)voice[v].modulation_target<voice[v].modulation_volume)
voice[v].modulation_increment = -voice[v].modulation_increment;
return 0;
}
int update_modulation(int v)
{
if(voice[v].modulation_delay > 0)
{
voice[v].modulation_delay -= 1;
if(voice[v].modulation_delay > 0)
return 0;
}
voice[v].modulation_volume += voice[v].modulation_increment;
if (voice[v].modulation_volume < 0) voice[v].modulation_volume = 0;
if (((voice[v].modulation_increment < 0) &&
(voice[v].modulation_volume <= (int)voice[v].modulation_target)) ||
((voice[v].modulation_increment > 0) &&
(voice[v].modulation_volume >= (int)voice[v].modulation_target)))
{
voice[v].modulation_volume = voice[v].modulation_target;
if (recompute_modulation(v))
return 1;
}
return 0;
}
int update_modulation_signal(int v)
{
if (voice[v].modulation_increment && update_modulation(v))
return 1;
return 0;
}
int32 calc_mod_freq(int v, int32 incr)
{
FLOAT_T mod_amount;
int32 freq;
if (voice[v].vibrato_control_ratio) return incr;
if ((mod_amount=voice[v].sample->modEnvToPitch)<0.02) return incr;
if (incr < 0) return incr;
freq = voice[v].frequency;
freq = (int32)( (double)freq*(1.0 + (mod_amount - 1.0) * (voice[v].modulation_volume>>22) / 255.0) );
return (int32) ((((double)(voice[v].sample->sample_rate) * (double)(freq)) / ((double)(voice[v].sample->root_freq) * (double)(play_mode->rate))) * (double)(1<<(13)));
}
static sample_t *rs_plain(int v, uint32 *countptr)
{
Voice
*vp=&voice[v];
int32 ofsd, v0, v1, v2, v3, temp, overshoot;
int offset;
uint32 cc_count=vp->modulation_counter;
sample_t
*dest=resample_buffer+resample_buffer_offset,
*src=vp->sample->data;
int32
incr=vp->sample_increment;
uint32
ofs=vp->sample_offset;
uint32
ls=0,
le=vp->sample->data_length;
uint32
se=vp->sample->data_length;
uint32
count=*countptr;
if (!incr) return resample_buffer+resample_buffer_offset;
overshoot = src[(se>>13)-1] / 50;
if (overshoot < 0) overshoot = -overshoot;
while (count--)
{
offset = ofs >> 13;
if (ofs >= se) {
int32 delta = (int32)((ofs - se)>>13) ;
v1 = (int32)src[(int)(se>>13)-1];
v1 -= (delta+1) * v1 / overshoot;
}else v1 = (int32)src[offset];
if (ofs + (1L<<13) >= se) {
v2 = v1;
}else v2 = (int32)src[offset+1];
if(dont_cspline ||
((ofs-(1L<<13))<ls)||((ofs+(2L<<13))>le)){
*dest++ = (sample_t)(v1 + ((int32)((v2-v1) * (int32)(ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}else{
ofsd=ofs;
v0 = (int32)src[offset-1];
v3 = (int32)src[offset+2];
ofs &= (~ (0xFFFFFFFF << 13));
temp=v2;
v2 = (6*v2 +
(((( ( (5*v3 - 11*v2 + 7*v1 - v0)*
(int32)ofs) >>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
ofs = (1L << 13) - ofs;
v1 = (6*v1 +
((((((5*v0 - 11*v1 + 7*temp - v3)*
(int32)ofs)>>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
v1 = (v1 + v2)/(6L<<13);
*dest++ = (sample_t)((v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1));
ofs=ofsd;
}
if (!cc_count--) {
cc_count = control_ratio - 1;
if (!update_modulation_signal(v))
incr = calc_mod_freq(v, incr);
}
ofs += incr;
if (ofs >= se + (overshoot << 13))
{
if (!(vp->status&(1<<0)))
{
vp->status=(1<<0);
ctl->note(v);
}
*countptr-=count+1;
break;
}
}
vp->sample_offset=ofs;
vp->modulation_counter=cc_count;
return resample_buffer+resample_buffer_offset;
}
static sample_t *rs_loop(int v, Voice *vp, uint32 *countptr)
{
int32 ofsd, v0, v1, v2, v3, temp, overshoot;
int offset;
uint32 cc_count=vp->modulation_counter;
int32
incr=vp->sample_increment;
uint32
ofs=vp->sample_offset;
uint32
le=vp->loop_end,
ls=vp->loop_start,
ll=le - vp->loop_start;
sample_t
*dest=resample_buffer+resample_buffer_offset,
*src=vp->sample->data;
uint32
se=vp->sample->data_length,
count = *countptr;
int
flag_exit_loop;
flag_exit_loop =
(vp->status & ((1<<0) | (1<<4))) ||
((vp->status & (1<<3)) && (vp->sample->modes & (1<<7)) ) ||
((vp->status & (1<<3)) && dont_keep_looping ) ;
overshoot = src[(se>>13)-1] / 50;
if (overshoot < 0) overshoot = -overshoot;
while (count--)
{
offset = ofs >> 13;
if (ofs >= se) {
int32 delta = (int32)((ofs - se)>>13) ;
v1 = (int32)src[(int)(se>>13)-1];
v1 -= (delta+1) * v1 / overshoot;
}else v1 = (int32)src[offset];
if (ofs + (1L<<13) >= se) {
v2 = v1;
}else v2 = (int32)src[offset+1];
if(dont_cspline ||
((ofs-(1L<<13))<ls)||((ofs+(2L<<13))>le)){
*dest++ = (sample_t)(v1 + ((int32)((v2-v1) * (int32)(ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}else{
ofsd=ofs;
v0 = (int32)src[offset-1];
v3 = (int32)src[offset+2];
ofs &= (~ (0xFFFFFFFF << 13));
temp=v2;
v2 = (6*v2 +
(((( ( (5*v3 - 11*v2 + 7*v1 - v0)*
(int32)ofs) >>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
ofs = (1L << 13) - ofs;
v1 = (6*v1 +
((((((5*v0 - 11*v1 + 7*temp - v3)*
(int32)ofs)>>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
v1 = (v1 + v2)/(6L<<13);
*dest++ = (sample_t)((v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1));
ofs=ofsd;
}
if (!cc_count--) {
cc_count = control_ratio - 1;
if (!update_modulation_signal(v))
incr = calc_mod_freq(v, incr);
}
ofs += incr;
if (ofs>=le)
{
if (flag_exit_loop)
{
vp->echo_delay -= ll >> 13;
if (vp->echo_delay >= 0) ofs -= ll;
}
else ofs -= ll;
}
if (ofs >= se + (overshoot << 13))
{
if (!(vp->status&(1<<0)))
{
vp->status=(1<<0);
ctl->note(v);
}
*countptr-=count+1;
break;
}
}
vp->sample_offset=ofs;
vp->modulation_counter=cc_count;
return resample_buffer+resample_buffer_offset;
}
static sample_t *rs_bidir(int v, Voice *vp, uint32 count)
{
int32 ofsd, v0, v1, v2, v3, temp, overshoot;
int offset;
int32
incr=vp->sample_increment;
uint32
le=vp->loop_end,
ls=vp->loop_start;
uint32
ofs=vp->sample_offset,
se=vp->sample->data_length;
sample_t
*dest=resample_buffer+resample_buffer_offset,
*src=vp->sample->data;
uint32
i, j;
overshoot = src[(se>>13)-1] / 50;
if (overshoot < 0) overshoot = -overshoot;
if (ofs <= ls)
{
if (incr < 0) i = ls - ofs;
else
i = (ls - ofs) / incr + 1;
if (i > count)
{
i = count;
count = 0;
}
else count -= i;
for(j = 0; j < i; j++)
{
offset = ofs >> 13;
if (ofs >= se) {
int32 delta = (int32)((ofs - se)>>13) ;
v1 = (int32)src[(int)(se>>13)-1];
v1 -= (delta+1) * v1 / overshoot;
}else v1 = (int32)src[offset];
if (ofs + (1L<<13) >= se) {
v2 = v1;
}else v2 = (int32)src[offset+1];
if(dont_cspline ||
((ofs-(1L<<13))<ls)||((ofs+(2L<<13))>le)){
*dest++ = (sample_t)(v1 + ((int32)((v2-v1) * (int32)(ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}else{
ofsd=ofs;
v0 = (int32)src[offset-1];
v3 = (int32)src[offset+2];
ofs &= (~ (0xFFFFFFFF << 13));
temp=v2;
v2 = (6*v2 +
(((( ( (5*v3 - 11*v2 + 7*v1 - v0)*
(int32)ofs) >>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
ofs = (1L << 13) - ofs;
v1 = (6*v1 +
((((((5*v0 - 11*v1 + 7*temp - v3)*
(int32)ofs)>>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
v1 = (v1 + v2)/(6L<<13);
*dest++ = (sample_t)((v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1));
ofs=ofsd;
}
ofs += incr;
}
}
while(count)
{
i = ((incr > 0 ? le : ls) - ofs) / incr + 1;
if (i > count)
{
i = count;
count = 0;
}
else count -= i;
for(j = 0; j < i && ofs < se; j++)
{
offset = ofs >> 13;
if (ofs >= se) {
int32 delta = (int32)((ofs - se)>>13) ;
v1 = (int32)src[(int)(se>>13)-1];
v1 -= (delta+1) * v1 / overshoot;
}else v1 = (int32)src[offset];
if (ofs + (1L<<13) >= se) {
v2 = v1;
}else v2 = (int32)src[offset+1];
if(dont_cspline ||
((ofs-(1L<<13))<ls)||((ofs+(2L<<13))>le)){
*dest++ = (sample_t)(v1 + ((int32)((v2-v1) * (int32)(ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}else{
ofsd=ofs;
v0 = (int32)src[offset-1];
v3 = (int32)src[offset+2];
ofs &= (~ (0xFFFFFFFF << 13));
temp=v2;
v2 = (6*v2 +
(((( ( (5*v3 - 11*v2 + 7*v1 - v0)*
(int32)ofs) >>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
ofs = (1L << 13) - ofs;
v1 = (6*v1 +
((((((5*v0 - 11*v1 + 7*temp - v3)*
(int32)ofs)>>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
v1 = (v1 + v2)/(6L<<13);
*dest++ = (sample_t)((v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1));
ofs=ofsd;
}
ofs += incr;
}
# 491 "resample.cpp"
incr *= -1;
}
vp->sample_increment=incr;
vp->sample_offset=ofs;
return resample_buffer+resample_buffer_offset;
}
static uint32 vib_phase_to_inc_ptr(uint32 phase)
{
if (phase < 32/2)
return 32/2-1-phase;
else if (phase >= 3*32/2)
return 5*32/2-1-phase;
else
return phase-32/2;
}
static int32 update_vibrato(Voice *vp, int sign)
{
uint32 depth, freq=vp->frequency;
FLOAT_T mod_amount=vp->sample->modEnvToPitch;
uint32 phase;
int pb;
double a;
if(vp->vibrato_delay > 0)
{
vp->vibrato_delay -= vp->vibrato_control_ratio;
if(vp->vibrato_delay > 0)
return vp->sample_increment;
}
if (vp->vibrato_phase++ >= 2*32 -1)
vp->vibrato_phase=0;
phase=vib_phase_to_inc_ptr(vp->vibrato_phase);
if (vp->vibrato_sample_increment[phase])
{
if (sign)
return -vp->vibrato_sample_increment[phase];
else
return vp->vibrato_sample_increment[phase];
}
depth = vp->vibrato_depth;
if(depth < vp->modulation_wheel)
depth = vp->modulation_wheel;
depth <<= 7;
if (vp->vibrato_sweep && !vp->modulation_wheel)
{
vp->vibrato_sweep_position += vp->vibrato_sweep;
if (vp->vibrato_sweep_position >= (1<<16))
vp->vibrato_sweep=0;
else
{
depth *= vp->vibrato_sweep_position;
depth >>= 16;
}
}
if (update_modulation_signal(0)) mod_amount = 0;
else
if (mod_amount>0.02)
freq = (int32)( (double)freq*(1.0 + (mod_amount - 1.0) * (vp->modulation_volume>>22) / 255.0) );
pb=(int)(((sin((2*3.14159265358979323846/1024.0) * (vp->vibrato_phase * (1024/(2*32)))))
* (double)(depth) * 1.0L));
a = ((((double)(vp->sample->sample_rate) * (double)(freq)) / ((double)(vp->sample->root_freq) * (double)(play_mode->rate))) * (double)(1<<(13)));
if(pb<0)
{
pb = -pb;
a /= bend_fine[(pb>>5) & 0xFF] * bend_coarse[pb>>13];
}
else
a *= bend_fine[(pb>>5) & 0xFF] * bend_coarse[pb>>13];
a += 0.5;
if (!vp->vibrato_sweep || vp->modulation_wheel)
vp->vibrato_sample_increment[phase]=(int32) a;
if (sign)
a = -a;
return (int32) a;
}
static sample_t *rs_vib_plain(int v, uint32 *countptr)
{
Voice *vp=&voice[v];
int32 ofsd, v0, v1, v2, v3, temp, overshoot;
int offset;
sample_t
*dest=resample_buffer+resample_buffer_offset,
*src=vp->sample->data;
int32
incr=vp->sample_increment;
uint32
ls=0,
le=vp->sample->data_length;
uint32
ofs=vp->sample_offset,
se=vp->sample->data_length,
count=*countptr;
uint32
cc=vp->vibrato_control_counter;
if (incr<0) incr = -incr;
overshoot = src[(se>>13)-1] / 50;
if (overshoot < 0) overshoot = -overshoot;
while (count--)
{
if (!cc--)
{
cc=vp->vibrato_control_ratio;
incr=update_vibrato(vp, 0);
}
offset = ofs >> 13;
if (ofs >= se) {
int32 delta = (int32)((ofs - se)>>13) ;
v1 = (int32)src[(int)(se>>13)-1];
v1 -= (delta+1) * v1 / overshoot;
}else v1 = (int32)src[offset];
if (ofs + (1L<<13) >= se) {
v2 = v1;
}else v2 = (int32)src[offset+1];
if(dont_cspline ||
((ofs-(1L<<13))<ls)||((ofs+(2L<<13))>le)){
*dest++ = (sample_t)(v1 + ((int32)((v2-v1) * (int32)(ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}else{
ofsd=ofs;
v0 = (int32)src[offset-1];
v3 = (int32)src[offset+2];
ofs &= (~ (0xFFFFFFFF << 13));
temp=v2;
v2 = (6*v2 +
(((( ( (5*v3 - 11*v2 + 7*v1 - v0)*
(int32)ofs) >>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
ofs = (1L << 13) - ofs;
v1 = (6*v1 +
((((((5*v0 - 11*v1 + 7*temp - v3)*
(int32)ofs)>>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
v1 = (v1 + v2)/(6L<<13);
*dest++ = (sample_t)((v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1));
ofs=ofsd;
}
ofs += incr;
if (ofs >= se + (overshoot << 13))
{
if (!(vp->status&(1<<0)))
{
vp->status=(1<<0);
ctl->note(v);
}
*countptr-=count+1;
break;
}
}
vp->vibrato_control_counter=cc;
vp->sample_increment=incr;
vp->sample_offset=ofs;
return resample_buffer+resample_buffer_offset;
}
static sample_t *rs_vib_loop(int v, Voice *vp, uint32 *countptr)
{
int32 ofsd, v0, v1, v2, v3, temp, overshoot;
int offset;
int32
incr=vp->sample_increment;
uint32
ls=vp->loop_start,
le=vp->loop_end,
ll=le - vp->loop_start;
sample_t
*dest=resample_buffer+resample_buffer_offset,
*src=vp->sample->data;
uint32
ofs=vp->sample_offset,
se=vp->sample->data_length,
count = *countptr;
uint32
cc=vp->vibrato_control_counter;
int
flag_exit_loop;
flag_exit_loop =
(vp->status & ((1<<0) | (1<<4))) ||
((vp->status & (1<<3)) && (vp->sample->modes & (1<<7)) ) ||
((vp->status & (1<<3)) && dont_keep_looping ) ;
overshoot = src[(se>>13)-1] / 50;
if (overshoot < 0) overshoot = -overshoot;
while (count--)
{
if (!cc--)
{
cc=vp->vibrato_control_ratio;
incr=update_vibrato(vp, 0);
}
offset = ofs >> 13;
if (ofs >= se) {
int32 delta = (int32)((ofs - se)>>13) ;
v1 = (int32)src[(int)(se>>13)-1];
v1 -= (delta+1) * v1 / overshoot;
}else v1 = (int32)src[offset];
if (ofs + (1L<<13) >= se) {
v2 = v1;
}else v2 = (int32)src[offset+1];
if(dont_cspline ||
((ofs-(1L<<13))<ls)||((ofs+(2L<<13))>le)){
*dest++ = (sample_t)(v1 + ((int32)((v2-v1) * (int32)(ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}else{
ofsd=ofs;
v0 = (int32)src[offset-1];
v3 = (int32)src[offset+2];
ofs &= (~ (0xFFFFFFFF << 13));
temp=v2;
v2 = (6*v2 +
(((( ( (5*v3 - 11*v2 + 7*v1 - v0)*
(int32)ofs) >>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
ofs = (1L << 13) - ofs;
v1 = (6*v1 +
((((((5*v0 - 11*v1 + 7*temp - v3)*
(int32)ofs)>>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
v1 = (v1 + v2)/(6L<<13);
*dest++ = (sample_t)((v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1));
ofs=ofsd;
}
ofs += incr;
if (ofs>=le)
{
if (flag_exit_loop)
{
vp->echo_delay -= ll >> 13;
if (vp->echo_delay >= 0) ofs -= ll;
}
else ofs -= ll;
}
if (ofs >= se + (overshoot << 13))
{
if (!(vp->status&(1<<0)))
{
vp->status=(1<<0);
ctl->note(v);
}
*countptr-=count+1;
break;
}
}
vp->vibrato_control_counter=cc;
vp->sample_increment=incr;
vp->sample_offset=ofs;
return resample_buffer+resample_buffer_offset;
}
static sample_t *rs_vib_bidir(int v, Voice *vp, uint32 count)
{
int32 ofsd, v0, v1, v2, v3, temp, overshoot;
int offset;
int32
incr=vp->sample_increment;
uint32
le=vp->loop_end,
ls=vp->loop_start;
uint32
ofs=vp->sample_offset,
se=vp->sample->data_length;
sample_t
*dest=resample_buffer+resample_buffer_offset,
*src=vp->sample->data;
uint32
cc=vp->vibrato_control_counter;
uint32
i, j;
int
vibflag = 0;
overshoot = src[(se>>13)-1] / 50;
if (overshoot < 0) overshoot = -overshoot;
while (count && (ofs <= ls))
{
i = (ls - ofs) / incr + 1;
if (i > count) i = count;
if (i > cc)
{
i = cc;
vibflag = 1;
}
else cc -= i;
count -= i;
for(j = 0; j < i; j++)
{
offset = ofs >> 13;
if (ofs >= se) {
int32 delta = (int32)((ofs - se)>>13) ;
v1 = (int32)src[(int)(se>>13)-1];
v1 -= (delta+1) * v1 / overshoot;
}else v1 = (int32)src[offset];
if (ofs + (1L<<13) >= se) {
v2 = v1;
}else v2 = (int32)src[offset+1];
if(dont_cspline ||
((ofs-(1L<<13))<ls)||((ofs+(2L<<13))>le)){
*dest++ = (sample_t)(v1 + ((int32)((v2-v1) * (int32)(ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}else{
ofsd=ofs;
v0 = (int32)src[offset-1];
v3 = (int32)src[offset+2];
ofs &= (~ (0xFFFFFFFF << 13));
temp=v2;
v2 = (6*v2 +
(((( ( (5*v3 - 11*v2 + 7*v1 - v0)*
(int32)ofs) >>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
ofs = (1L << 13) - ofs;
v1 = (6*v1 +
((((((5*v0 - 11*v1 + 7*temp - v3)*
(int32)ofs)>>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
v1 = (v1 + v2)/(6L<<13);
*dest++ = (sample_t)((v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1));
ofs=ofsd;
}
ofs += incr;
}
if (vibflag)
{
cc = vp->vibrato_control_ratio;
incr = update_vibrato(vp, 0);
vibflag = 0;
}
}
while (count)
{
i = ((incr > 0 ? le : ls) - ofs) / incr + 1;
if(i > count) i = count;
if(i > cc)
{
i = cc;
vibflag = 1;
}
else cc -= i;
count -= i;
while (i-- && ofs < se)
{
offset = ofs >> 13;
if (ofs >= se) {
int32 delta = (int32)((ofs - se)>>13) ;
v1 = (int32)src[(int)(se>>13)-1];
v1 -= (delta+1) * v1 / overshoot;
}else v1 = (int32)src[offset];
if (ofs + (1L<<13) >= se) {
v2 = v1;
}else v2 = (int32)src[offset+1];
if(dont_cspline ||
((ofs-(1L<<13))<ls)||((ofs+(2L<<13))>le)){
*dest++ = (sample_t)(v1 + ((int32)((v2-v1) * (int32)(ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}else{
ofsd=ofs;
v0 = (int32)src[offset-1];
v3 = (int32)src[offset+2];
ofs &= (~ (0xFFFFFFFF << 13));
temp=v2;
v2 = (6*v2 +
(((( ( (5*v3 - 11*v2 + 7*v1 - v0)*
(int32)ofs) >>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
ofs = (1L << 13) - ofs;
v1 = (6*v1 +
((((((5*v0 - 11*v1 + 7*temp - v3)*
(int32)ofs)>>13)*(int32)ofs)>>(13 +2))-1))*(int32)ofs;
v1 = (v1 + v2)/(6L<<13);
*dest++ = (sample_t)((v1 > 32767)? 32767: ((v1 < -32768)? -32768: v1));
ofs=ofsd;
}
ofs += incr;
}
if (vibflag)
{
cc = vp->vibrato_control_ratio;
incr = update_vibrato(vp, (incr < 0));
vibflag = 0;
}
if (ofs >= le)
{
incr *= -1;
}
else if (ofs <= ls)
{
incr *= -1;
}
}
vp->vibrato_control_counter=cc;
vp->sample_increment=incr;
vp->sample_offset=ofs;
return resample_buffer+resample_buffer_offset;
}
static int rs_update_porta(int v)
{
Voice *vp=&voice[v];
int32 d;
d = vp->porta_dpb;
if(vp->porta_pb < 0)
{
if(d > -vp->porta_pb)
d = -vp->porta_pb;
}
else
{
if(d > vp->porta_pb)
d = -vp->porta_pb;
else
d = -d;
}
vp->porta_pb += d;
if(vp->porta_pb == 0)
{
vp->porta_control_ratio = 0;
vp->porta_pb = 0;
}
recompute_freq(v);
return vp->porta_control_ratio;
}
static sample_t *porta_resample_voice(int v, uint32 *countptr, int mode)
{
Voice *vp=&voice[v];
uint32 n = *countptr;
uint32 i;
sample_t *(* resampler)(int, uint32 *, int);
int cc = vp->porta_control_counter;
int loop;
if(vp->vibrato_control_ratio)
resampler = vib_resample_voice;
else
resampler = normal_resample_voice;
if(mode != 1)
loop = 1;
else
loop = 0;
resample_buffer_offset = 0;
while(resample_buffer_offset < n)
{
if(cc == 0)
{
if((cc = rs_update_porta(v)) == 0)
{
i = n - resample_buffer_offset;
resampler(v, &i, mode);
resample_buffer_offset += i;
break;
}
}
i = n - resample_buffer_offset;
if(i > (uint32)cc)
i = (uint32)cc;
resampler(v, &i, mode);
resample_buffer_offset += i;
if(vp->status == (1<<0))
break;
cc -= (int)i;
}
*countptr = resample_buffer_offset;
resample_buffer_offset = 0;
vp->porta_control_counter = cc;
return resample_buffer;
}
static sample_t *vib_resample_voice(int v, uint32 *countptr, int mode)
{
Voice *vp = &voice[v];
if(mode == 0)
return rs_vib_loop(v, vp, countptr);
if(mode == 1)
return rs_vib_plain(v, countptr);
return rs_vib_bidir(v, vp, *countptr);
}
static sample_t *normal_resample_voice(int v, uint32 *countptr, int mode)
{
Voice *vp = &voice[v];
if(mode == 0)
return rs_loop(v, vp, countptr);
if(mode == 1)
return rs_plain(v, countptr);
return rs_bidir(v, vp, *countptr);
}
sample_t *resample_voice(int v, uint32 *countptr)
{
Voice *vp=&voice[v];
int mode;
if(!(vp->sample->sample_rate))
{
uint32 ofs;
ofs=vp->sample_offset >> 13;
if(*countptr >= (vp->sample->data_length>>13) - ofs)
{
if (!(vp->status&(1<<0)))
{
vp->status=(1<<0);
ctl->note(v);
}
*countptr = (vp->sample->data_length>>13) - ofs;
}
else
vp->sample_offset += *countptr << 13;
return vp->sample->data+ofs;
}
if (current_interpolation == 2)
return resample_voice_lagrange(v, countptr);
else if (current_interpolation == 3)
return resample_voice_filter(v, countptr);
mode = vp->sample->modes;
if((mode & (1<<2)) &&
((mode & (1<<6)) ||
(vp->status & ((1<<1) | (1<<2)))))
{
if(mode & (1<<3))
{
mode = 2;
}
else
mode = 0;
}
else
mode = 1;
if(vp->porta_control_ratio)
return porta_resample_voice(v, countptr, mode);
if(vp->vibrato_control_ratio)
return vib_resample_voice(v, countptr, mode);
return normal_resample_voice(v, countptr, mode);
}
void do_lowpass(Sample *sample, uint32 srate, sample_t *buf, uint32 count, uint32 freq, FLOAT_T resonance)
{
double a0=0, a1=0, a2=0, b0=0, b1=0;
double x0=0, x1=0, y0=0, y1=0;
sample_t samp;
double outsamp, insamp, mod_amount=0;
uint32 findex, cc;
uint32 current_freq;
if (freq < 20) return;
if (freq > srate * 2) {
ctl->cmsg(2, 0,
"Lowpass: center must be < data rate*2");
return;
}
current_freq = freq;
if (sample->modEnvToFilterFc)
mod_amount = sample->modEnvToFilterFc;
if (mod_amount < 0.02 && freq >= 13500) return;
voice[0].sample = sample;
voice[0].modulation_stage=0;
voice[0].modulation_volume=0;
voice[0].modulation_delay=sample->modulation_rate[6];
cc = voice[0].modulation_counter=0;
recompute_modulation(0);
while (count--) {
if (!cc) {
if (mod_amount>0.02) {
if (update_modulation_signal(0)) mod_amount = 0;
else
current_freq = (uint32)( (double)freq*(1.0 + (mod_amount - 1.0) *
(voice[0].modulation_volume>>22) / 255.0) );
}
cc = control_ratio;
findex = 1 + (current_freq+50) / 100;
if (findex > 100) findex = 100;
a0 = butterworth[findex][0];
a1 = butterworth[findex][1];
a2 = butterworth[findex][2];
b0 = butterworth[findex][3];
b1 = butterworth[findex][4];
}
if (mod_amount>0.02) cc--;
samp = *buf;
insamp = (double)samp;
outsamp = a0 * insamp + a1 * x0 + a2 * x1 - b0 * y0 - b1 * y1;
x1 = x0;
x0 = insamp;
y1 = y0;
y0 = outsamp;
if (outsamp > 32767) {
outsamp = 32767;
}
else if (outsamp < -32768) {
outsamp = -32768;
}
*buf++ = (sample_t)outsamp;
}
}
void pre_resample(Sample * sp)
{
double a, xdiff;
uint32 i, incr, ofs, newlen, count, overshoot;
int16 *newdata, *dest, *src = (int16 *)sp->data, *vptr, *endptr;
int32 v1, v2, v3, v4;
static const char note_name[12][3] =
{
"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"
};
ctl->cmsg(0, 3, " * pre-resampling for note %d (%s%d)",
sp->note_to_use,
note_name[sp->note_to_use % 12], (sp->note_to_use & 0x7F) / 12);
if (sp->sample_rate == play_mode->rate && sp->root_freq == freq_table[(int)(sp->note_to_use)]) {
a = 1;
}
else a = ((double) (sp->sample_rate) * freq_table[(int) (sp->note_to_use)]) /
((double) (sp->root_freq) * play_mode->rate);
if(sp->data_length / a >= 0x7fffffffL)
{
ctl->cmsg(0, 3, " *** Can't pre-resampling for note %d",
sp->note_to_use);
return;
}
endptr = src + (sp->data_length >> 13) - 1;
if (*endptr < 0) overshoot = (uint32)(-(*endptr / 50));
else overshoot = (uint32)(*endptr / 50);
if (overshoot < 2) overshoot = 0;
newlen = (int32)(sp->data_length / a);
count = (newlen >> 13) - 1;
ofs = incr = (sp->data_length - (1 << 13)) / count;
if((double)newlen + incr >= 0x7fffffffL)
{
ctl->cmsg(0, 3, " *** Can't pre-resampling for note %d",
sp->note_to_use);
return;
}
dest = newdata = (int16 *)safe_malloc((newlen >> (13 - 1)) + 2 + 2*overshoot);
if (--count)
*dest++ = src[0];
count--;
for(i = 0; i < count + overshoot; i++)
{
vptr = src + (ofs >> 13);
if (i < count - 2 || !overshoot)
{
v1 = *(vptr - 1);
v2 = *vptr;
v3 = *(vptr + 1);
v4 = *(vptr + 2);
}
else
{
if (i < count + 1) v1 = *(vptr - 1);
else v1 = *endptr - (count-i+2) * *endptr / overshoot;
if (i < count) v2 = *vptr;
else v2 = *endptr - (count-i+1) * *endptr / overshoot;
if (i < count - 1) v3 = *(vptr + 1);
else v3 = *endptr - (count-i) * *endptr / overshoot;
v4 = *endptr - (count-i-1) * *endptr / overshoot;
}
xdiff = (((int32)(ofs & (~ (0xFFFFFFFF << 13)))) * (1.0L / (double)(1<<(13))));
*dest++ = v2 + (xdiff / 6.0) * (-2 * v1 - 3 * v2 + 6 * v3 - v4 +
xdiff * (3 * (v1 - 2 * v2 + v3) + xdiff * (-v1 + 3 * (v2 - v3) + v4)));
ofs += incr;
}
if (!overshoot)
{
if ((int32)(ofs & (~ (0xFFFFFFFF << 13))))
{
v1 = src[ofs >> 13];
v2 = src[(ofs >> 13) + 1];
*dest++ = (int16)(v1 + ((int32)((v2 - v1) * (ofs & (~ (0xFFFFFFFF << 13)))) >> 13));
}
else
*dest++ = src[ofs >> 13];
*dest++ = *(dest - 1) / 2;
*dest++ = *(dest - 1) / 2;
}
sp->data_length = newlen + (overshoot << 13);
sp->loop_start = (int32)(sp->loop_start / a);
sp->loop_end = (int32)(sp->loop_end / a);
free(sp->data);
sp->data = (sample_t *) newdata;
sp->sample_rate = 0;
}
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: optimization/4126: optimization
@ 2002-01-02 12:27 rodrigc
0 siblings, 0 replies; 2+ messages in thread
From: rodrigc @ 2002-01-02 12:27 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, gerold.jury, nobody
Synopsis: optimization
State-Changed-From-To: open->closed
State-Changed-By: rodrigc
State-Changed-When: Wed Jan 2 12:27:28 2002
State-Changed-Why:
Duplicate of PR 5250.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4126
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-01-02 20:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-25 13:16 optimization/4126: optimization gerold.jury
2002-01-02 12:27 rodrigc
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).