This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/8426: GCC segfault
- From: Linards Ticmanis <ticmanis at coli dot uni-sb dot de>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Fri, 1 Nov 2002 23:37:55 +0100
- Subject: c/8426: GCC segfault
>Number: 8426
>Category: c
>Synopsis: GCC segfault
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Fri Nov 01 14:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Linards Ticmanis
>Release: 3.2
>Organization:
>Environment:
System: Linux d245 2.4.19-4GB #1 Fri Sep 13 13:14:56 UTC 2002 i686 unknown
Architecture: i686
host: i486-suse-linux-gnu
build: i486-suse-linux-gnu
target: i486-suse-linux-gnu
configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i486-suse-linux
>Description:
If Compiled with
gcc -Wall -O4 -march=pentium3 -mcpu=pentium3 -mmmx -msse -mfpmath=sse -malign-double -m128bit-long-double -maccumulate-outgoing-args -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -g -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE -c -o ratecontrol.o ratecontrol.c
The given code produces the following error:
ratecontrol.c: In function `ff_rate_control_init':
ratecontrol.c:159: internal error: Segmentation fault
The cause seems to be the "-m128bit-long-double" option
>How-To-Repeat:
# 1 "ratecontrol.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "ratecontrol.c"
# 20 "ratecontrol.c"
# 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
# 1 "/usr/include/bits/huge_val.h" 1 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) ; extern double __acos (double __x) ;
extern double asin (double __x) ; extern double __asin (double __x) ;
extern double atan (double __x) ; extern double __atan (double __x) ;
extern double atan2 (double __y, double __x) ; extern double __atan2 (double __y, double __x) ;
extern double cos (double __x) ; extern double __cos (double __x) ;
extern double sin (double __x) ; extern double __sin (double __x) ;
extern double tan (double __x) ; extern double __tan (double __x) ;
extern void sincos (double __x, double *__sinx, double *__cosx) ; extern void __sincos (double __x, double *__sinx, double *__cosx) ;
extern double cosh (double __x) ; extern double __cosh (double __x) ;
extern double sinh (double __x) ; extern double __sinh (double __x) ;
extern double tanh (double __x) ; extern double __tanh (double __x) ;
extern double acosh (double __x) ; extern double __acosh (double __x) ;
extern double asinh (double __x) ; extern double __asinh (double __x) ;
extern double atanh (double __x) ; extern double __atanh (double __x) ;
extern double exp (double __x) ; extern double __exp (double __x) ;
extern double exp10 (double __x) ; extern double __exp10 (double __x) ;
extern double pow10 (double __x) ; extern double __pow10 (double __x) ;
extern double frexp (double __x, int *__exponent) ; extern double __frexp (double __x, int *__exponent) ;
extern double ldexp (double __x, int __exponent) ; extern double __ldexp (double __x, int __exponent) ;
extern double log (double __x) ; extern double __log (double __x) ;
extern double log10 (double __x) ; extern double __log10 (double __x) ;
extern double modf (double __x, double *__iptr) ; extern double __modf (double __x, double *__iptr) ;
extern double expm1 (double __x) ; extern double __expm1 (double __x) ;
extern double log1p (double __x) ; extern double __log1p (double __x) ;
extern double logb (double __x) ; extern double __logb (double __x) ;
extern double exp2 (double __x) ; extern double __exp2 (double __x) ;
extern double log2 (double __x) ; extern double __log2 (double __x) ;
extern double pow (double __x, double __y) ; extern double __pow (double __x, double __y) ;
extern double sqrt (double __x) ; extern double __sqrt (double __x) ;
extern double hypot (double __x, double __y) ; extern double __hypot (double __x, double __y) ;
extern double cbrt (double __x) ; extern double __cbrt (double __x) ;
extern double ceil (double __x) ; extern double __ceil (double __x) ;
extern double fabs (double __x) __attribute__ ((__const__)); extern double __fabs (double __x) __attribute__ ((__const__));
extern double floor (double __x) ; extern double __floor (double __x) ;
extern double fmod (double __x, double __y) ; extern double __fmod (double __x, double __y) ;
extern int __isinf (double __value) __attribute__ ((__const__));
extern int __finite (double __value) __attribute__ ((__const__));
extern int isinf (double __value) __attribute__ ((__const__));
extern int finite (double __value) __attribute__ ((__const__));
extern double drem (double __x, double __y) ; extern double __drem (double __x, double __y) ;
extern double significand (double __x) ; extern double __significand (double __x) ;
extern double copysign (double __x, double __y) __attribute__ ((__const__)); extern double __copysign (double __x, double __y) __attribute__ ((__const__));
extern double nan (__const char *__tagb) __attribute__ ((__const__)); extern double __nan (__const char *__tagb) __attribute__ ((__const__));
extern int __isnan (double __value) __attribute__ ((__const__));
extern int isnan (double __value) __attribute__ ((__const__));
extern double j0 (double) ; extern double __j0 (double) ;
extern double j1 (double) ; extern double __j1 (double) ;
extern double jn (int, double) ; extern double __jn (int, double) ;
extern double y0 (double) ; extern double __y0 (double) ;
extern double y1 (double) ; extern double __y1 (double) ;
extern double yn (int, double) ; extern double __yn (int, double) ;
extern double erf (double) ; extern double __erf (double) ;
extern double erfc (double) ; extern double __erfc (double) ;
extern double lgamma (double) ; extern double __lgamma (double) ;
extern double tgamma (double) ; extern double __tgamma (double) ;
extern double gamma (double) ; extern double __gamma (double) ;
extern double lgamma_r (double, int *__signgamp) ; extern double __lgamma_r (double, int *__signgamp) ;
extern double rint (double __x) ; extern double __rint (double __x) ;
extern double nextafter (double __x, double __y) __attribute__ ((__const__)); extern double __nextafter (double __x, double __y) __attribute__ ((__const__));
extern double nexttoward (double __x, long double __y) __attribute__ ((__const__)); extern double __nexttoward (double __x, long double __y) __attribute__ ((__const__));
extern double remainder (double __x, double __y) ; extern double __remainder (double __x, double __y) ;
extern double scalb (double __x, double __n) ; extern double __scalb (double __x, double __n) ;
extern double scalbn (double __x, int __n) ; extern double __scalbn (double __x, int __n) ;
extern int ilogb (double __x) ; extern int __ilogb (double __x) ;
extern double scalbln (double __x, long int __n) ; extern double __scalbln (double __x, long int __n) ;
extern double nearbyint (double __x) ; extern double __nearbyint (double __x) ;
extern double round (double __x) ; extern double __round (double __x) ;
extern double trunc (double __x) __attribute__ ((__const__)); extern double __trunc (double __x) __attribute__ ((__const__));
extern double remquo (double __x, double __y, int *__quo) ; extern double __remquo (double __x, double __y, int *__quo) ;
extern long int lrint (double __x) ; extern long int __lrint (double __x) ;
extern long long int llrint (double __x) ; extern long long int __llrint (double __x) ;
extern long int lround (double __x) ; extern long int __lround (double __x) ;
extern long long int llround (double __x) ; extern long long int __llround (double __x) ;
extern double fdim (double __x, double __y) ; extern double __fdim (double __x, double __y) ;
extern double fmax (double __x, double __y) ; extern double __fmax (double __x, double __y) ;
extern double fmin (double __x, double __y) ; extern double __fmin (double __x, double __y) ;
extern int __fpclassify (double __value)
__attribute__ ((__const__));
extern int __signbit (double __value)
__attribute__ ((__const__));
extern double fma (double __x, double __y, double __z) ; extern double __fma (double __x, double __y, double __z) ;
# 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) ; extern float __acosf (float __x) ;
extern float asinf (float __x) ; extern float __asinf (float __x) ;
extern float atanf (float __x) ; extern float __atanf (float __x) ;
extern float atan2f (float __y, float __x) ; extern float __atan2f (float __y, float __x) ;
extern float cosf (float __x) ; extern float __cosf (float __x) ;
extern float sinf (float __x) ; extern float __sinf (float __x) ;
extern float tanf (float __x) ; extern float __tanf (float __x) ;
extern void sincosf (float __x, float *__sinx, float *__cosx) ; extern void __sincosf (float __x, float *__sinx, float *__cosx) ;
extern float coshf (float __x) ; extern float __coshf (float __x) ;
extern float sinhf (float __x) ; extern float __sinhf (float __x) ;
extern float tanhf (float __x) ; extern float __tanhf (float __x) ;
extern float acoshf (float __x) ; extern float __acoshf (float __x) ;
extern float asinhf (float __x) ; extern float __asinhf (float __x) ;
extern float atanhf (float __x) ; extern float __atanhf (float __x) ;
extern float expf (float __x) ; extern float __expf (float __x) ;
extern float exp10f (float __x) ; extern float __exp10f (float __x) ;
extern float pow10f (float __x) ; extern float __pow10f (float __x) ;
extern float frexpf (float __x, int *__exponent) ; extern float __frexpf (float __x, int *__exponent) ;
extern float ldexpf (float __x, int __exponent) ; extern float __ldexpf (float __x, int __exponent) ;
extern float logf (float __x) ; extern float __logf (float __x) ;
extern float log10f (float __x) ; extern float __log10f (float __x) ;
extern float modff (float __x, float *__iptr) ; extern float __modff (float __x, float *__iptr) ;
extern float expm1f (float __x) ; extern float __expm1f (float __x) ;
extern float log1pf (float __x) ; extern float __log1pf (float __x) ;
extern float logbf (float __x) ; extern float __logbf (float __x) ;
extern float exp2f (float __x) ; extern float __exp2f (float __x) ;
extern float log2f (float __x) ; extern float __log2f (float __x) ;
extern float powf (float __x, float __y) ; extern float __powf (float __x, float __y) ;
extern float sqrtf (float __x) ; extern float __sqrtf (float __x) ;
extern float hypotf (float __x, float __y) ; extern float __hypotf (float __x, float __y) ;
extern float cbrtf (float __x) ; extern float __cbrtf (float __x) ;
extern float ceilf (float __x) ; extern float __ceilf (float __x) ;
extern float fabsf (float __x) __attribute__ ((__const__)); extern float __fabsf (float __x) __attribute__ ((__const__));
extern float floorf (float __x) ; extern float __floorf (float __x) ;
extern float fmodf (float __x, float __y) ; extern float __fmodf (float __x, float __y) ;
extern int __isinff (float __value) __attribute__ ((__const__));
extern int __finitef (float __value) __attribute__ ((__const__));
extern int isinff (float __value) __attribute__ ((__const__));
extern int finitef (float __value) __attribute__ ((__const__));
extern float dremf (float __x, float __y) ; extern float __dremf (float __x, float __y) ;
extern float significandf (float __x) ; extern float __significandf (float __x) ;
extern float copysignf (float __x, float __y) __attribute__ ((__const__)); extern float __copysignf (float __x, float __y) __attribute__ ((__const__));
extern float nanf (__const char *__tagb) __attribute__ ((__const__)); extern float __nanf (__const char *__tagb) __attribute__ ((__const__));
extern int __isnanf (float __value) __attribute__ ((__const__));
extern int isnanf (float __value) __attribute__ ((__const__));
extern float j0f (float) ; extern float __j0f (float) ;
extern float j1f (float) ; extern float __j1f (float) ;
extern float jnf (int, float) ; extern float __jnf (int, float) ;
extern float y0f (float) ; extern float __y0f (float) ;
extern float y1f (float) ; extern float __y1f (float) ;
extern float ynf (int, float) ; extern float __ynf (int, float) ;
extern float erff (float) ; extern float __erff (float) ;
extern float erfcf (float) ; extern float __erfcf (float) ;
extern float lgammaf (float) ; extern float __lgammaf (float) ;
extern float tgammaf (float) ; extern float __tgammaf (float) ;
extern float gammaf (float) ; extern float __gammaf (float) ;
extern float lgammaf_r (float, int *__signgamp) ; extern float __lgammaf_r (float, int *__signgamp) ;
extern float rintf (float __x) ; extern float __rintf (float __x) ;
extern float nextafterf (float __x, float __y) __attribute__ ((__const__)); extern float __nextafterf (float __x, float __y) __attribute__ ((__const__));
extern float nexttowardf (float __x, long double __y) __attribute__ ((__const__)); extern float __nexttowardf (float __x, long double __y) __attribute__ ((__const__));
extern float remainderf (float __x, float __y) ; extern float __remainderf (float __x, float __y) ;
extern float scalbf (float __x, float __n) ; extern float __scalbf (float __x, float __n) ;
extern float scalbnf (float __x, int __n) ; extern float __scalbnf (float __x, int __n) ;
extern int ilogbf (float __x) ; extern int __ilogbf (float __x) ;
extern float scalblnf (float __x, long int __n) ; extern float __scalblnf (float __x, long int __n) ;
extern float nearbyintf (float __x) ; extern float __nearbyintf (float __x) ;
extern float roundf (float __x) ; extern float __roundf (float __x) ;
extern float truncf (float __x) __attribute__ ((__const__)); extern float __truncf (float __x) __attribute__ ((__const__));
extern float remquof (float __x, float __y, int *__quo) ; extern float __remquof (float __x, float __y, int *__quo) ;
extern long int lrintf (float __x) ; extern long int __lrintf (float __x) ;
extern long long int llrintf (float __x) ; extern long long int __llrintf (float __x) ;
extern long int lroundf (float __x) ; extern long int __lroundf (float __x) ;
extern long long int llroundf (float __x) ; extern long long int __llroundf (float __x) ;
extern float fdimf (float __x, float __y) ; extern float __fdimf (float __x, float __y) ;
extern float fmaxf (float __x, float __y) ; extern float __fmaxf (float __x, float __y) ;
extern float fminf (float __x, float __y) ; extern float __fminf (float __x, float __y) ;
extern int __fpclassifyf (float __value)
__attribute__ ((__const__));
extern int __signbitf (float __value)
__attribute__ ((__const__));
extern float fmaf (float __x, float __y, float __z) ; extern float __fmaf (float __x, float __y, float __z) ;
# 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) ; extern long double __acosl (long double __x) ;
extern long double asinl (long double __x) ; extern long double __asinl (long double __x) ;
extern long double atanl (long double __x) ; extern long double __atanl (long double __x) ;
extern long double atan2l (long double __y, long double __x) ; extern long double __atan2l (long double __y, long double __x) ;
extern long double cosl (long double __x) ; extern long double __cosl (long double __x) ;
extern long double sinl (long double __x) ; extern long double __sinl (long double __x) ;
extern long double tanl (long double __x) ; extern long double __tanl (long double __x) ;
extern void sincosl (long double __x, long double *__sinx, long double *__cosx) ; extern void __sincosl (long double __x, long double *__sinx, long double *__cosx) ;
extern long double coshl (long double __x) ; extern long double __coshl (long double __x) ;
extern long double sinhl (long double __x) ; extern long double __sinhl (long double __x) ;
extern long double tanhl (long double __x) ; extern long double __tanhl (long double __x) ;
extern long double acoshl (long double __x) ; extern long double __acoshl (long double __x) ;
extern long double asinhl (long double __x) ; extern long double __asinhl (long double __x) ;
extern long double atanhl (long double __x) ; extern long double __atanhl (long double __x) ;
extern long double expl (long double __x) ; extern long double __expl (long double __x) ;
extern long double exp10l (long double __x) ; extern long double __exp10l (long double __x) ;
extern long double pow10l (long double __x) ; extern long double __pow10l (long double __x) ;
extern long double frexpl (long double __x, int *__exponent) ; extern long double __frexpl (long double __x, int *__exponent) ;
extern long double ldexpl (long double __x, int __exponent) ; extern long double __ldexpl (long double __x, int __exponent) ;
extern long double logl (long double __x) ; extern long double __logl (long double __x) ;
extern long double log10l (long double __x) ; extern long double __log10l (long double __x) ;
extern long double modfl (long double __x, long double *__iptr) ; extern long double __modfl (long double __x, long double *__iptr) ;
extern long double expm1l (long double __x) ; extern long double __expm1l (long double __x) ;
extern long double log1pl (long double __x) ; extern long double __log1pl (long double __x) ;
extern long double logbl (long double __x) ; extern long double __logbl (long double __x) ;
extern long double exp2l (long double __x) ; extern long double __exp2l (long double __x) ;
extern long double log2l (long double __x) ; extern long double __log2l (long double __x) ;
extern long double powl (long double __x, long double __y) ; extern long double __powl (long double __x, long double __y) ;
extern long double sqrtl (long double __x) ; extern long double __sqrtl (long double __x) ;
extern long double hypotl (long double __x, long double __y) ; extern long double __hypotl (long double __x, long double __y) ;
extern long double cbrtl (long double __x) ; extern long double __cbrtl (long double __x) ;
extern long double ceill (long double __x) ; extern long double __ceill (long double __x) ;
extern long double fabsl (long double __x) __attribute__ ((__const__)); extern long double __fabsl (long double __x) __attribute__ ((__const__));
extern long double floorl (long double __x) ; extern long double __floorl (long double __x) ;
extern long double fmodl (long double __x, long double __y) ; extern long double __fmodl (long double __x, long double __y) ;
extern int __isinfl (long double __value) __attribute__ ((__const__));
extern int __finitel (long double __value) __attribute__ ((__const__));
extern int isinfl (long double __value) __attribute__ ((__const__));
extern int finitel (long double __value) __attribute__ ((__const__));
extern long double dreml (long double __x, long double __y) ; extern long double __dreml (long double __x, long double __y) ;
extern long double significandl (long double __x) ; extern long double __significandl (long double __x) ;
extern long double copysignl (long double __x, long double __y) __attribute__ ((__const__)); extern long double __copysignl (long double __x, long double __y) __attribute__ ((__const__));
extern long double nanl (__const char *__tagb) __attribute__ ((__const__)); extern long double __nanl (__const char *__tagb) __attribute__ ((__const__));
extern int __isnanl (long double __value) __attribute__ ((__const__));
extern int isnanl (long double __value) __attribute__ ((__const__));
extern long double j0l (long double) ; extern long double __j0l (long double) ;
extern long double j1l (long double) ; extern long double __j1l (long double) ;
extern long double jnl (int, long double) ; extern long double __jnl (int, long double) ;
extern long double y0l (long double) ; extern long double __y0l (long double) ;
extern long double y1l (long double) ; extern long double __y1l (long double) ;
extern long double ynl (int, long double) ; extern long double __ynl (int, long double) ;
extern long double erfl (long double) ; extern long double __erfl (long double) ;
extern long double erfcl (long double) ; extern long double __erfcl (long double) ;
extern long double lgammal (long double) ; extern long double __lgammal (long double) ;
extern long double tgammal (long double) ; extern long double __tgammal (long double) ;
extern long double gammal (long double) ; extern long double __gammal (long double) ;
extern long double lgammal_r (long double, int *__signgamp) ; extern long double __lgammal_r (long double, int *__signgamp) ;
extern long double rintl (long double __x) ; extern long double __rintl (long double __x) ;
extern long double nextafterl (long double __x, long double __y) __attribute__ ((__const__)); extern long double __nextafterl (long double __x, long double __y) __attribute__ ((__const__));
extern long double nexttowardl (long double __x, long double __y) __attribute__ ((__const__)); extern long double __nexttowardl (long double __x, long double __y) __attribute__ ((__const__));
extern long double remainderl (long double __x, long double __y) ; extern long double __remainderl (long double __x, long double __y) ;
extern long double scalbl (long double __x, long double __n) ; extern long double __scalbl (long double __x, long double __n) ;
extern long double scalbnl (long double __x, int __n) ; extern long double __scalbnl (long double __x, int __n) ;
extern int ilogbl (long double __x) ; extern int __ilogbl (long double __x) ;
extern long double scalblnl (long double __x, long int __n) ; extern long double __scalblnl (long double __x, long int __n) ;
extern long double nearbyintl (long double __x) ; extern long double __nearbyintl (long double __x) ;
extern long double roundl (long double __x) ; extern long double __roundl (long double __x) ;
extern long double truncl (long double __x) __attribute__ ((__const__)); extern long double __truncl (long double __x) __attribute__ ((__const__));
extern long double remquol (long double __x, long double __y, int *__quo) ; extern long double __remquol (long double __x, long double __y, int *__quo) ;
extern long int lrintl (long double __x) ; extern long int __lrintl (long double __x) ;
extern long long int llrintl (long double __x) ; extern long long int __llrintl (long double __x) ;
extern long int lroundl (long double __x) ; extern long int __lroundl (long double __x) ;
extern long long int llroundl (long double __x) ; extern long long int __llroundl (long double __x) ;
extern long double fdiml (long double __x, long double __y) ; extern long double __fdiml (long double __x, long double __y) ;
extern long double fmaxl (long double __x, long double __y) ; extern long double __fmaxl (long double __x, long double __y) ;
extern long double fminl (long double __x, long double __y) ; extern long double __fminl (long double __x, long double __y) ;
extern int __fpclassifyl (long double __value)
__attribute__ ((__const__));
extern int __signbitl (long double __value)
__attribute__ ((__const__));
extern long double fmal (long double __x, long double __y, long double __z) ; extern long double __fmal (long double __x, long double __y, long double __z) ;
# 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;
# 265 "/usr/include/math.h" 3
struct exception
{
int type;
char *name;
double arg1;
double arg2;
double retval;
};
extern int matherr (struct exception *__exc);
# 350 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathinline.h" 1 3
# 127 "/usr/include/bits/mathinline.h" 3
extern __inline int
__signbitf (float __x)
{
__extension__ union { float __f; int __i; } __u = { __f: __x };
return __u.__i < 0;
}
extern __inline int
__signbit (double __x)
{
__extension__ union { double __d; int __i[2]; } __u = { __d: __x };
return __u.__i[1] < 0;
}
extern __inline int
__signbitl (long double __x)
{
__extension__ union { long double __l; int __i[3]; } __u = { __l: __x };
return (__u.__i[2] & 0x8000) != 0;
}
# 291 "/usr/include/bits/mathinline.h" 3
extern __inline double __sgn (double) ; extern __inline double __sgn (double __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); } extern __inline float __sgnf (float) ; extern __inline float __sgnf (float __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); } extern __inline long double __sgnl (long double) ; extern __inline long double __sgnl (long double __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); }
extern __inline double __pow2 (double) ; extern __inline double __pow2 (double __x) { 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; } extern __inline float __pow2f (float) ; extern __inline float __pow2f (float __x) { 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; } extern __inline long double __pow2l (long double) ; extern __inline long double __pow2l (long double __x) { 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
extern __inline void
__sincos (double __x, double *__sinx, double *__cosx)
{
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;
}
extern __inline void
__sincosf (float __x, float *__sinx, float *__cosx)
{
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;
}
extern __inline void
__sincosl (long double __x, long double *__sinx, long double *__cosx)
{
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
extern __inline long double __expm1l (long double __x) { 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
extern __inline double exp (double __x) { 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; } extern __inline float expf (float __x) { 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; } extern __inline long double expl (long double __x) { 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; }
extern __inline long double __expl (long double __x) { 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; }
extern __inline double tan (double __x) { register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__ ("fptan" : "=t" (__value2), "=u" (__value) : "0" (__x)); return __value; } extern __inline float tanf (float __x) { register long double __value; register long double __value2 __attribute__ ((__unused__)); __asm __volatile__ ("fptan" : "=t" (__value2), "=u" (__value) : "0" (__x)); return __value; } extern __inline long double tanl (long double __x) { 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
extern __inline double atan2 (double __y, double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; } extern __inline float atan2f (float __y, float __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; } extern __inline long double atan2l (long double __y, long double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; }
extern __inline long double __atan2l (long double __y, long double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; }
extern __inline double fmod (double __x, double __y) { 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; } extern __inline float fmodf (float __x, float __y) { 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; } extern __inline long double fmodl (long double __x, long double __y) { 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
extern __inline double sqrt (double __x) { register double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float sqrtf (float __x) { register float __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double sqrtl (long double __x) { register long double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; }
extern __inline long double __sqrtl (long double __x) { register long double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; }
extern __inline double fabs (double __x) { return __builtin_fabs (__x); }
extern __inline float fabsf (float __x) { return __builtin_fabsf (__x); }
extern __inline long double fabsl (long double __x) { return __builtin_fabsl (__x); }
extern __inline long double __fabsl (long double __x) { return __builtin_fabsl (__x); }
extern __inline double sin (double __x) { register double __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float sinf (float __x) { register float __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double sinl (long double __x) { register long double __result; __asm __volatile__ ("fsin" : "=t" (__result) : "0" (__x)); return __result; }
extern __inline double cos (double __x) { register double __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float cosf (float __x) { register float __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double cosl (long double __x) { register long double __result; __asm __volatile__ ("fcos" : "=t" (__result) : "0" (__x)); return __result; }
extern __inline double log (double __x) { register double __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float logf (float __x) { register float __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double logl (long double __x) { register long double __result; __asm __volatile__ ("fldln2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
extern __inline double log10 (double __x) { register double __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float log10f (float __x) { register float __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double log10l (long double __x) { register long double __result; __asm __volatile__ ("fldlg2; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
extern __inline double asin (double __x) { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); } extern __inline float asinf (float __x) { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); } extern __inline long double asinl (long double __x) { return __atan2l (__x, __sqrtl (1.0 - __x * __x)); }
extern __inline double acos (double __x) { return __atan2l (__sqrtl (1.0 - __x * __x), __x); } extern __inline float acosf (float __x) { return __atan2l (__sqrtl (1.0 - __x * __x), __x); } extern __inline long double acosl (long double __x) { return __atan2l (__sqrtl (1.0 - __x * __x), __x); }
extern __inline double atan (double __x) { register double __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float atanf (float __x) { register float __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double atanl (long double __x) { register long double __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
extern __inline long double __sgn1l (long double) ; extern __inline long double __sgn1l (long double __x) { __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
extern __inline double sinh (double __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); } extern __inline float sinhf (float __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); } extern __inline long double sinhl (long double __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0) + __exm1) * __sgn1l (__x); }
extern __inline double cosh (double __x) { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); } extern __inline float coshf (float __x) { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); } extern __inline long double coshl (long double __x) { register long double __ex = __expl (__x); return 0.5 * (__ex + 1.0 / __ex); }
extern __inline double tanh (double __x) { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); } extern __inline float tanhf (float __x) { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); } extern __inline long double tanhl (long double __x) { register long double __exm1 = __expm1l (-__fabsl (__x + __x)); return __exm1 / (__exm1 + 2.0) * __sgn1l (-__x); }
extern __inline double floor (double __x) { 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; } extern __inline float floorf (float __x) { 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; } extern __inline long double floorl (long double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstc!
w %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
extern __inline double ceil (double __x) { 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; } extern __inline float ceilf (float __x) { 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; } extern __inline long double ceill (long double __x) { 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; }
# 521 "/usr/include/bits/mathinline.h" 3
extern __inline double
ldexp (double __x, int __y)
{
register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}
extern __inline double expm1 (double __x) { 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; } extern __inline float expm1f (float __x) { 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" "f2x!
m1 # 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; } extern __inline long double expm1l (long double __x) { 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; }
extern __inline double log1p (double __x) { 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; } extern __inline float log1pf (float __x) { 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; } extern __inline long double log1pl (long double __x) { 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
extern __inline double asinh (double __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); } extern __inline float asinhf (float __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); } extern __inline long double asinhl (long double __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); }
extern __inline double acosh (double __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); } extern __inline float acoshf (float __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); } extern __inline long double acoshl (long double __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); }
extern __inline double atanh (double __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); } extern __inline float atanhf (float __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); } extern __inline long double atanhl (long double __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); }
extern __inline double hypot (double __x, double __y) { return __sqrtl (__x * __x + __y * __y); } extern __inline float hypotf (float __x, float __y) { return __sqrtl (__x * __x + __y * __y); } extern __inline long double hypotl (long double __x, long double __y) { return __sqrtl (__x * __x + __y * __y); }
extern __inline double logb (double __x) { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; } extern __inline float logbf (float __x) { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; } extern __inline long double logbl (long double __x) { 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
extern __inline double log2 (double __x) { register double __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float log2f (float __x) { register float __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double log2l (long double __x) { register long double __result; __asm __volatile__ ("fld1; fxch; fyl2x" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }
extern __inline float
ldexpf (float __x, int __y)
{
register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}
extern __inline long double
ldexpl (long double __x, int __y)
{
register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}
extern __inline double fma (double __x, double __y, double __z) { return (__x * __y) + __z; } extern __inline float fmaf (float __x, float __y, float __z) { return (__x * __y) + __z; } extern __inline long double fmal (long double __x, long double __y, long double __z) { return (__x * __y) + __z; }
extern __inline double rint (double __x) { register double __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float rintf (float __x) { register float __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double rintl (long double __x) { register long double __result; __asm __volatile__ ("frndint" : "=t" (__result) : "0" (__x)); return __result; }
# 607 "/usr/include/bits/mathinline.h" 3
extern __inline long int
lrintf (float __x)
{
long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
extern __inline long int
lrint (double __x)
{
long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
extern __inline long int
lrintl (long double __x)
{
long int __lrintres; __asm__ __volatile__ ("fistpl %0" : "=m" (__lrintres) : "t" (__x) : "st"); return __lrintres;
}
# 630 "/usr/include/bits/mathinline.h" 3
extern __inline long long int
llrintf (float __x)
{
long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}
extern __inline long long int
llrint (double __x)
{
long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}
extern __inline long long int
llrintl (long double __x)
{
long long int __llrintres; __asm__ __volatile__ ("fistpll %0" : "=m" (__llrintres) : "t" (__x) : "st"); return __llrintres;
}
extern __inline double drem (double __x, double __y) { 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; } extern __inline float dremf (float __x, float __y) { 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; } extern __inline long double dreml (long double __x, long double __y) { 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
extern __inline int
__finite (double __x)
{
return (__extension__
(((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
| 0x800fffffu) + 1) >> 31));
}
extern __inline double __coshm1 (double) ; extern __inline double __coshm1 (double __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; } extern __inline float __coshm1f (float) ; extern __inline float __coshm1f (float __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; } extern __inline long double __coshm1l (long double) ; extern __inline long double __coshm1l (long double __x) { register long double __exm1 = __expm1l (__fabsl (__x)); return 0.5 * (__exm1 / (__exm1 + 1.0)) * __exm1; }
extern __inline double __acosh1p (double) ; extern __inline double __acosh1p (double __x) { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); } extern __inline float __acosh1pf (float) ; extern __inline float __acosh1pf (float __x) { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); } extern __inline long double __acosh1pl (long double) ; extern __inline long double __acosh1pl (long double __x) { return log1pl (__x + __sqrtl (__x) * __sqrtl (__x + 2.0)); }
# 351 "/usr/include/math.h" 2 3
# 411 "/usr/include/math.h" 3
# 21 "ratecontrol.c" 2
# 1 "common.h" 1
# 20 "common.h"
# 1 "../config.h" 1
# 21 "common.h" 2
# 1 "/usr/include/stdlib.h" 1 3
# 33 "/usr/include/stdlib.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 201 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 3
typedef unsigned int size_t;
# 294 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 3
typedef long int wchar_t;
# 34 "/usr/include/stdlib.h" 2 3
# 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
# 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
# 68 "/usr/include/stdlib.h" 3
typedef union
{
union wait *__uptr;
int *__iptr;
} __WAIT_STATUS __attribute__ ((__transparent_union__));
# 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) ;
extern double atof (__const char *__nptr) __attribute__ ((__pure__));
extern int atoi (__const char *__nptr) __attribute__ ((__pure__));
extern long int atol (__const char *__nptr) __attribute__ ((__pure__));
__extension__ extern long long int atoll (__const char *__nptr)
__attribute__ ((__pure__));
extern double strtod (__const char *__restrict __nptr,
char **__restrict __endptr) ;
extern float strtof (__const char *__restrict __nptr,
char **__restrict __endptr) ;
extern long double strtold (__const char *__restrict __nptr,
char **__restrict __endptr) ;
extern long int strtol (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) ;
extern unsigned long int strtoul (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
;
__extension__
extern long long int strtoq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) ;
__extension__
extern unsigned long long int strtouq (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
;
__extension__
extern long long int strtoll (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) ;
__extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
char **__restrict __endptr, int __base)
;
# 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) ;
extern unsigned long int __strtoul_l (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc) ;
__extension__
extern long long int __strtoll_l (__const char *__restrict __nptr,
char **__restrict __endptr, int __base,
__locale_t __loc) ;
__extension__
extern unsigned long long int __strtoull_l (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, __locale_t __loc)
;
extern double __strtod_l (__const char *__restrict __nptr,
char **__restrict __endptr, __locale_t __loc)
;
extern float __strtof_l (__const char *__restrict __nptr,
char **__restrict __endptr, __locale_t __loc) ;
extern long double __strtold_l (__const char *__restrict __nptr,
char **__restrict __endptr,
__locale_t __loc) ;
extern double __strtod_internal (__const char *__restrict __nptr,
char **__restrict __endptr, int __group)
;
extern float __strtof_internal (__const char *__restrict __nptr,
char **__restrict __endptr, int __group)
;
extern long double __strtold_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __group) ;
extern long int __strtol_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) ;
extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) ;
__extension__
extern long long int __strtoll_internal (__const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group) ;
__extension__
extern unsigned long long int __strtoull_internal (__const char *
__restrict __nptr,
char **__restrict __endptr,
int __base, int __group)
;
extern __inline double
strtod (__const char *__restrict __nptr, char **__restrict __endptr)
{
return __strtod_internal (__nptr, __endptr, 0);
}
extern __inline long int
strtol (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtol_internal (__nptr, __endptr, __base, 0);
}
extern __inline unsigned long int
strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoul_internal (__nptr, __endptr, __base, 0);
}
extern __inline float
strtof (__const char *__restrict __nptr, char **__restrict __endptr)
{
return __strtof_internal (__nptr, __endptr, 0);
}
extern __inline long double
strtold (__const char *__restrict __nptr, char **__restrict __endptr)
{
return __strtold_internal (__nptr, __endptr, 0);
}
__extension__ extern __inline long long int
strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoull_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline long long int
strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
int __base)
{
return __strtoull_internal (__nptr, __endptr, __base, 0);
}
extern __inline double
atof (__const char *__nptr)
{
return strtod (__nptr, (char **) ((void *)0));
}
extern __inline int
atoi (__const char *__nptr)
{
return (int) strtol (__nptr, (char **) ((void *)0), 10);
}
extern __inline long int
atol (__const char *__nptr)
{
return strtol (__nptr, (char **) ((void *)0), 10);
}
__extension__ extern __inline long long int
atoll (__const char *__nptr)
{
return strtoll (__nptr, (char **) ((void *)0), 10);
}
# 384 "/usr/include/stdlib.h" 3
extern char *l64a (long int __n) ;
extern long int a64l (__const char *__s) __attribute__ ((__pure__));
# 1 "/usr/include/sys/types.h" 1 3
# 28 "/usr/include/sys/types.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 29 "/usr/include/bits/types.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/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
# 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 __ino64_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 __off64_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
# 59 "/usr/include/time.h" 3
typedef __clock_t clock_t;
# 70 "/usr/include/time.h" 3
typedef __time_t time_t;
# 82 "/usr/include/time.h" 3
typedef __clockid_t clockid_t;
# 94 "/usr/include/time.h" 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/i486-suse-linux/3.2/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__)));
# 215 "/usr/include/sys/types.h" 3
# 1 "/usr/include/sys/select.h" 1 3
# 31 "/usr/include/sys/select.h" 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
{
__time_t tv_sec;
long int tv_nsec;
};
# 45 "/usr/include/sys/select.h" 2 3
# 1 "/usr/include/bits/time.h" 1 3
# 67 "/usr/include/bits/time.h" 3
struct timeval
{
__time_t tv_sec;
__suseconds_t tv_usec;
};
# 47 "/usr/include/sys/select.h" 2 3
# 55 "/usr/include/sys/select.h" 3
typedef long int __fd_mask;
typedef struct
{
__fd_mask fds_bits[1024 / (8 * sizeof (__fd_mask))];
} fd_set;
typedef __fd_mask fd_mask;
# 95 "/usr/include/sys/select.h" 3
extern int select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout) ;
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) ;
# 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;
# 243 "/usr/include/sys/types.h" 3
typedef __blkcnt64_t blkcnt_t;
typedef __fsblkcnt64_t fsblkcnt_t;
typedef __fsfilcnt64_t fsfilcnt_t;
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) ;
extern void srandom (unsigned int __seed) ;
extern char *initstate (unsigned int __seed, char *__statebuf,
size_t __statelen) ;
extern char *setstate (char *__statebuf) ;
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) ;
extern int srandom_r (unsigned int __seed, struct random_data *__buf) ;
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
size_t __statelen,
struct random_data *__restrict __buf) ;
extern int setstate_r (char *__restrict __statebuf,
struct random_data *__restrict __buf) ;
extern int rand (void) ;
extern void srand (unsigned int __seed) ;
extern int rand_r (unsigned int *__seed) ;
extern double drand48 (void) ;
extern double erand48 (unsigned short int __xsubi[3]) ;
extern long int lrand48 (void) ;
extern long int nrand48 (unsigned short int __xsubi[3]) ;
extern long int mrand48 (void) ;
extern long int jrand48 (unsigned short int __xsubi[3]) ;
extern void srand48 (long int __seedval) ;
extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ;
extern void lcong48 (unsigned short int __param[7]) ;
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) ;
extern int erand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
double *__restrict __result) ;
extern int lrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result) ;
extern int nrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result) ;
extern int mrand48_r (struct drand48_data *__restrict __buffer,
long int *__restrict __result) ;
extern int jrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__restrict __buffer,
long int *__restrict __result) ;
extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
;
extern int seed48_r (unsigned short int __seed16v[3],
struct drand48_data *__buffer) ;
extern int lcong48_r (unsigned short int __param[7],
struct drand48_data *__buffer) ;
# 527 "/usr/include/stdlib.h" 3
extern void *malloc (size_t __size) __attribute__ ((__malloc__));
extern void *calloc (size_t __nmemb, size_t __size)
__attribute__ ((__malloc__));
extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__malloc__));
extern void free (void *__ptr) ;
extern void cfree (void *__ptr) ;
# 1 "/usr/include/alloca.h" 1 3
# 25 "/usr/include/alloca.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 26 "/usr/include/alloca.h" 2 3
extern void *alloca (size_t __size) ;
# 547 "/usr/include/stdlib.h" 2 3
extern void *valloc (size_t __size) __attribute__ ((__malloc__));
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
__attribute__ ((__malloc__));
extern void abort (void) __attribute__ ((__noreturn__));
extern int atexit (void (*__func) (void)) ;
extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
;
extern void exit (int __status) __attribute__ ((__noreturn__));
extern void _Exit (int __status) __attribute__ ((__noreturn__));
extern char *getenv (__const char *__name) ;
extern char *__secure_getenv (__const char *__name) ;
extern int putenv (char *__string) ;
extern int setenv (__const char *__name, __const char *__value, int __replace)
;
extern int unsetenv (__const char *__name) ;
extern int clearenv (void) ;
# 623 "/usr/include/stdlib.h" 3
extern char *mktemp (char *__template) ;
# 634 "/usr/include/stdlib.h" 3
extern int mkstemp (char *__template) __asm__ ("" "mkstemp64");
extern int mkstemp64 (char *__template) ;
# 650 "/usr/include/stdlib.h" 3
extern char *mkdtemp (char *__template) ;
extern int system (__const char *__command) ;
extern char *canonicalize_file_name (__const char *__name) ;
# 672 "/usr/include/stdlib.h" 3
extern char *realpath (__const char *__restrict __name,
char *__restrict __resolved) ;
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) __attribute__ ((__const__));
extern long int labs (long int __x) __attribute__ ((__const__));
__extension__ extern long long int llabs (long long int __x)
__attribute__ ((__const__));
extern div_t div (int __numer, int __denom)
__attribute__ ((__const__));
extern ldiv_t ldiv (long int __numer, long int __denom)
__attribute__ ((__const__));
__extension__ extern lldiv_t lldiv (long long int __numer,
long long int __denom)
__attribute__ ((__const__));
# 728 "/usr/include/stdlib.h" 3
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign) ;
extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign) ;
extern char *gcvt (double __value, int __ndigit, char *__buf) ;
extern char *qecvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign) ;
extern char *qfcvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign) ;
extern char *qgcvt (long double __value, int __ndigit, char *__buf) ;
extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len) ;
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len) ;
extern int qecvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len) ;
extern int qfcvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len) ;
extern int mblen (__const char *__s, size_t __n) ;
extern int mbtowc (wchar_t *__restrict __pwc,
__const char *__restrict __s, size_t __n) ;
extern int wctomb (char *__s, wchar_t __wchar) ;
extern size_t mbstowcs (wchar_t *__restrict __pwcs,
__const char *__restrict __s, size_t __n) ;
extern size_t wcstombs (char *__restrict __s,
__const wchar_t *__restrict __pwcs, size_t __n)
;
extern int rpmatch (__const char *__response) ;
# 808 "/usr/include/stdlib.h" 3
extern int getsubopt (char **__restrict __optionp,
char *__const *__restrict __tokens,
char **__restrict __valuep) ;
extern void setkey (__const char *__key) ;
extern int posix_openpt (int __oflag) ;
extern int grantpt (int __fd) ;
extern int unlockpt (int __fd) ;
extern char *ptsname (int __fd) ;
extern int ptsname_r (int __fd, char *__buf, size_t __buflen) ;
extern int getpt (void) ;
extern int getloadavg (double __loadavg[], int __nelem) ;
# 23 "common.h" 2
# 1 "/usr/include/stdio.h" 1 3
# 30 "/usr/include/stdio.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 35 "/usr/include/stdio.h" 2 3
# 45 "/usr/include/stdio.h" 3
typedef struct _IO_FILE FILE;
# 55 "/usr/include/stdio.h" 3
typedef struct _IO_FILE __FILE;
# 65 "/usr/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
# 14 "/usr/include/_G_config.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 321 "/usr/lib/gcc-lib/i486-suse-linux/3.2/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/i486-suse-linux/3.2/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
# 28 "/usr/include/gconv.h" 3
# 1 "/usr/include/wchar.h" 1 3
# 48 "/usr/include/wchar.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 49 "/usr/include/wchar.h" 2 3
# 29 "/usr/include/gconv.h" 2 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 32 "/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/i486-suse-linux/3.2/include/stdarg.h" 1 3
# 43 "/usr/lib/gcc-lib/i486-suse-linux/3.2/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 *)];
};
typedef struct _IO_FILE _IO_FILE;
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 int __underflow (_IO_FILE *) ;
extern int __uflow (_IO_FILE *) ;
extern int __overflow (_IO_FILE *, int) ;
extern wint_t __wunderflow (_IO_FILE *) ;
extern wint_t __wuflow (_IO_FILE *) ;
extern wint_t __woverflow (_IO_FILE *, wint_t) ;
# 426 "/usr/include/libio.h" 3
extern int _IO_getc (_IO_FILE *__fp) ;
extern int _IO_putc (int __c, _IO_FILE *__fp) ;
extern int _IO_feof (_IO_FILE *__fp) ;
extern int _IO_ferror (_IO_FILE *__fp) ;
extern int _IO_peekc_locked (_IO_FILE *__fp) ;
extern void _IO_flockfile (_IO_FILE *) ;
extern void _IO_funlockfile (_IO_FILE *) ;
extern int _IO_ftrylockfile (_IO_FILE *) ;
# 456 "/usr/include/libio.h" 3
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
__gnuc_va_list, int *__restrict) ;
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
__gnuc_va_list) ;
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t) ;
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t) ;
extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int) ;
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int) ;
extern void _IO_free_backup_area (_IO_FILE *) ;
# 66 "/usr/include/stdio.h" 2 3
typedef __gnuc_va_list va_list;
# 82 "/usr/include/stdio.h" 3
typedef _G_fpos64_t fpos_t;
typedef _G_fpos64_t fpos64_t;
# 129 "/usr/include/stdio.h" 3
# 1 "/usr/include/bits/stdio_lim.h" 1 3
# 130 "/usr/include/stdio.h" 2 3
extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;
extern int remove (__const char *__filename) ;
extern int rename (__const char *__old, __const char *__new) ;
extern FILE *tmpfile (void) __asm__ ("" "tmpfile64");
extern FILE *tmpfile64 (void) ;
extern char *tmpnam (char *__s) ;
extern char *tmpnam_r (char *__s) ;
# 178 "/usr/include/stdio.h" 3
extern char *tempnam (__const char *__dir, __const char *__pfx)
__attribute__ ((__malloc__));
extern int fclose (FILE *__stream) ;
extern int fflush (FILE *__stream) ;
extern int fflush_unlocked (FILE *__stream) ;
extern int fcloseall (void) ;
# 209 "/usr/include/stdio.h" 3
extern FILE *fopen (__const char *__restrict __filename, __const char *__restrict __modes) __asm__ ("" "fopen64");
extern FILE *freopen (__const char *__restrict __filename, __const char *__restrict __modes, FILE *__restrict __stream) __asm__ ("" "freopen64");
# 222 "/usr/include/stdio.h" 3
extern FILE *fopen64 (__const char *__restrict __filename,
__const char *__restrict __modes) ;
extern FILE *freopen64 (__const char *__restrict __filename,
__const char *__restrict __modes,
FILE *__restrict __stream) ;
extern FILE *fdopen (int __fd, __const char *__modes) ;
extern FILE *fopencookie (void *__restrict __magic_cookie,
__const char *__restrict __modes,
_IO_cookie_io_functions_t __io_funcs) ;
extern FILE *fmemopen (void *__s, size_t __len, __const char *__modes) ;
extern FILE *open_memstream (char **__restrict __bufloc,
size_t *__restrict __sizeloc) ;
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) ;
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
int __modes, size_t __n) ;
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
size_t __size) ;
extern void setlinebuf (FILE *__stream) ;
extern int fprintf (FILE *__restrict __stream,
__const char *__restrict __format, ...) ;
extern int printf (__const char *__restrict __format, ...) ;
extern int sprintf (char *__restrict __s,
__const char *__restrict __format, ...) ;
extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg) ;
extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
;
extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg) ;
extern int snprintf (char *__restrict __s, size_t __maxlen,
__const char *__restrict __format, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
__const char *__restrict __format, __gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 3, 0)));
extern int vasprintf (char **__restrict __ptr, __const char *__restrict __f,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 2, 0)));
extern int __asprintf (char **__restrict __ptr,
__const char *__restrict __fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern int asprintf (char **__restrict __ptr,
__const char *__restrict __fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern int vdprintf (int __fd, __const char *__restrict __fmt,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__printf__, 2, 0)));
extern int dprintf (int __fd, __const char *__restrict __fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern int fscanf (FILE *__restrict __stream,
__const char *__restrict __format, ...) ;
extern int scanf (__const char *__restrict __format, ...) ;
extern int sscanf (__const char *__restrict __s,
__const char *__restrict __format, ...) ;
extern int vfscanf (FILE *__restrict __s, __const char *__restrict __format,
__gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0)));
extern int vscanf (__const char *__restrict __format, __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 1, 0)));
extern int vsscanf (__const char *__restrict __s,
__const char *__restrict __format, __gnuc_va_list __arg)
__attribute__ ((__format__ (__scanf__, 2, 0)));
extern int fgetc (FILE *__stream) ;
extern int getc (FILE *__stream) ;
extern int getchar (void) ;
extern int getc_unlocked (FILE *__stream) ;
extern int getchar_unlocked (void) ;
extern int fgetc_unlocked (FILE *__stream) ;
extern int fputc (int __c, FILE *__stream) ;
extern int putc (int __c, FILE *__stream) ;
extern int putchar (int __c) ;
extern int fputc_unlocked (int __c, FILE *__stream) ;
extern int putc_unlocked (int __c, FILE *__stream) ;
extern int putchar_unlocked (int __c) ;
extern int getw (FILE *__stream) ;
extern int putw (int __w, FILE *__stream) ;
extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
;
extern char *fgets_unlocked (char *__restrict __s, int __n,
FILE *__restrict __stream) ;
extern char *gets (char *__s) ;
# 426 "/usr/include/stdio.h" 3
extern __ssize_t __getdelim (char **__restrict __lineptr,
size_t *__restrict __n, int __delimiter,
FILE *__restrict __stream) ;
extern __ssize_t getdelim (char **__restrict __lineptr,
size_t *__restrict __n, int __delimiter,
FILE *__restrict __stream) ;
extern __ssize_t getline (char **__restrict __lineptr,
size_t *__restrict __n,
FILE *__restrict __stream) ;
extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
;
extern int fputs_unlocked (__const char *__restrict __s,
FILE *__restrict __stream) ;
extern int puts (__const char *__s) ;
extern int ungetc (int __c, FILE *__stream) ;
extern size_t fread (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __s) ;
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
size_t __n, FILE *__restrict __stream) ;
extern int fseek (FILE *__stream, long int __off, int __whence) ;
extern long int ftell (FILE *__stream) ;
extern void rewind (FILE *__stream) ;
# 502 "/usr/include/stdio.h" 3
extern int fseeko (FILE *__stream, __off64_t __off, int __whence) __asm__ ("" "fseeko64");
extern __off64_t ftello (FILE *__stream) __asm__ ("" "ftello64");
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos) __asm__ ("" "fgetpos64");
extern int fsetpos (FILE *__stream, __const fpos_t *__pos) __asm__ ("" "fsetpos64");
# 523 "/usr/include/stdio.h" 3
extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence) ;
extern __off64_t ftello64 (FILE *__stream) ;
extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos)
;
extern int fsetpos64 (FILE *__stream, __const fpos64_t *__pos) ;
extern void clearerr (FILE *__stream) ;
extern int feof (FILE *__stream) ;
extern int ferror (FILE *__stream) ;
extern void clearerr_unlocked (FILE *__stream) ;
extern int feof_unlocked (FILE *__stream) ;
extern int ferror_unlocked (FILE *__stream) ;
extern void perror (__const char *__s) ;
# 1 "/usr/include/bits/sys_errlist.h" 1 3
# 27 "/usr/include/bits/sys_errlist.h" 3
extern int sys_nerr;
extern __const char *__const sys_errlist[];
extern int _sys_nerr;
extern __const char *__const _sys_errlist[];
# 553 "/usr/include/stdio.h" 2 3
extern int fileno (FILE *__stream) ;
extern int fileno_unlocked (FILE *__stream) ;
extern FILE *popen (__const char *__command, __const char *__modes) ;
extern int pclose (FILE *__stream) ;
extern char *ctermid (char *__s) ;
extern char *cuserid (char *__s) ;
struct obstack;
extern int obstack_printf (struct obstack *__restrict __obstack,
__const char *__restrict __format, ...) ;
extern int obstack_vprintf (struct obstack *__restrict __obstack,
__const char *__restrict __format,
__gnuc_va_list __args) ;
extern void flockfile (FILE *__stream) ;
extern int ftrylockfile (FILE *__stream) ;
extern void funlockfile (FILE *__stream) ;
# 625 "/usr/include/stdio.h" 3
# 1 "/usr/include/bits/stdio.h" 1 3
# 33 "/usr/include/bits/stdio.h" 3
extern __inline int
vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg)
{
return vfprintf (stdout, __fmt, __arg);
}
extern __inline int
getchar (void)
{
return _IO_getc (stdin);
}
extern __inline int
getc_unlocked (FILE *__fp)
{
return ((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
}
extern __inline int
getchar_unlocked (void)
{
return ((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
}
extern __inline int
putchar (int __c)
{
return _IO_putc (__c, stdout);
}
extern __inline int
fputc_unlocked (int __c, FILE *__stream)
{
return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}
extern __inline int
putc_unlocked (int __c, FILE *__stream)
{
return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}
extern __inline int
putchar_unlocked (int __c)
{
return (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
}
extern __inline __ssize_t
getline (char **__lineptr, size_t *__n, FILE *__stream)
{
return __getdelim (__lineptr, __n, '\n', __stream);
}
extern __inline int
feof_unlocked (FILE *__stream)
{
return (((__stream)->_flags & 0x10) != 0);
}
extern __inline int
ferror_unlocked (FILE *__stream)
{
return (((__stream)->_flags & 0x20) != 0);
}
# 626 "/usr/include/stdio.h" 2 3
# 24 "common.h" 2
# 1 "/usr/include/string.h" 1 3
# 28 "/usr/include/string.h" 3
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 34 "/usr/include/string.h" 2 3
extern void *memcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n) ;
extern void *memmove (void *__dest, __const void *__src, size_t __n)
;
extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
int __c, size_t __n)
;
extern void *memset (void *__s, int __c, size_t __n) ;
extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
__attribute__ ((__pure__));
extern void *memchr (__const void *__s, int __c, size_t __n)
__attribute__ ((__pure__));
extern void *rawmemchr (__const void *__s, int __c) __attribute__ ((__pure__));
extern void *memrchr (__const void *__s, int __c, size_t __n)
__attribute__ ((__pure__));
extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
;
extern char *strncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) ;
extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
;
extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
size_t __n) ;
extern int strcmp (__const char *__s1, __const char *__s2)
__attribute__ ((__pure__));
extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
__attribute__ ((__pure__));
extern int strcoll (__const char *__s1, __const char *__s2)
__attribute__ ((__pure__));
extern size_t strxfrm (char *__restrict __dest,
__const char *__restrict __src, size_t __n) ;
# 111 "/usr/include/string.h" 3
extern int __strcoll_l (__const char *__s1, __const char *__s2, __locale_t __l)
__attribute__ ((__pure__));
extern size_t __strxfrm_l (char *__dest, __const char *__src, size_t __n,
__locale_t __l) ;
extern char *strdup (__const char *__s) __attribute__ ((__malloc__));
extern char *strndup (__const char *__string, size_t __n)
__attribute__ ((__malloc__));
# 155 "/usr/include/string.h" 3
extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));
extern char *strrchr (__const char *__s, int __c) __attribute__ ((__pure__));
extern char *strchrnul (__const char *__s, int __c) __attribute__ ((__pure__));
extern size_t strcspn (__const char *__s, __const char *__reject)
__attribute__ ((__pure__));
extern size_t strspn (__const char *__s, __const char *__accept)
__attribute__ ((__pure__));
extern char *strpbrk (__const char *__s, __const char *__accept)
__attribute__ ((__pure__));
extern char *strstr (__const char *__haystack, __const char *__needle)
__attribute__ ((__pure__));
extern char *strcasestr (__const char *__haystack, __const char *__needle)
__attribute__ ((__pure__));
extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
;
extern char *__strtok_r (char *__restrict __s,
__const char *__restrict __delim,
char **__restrict __save_ptr) ;
extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
char **__restrict __save_ptr) ;
extern void *memmem (__const void *__haystack, size_t __haystacklen,
__const void *__needle, size_t __needlelen)
__attribute__ ((__pure__));
extern void *__mempcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n) ;
extern void *mempcpy (void *__restrict __dest,
__const void *__restrict __src, size_t __n) ;
extern size_t strlen (__const char *__s) __attribute__ ((__pure__));
extern size_t strnlen (__const char *__string, size_t __maxlen)
__attribute__ ((__pure__));
extern char *strerror (int __errnum) ;
extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) ;
extern void __bzero (void *__s, size_t __n) ;
extern void bcopy (__const void *__src, void *__dest, size_t __n) ;
extern void bzero (void *__s, size_t __n) ;
extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
__attribute__ ((__pure__));
extern char *index (__const char *__s, int __c) __attribute__ ((__pure__));
extern char *rindex (__const char *__s, int __c) __attribute__ ((__pure__));
extern int ffs (int __i) __attribute__ ((__const__));
extern int ffsl (long int __l) __attribute__ ((__const__));
__extension__ extern int ffsll (long long int __ll)
__attribute__ ((__const__));
extern int strcasecmp (__const char *__s1, __const char *__s2)
__attribute__ ((__pure__));
extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
__attribute__ ((__pure__));
extern int __strcasecmp_l (__const char *__s1, __const char *__s2,
__locale_t __loc) __attribute__ ((__pure__));
extern int __strncasecmp_l (__const char *__s1, __const char *__s2,
size_t __n, __locale_t __loc)
__attribute__ ((__pure__));
extern char *strsep (char **__restrict __stringp,
__const char *__restrict __delim) ;
extern int strverscmp (__const char *__s1, __const char *__s2)
__attribute__ ((__pure__));
extern char *strsignal (int __sig) ;
extern char *__stpcpy (char *__restrict __dest, __const char *__restrict __src)
;
extern char *stpcpy (char *__restrict __dest, __const char *__restrict __src)
;
extern char *__stpncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) ;
extern char *stpncpy (char *__restrict __dest,
__const char *__restrict __src, size_t __n) ;
extern char *strfry (char *__string) ;
extern void *memfrob (void *__s, size_t __n) ;
extern char *basename (__const char *__filename) ;
# 357 "/usr/include/string.h" 3
# 1 "/usr/include/bits/string.h" 1 3
# 358 "/usr/include/string.h" 2 3
# 1 "/usr/include/bits/string2.h" 1 3
# 387 "/usr/include/bits/string2.h" 3
extern void *__rawmemchr (const void *__s, int __c);
# 917 "/usr/include/bits/string2.h" 3
extern __inline size_t __strcspn_c1 (__const char *__s, int __reject);
extern __inline size_t
__strcspn_c1 (__const char *__s, int __reject)
{
register size_t __result = 0;
while (__s[__result] != '\0' && __s[__result] != __reject)
++__result;
return __result;
}
extern __inline size_t __strcspn_c2 (__const char *__s, int __reject1,
int __reject2);
extern __inline size_t
__strcspn_c2 (__const char *__s, int __reject1, int __reject2)
{
register size_t __result = 0;
while (__s[__result] != '\0' && __s[__result] != __reject1
&& __s[__result] != __reject2)
++__result;
return __result;
}
extern __inline size_t __strcspn_c3 (__const char *__s, int __reject1,
int __reject2, int __reject3);
extern __inline size_t
__strcspn_c3 (__const char *__s, int __reject1, int __reject2,
int __reject3)
{
register size_t __result = 0;
while (__s[__result] != '\0' && __s[__result] != __reject1
&& __s[__result] != __reject2 && __s[__result] != __reject3)
++__result;
return __result;
}
# 974 "/usr/include/bits/string2.h" 3
extern __inline size_t __strspn_c1 (__const char *__s, int __accept);
extern __inline size_t
__strspn_c1 (__const char *__s, int __accept)
{
register size_t __result = 0;
while (__s[__result] == __accept)
++__result;
return __result;
}
extern __inline size_t __strspn_c2 (__const char *__s, int __accept1,
int __accept2);
extern __inline size_t
__strspn_c2 (__const char *__s, int __accept1, int __accept2)
{
register size_t __result = 0;
while (__s[__result] == __accept1 || __s[__result] == __accept2)
++__result;
return __result;
}
extern __inline size_t __strspn_c3 (__const char *__s, int __accept1,
int __accept2, int __accept3);
extern __inline size_t
__strspn_c3 (__const char *__s, int __accept1, int __accept2, int __accept3)
{
register size_t __result = 0;
while (__s[__result] == __accept1 || __s[__result] == __accept2
|| __s[__result] == __accept3)
++__result;
return __result;
}
# 1031 "/usr/include/bits/string2.h" 3
extern __inline char *__strpbrk_c2 (__const char *__s, int __accept1,
int __accept2);
extern __inline char *
__strpbrk_c2 (__const char *__s, int __accept1, int __accept2)
{
while (*__s != '\0' && *__s != __accept1 && *__s != __accept2)
++__s;
return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
}
extern __inline char *__strpbrk_c3 (__const char *__s, int __accept1,
int __accept2, int __accept3);
extern __inline char *
__strpbrk_c3 (__const char *__s, int __accept1, int __accept2,
int __accept3)
{
while (*__s != '\0' && *__s != __accept1 && *__s != __accept2
&& *__s != __accept3)
++__s;
return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
}
# 1083 "/usr/include/bits/string2.h" 3
extern __inline char *__strtok_r_1c (char *__s, char __sep, char **__nextp);
extern __inline char *
__strtok_r_1c (char *__s, char __sep, char **__nextp)
{
char *__result;
if (__s == ((void *)0))
__s = *__nextp;
while (*__s == __sep)
++__s;
__result = ((void *)0);
if (*__s != '\0')
{
__result = __s++;
while (*__s != '\0')
if (*__s++ == __sep)
{
__s[-1] = '\0';
break;
}
*__nextp = __s;
}
return __result;
}
# 1115 "/usr/include/bits/string2.h" 3
extern char *__strsep_g (char **__stringp, __const char *__delim);
# 1133 "/usr/include/bits/string2.h" 3
extern __inline char *__strsep_1c (char **__s, char __reject);
extern __inline char *
__strsep_1c (char **__s, char __reject)
{
register char *__retval = *__s;
if (__retval != ((void *)0) && (*__s = (__extension__ (__builtin_constant_p (__reject) && (__reject) == '\0' ? (char *) __rawmemchr (__retval, __reject) : strchr (__retval, __reject)))) != ((void *)0))
*(*__s)++ = '\0';
return __retval;
}
extern __inline char *__strsep_2c (char **__s, char __reject1, char __reject2);
extern __inline char *
__strsep_2c (char **__s, char __reject1, char __reject2)
{
register char *__retval = *__s;
if (__retval != ((void *)0))
{
register char *__cp = __retval;
while (1)
{
if (*__cp == '\0')
{
__cp = ((void *)0);
break;
}
if (*__cp == __reject1 || *__cp == __reject2)
{
*__cp++ = '\0';
break;
}
++__cp;
}
*__s = __cp;
}
return __retval;
}
extern __inline char *__strsep_3c (char **__s, char __reject1, char __reject2,
char __reject3);
extern __inline char *
__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)
{
register char *__retval = *__s;
if (__retval != ((void *)0))
{
register char *__cp = __retval;
while (1)
{
if (*__cp == '\0')
{
__cp = ((void *)0);
break;
}
if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3)
{
*__cp++ = '\0';
break;
}
++__cp;
}
*__s = __cp;
}
return __retval;
}
# 1214 "/usr/include/bits/string2.h" 3
extern char *__strdup (__const char *__string) __attribute__ ((__malloc__));
# 1233 "/usr/include/bits/string2.h" 3
extern char *__strndup (__const char *__string, size_t __n)
__attribute__ ((__malloc__));
# 361 "/usr/include/string.h" 2 3
# 25 "common.h" 2
# 1 "/usr/include/errno.h" 1 3
# 32 "/usr/include/errno.h" 3
# 1 "/usr/include/bits/errno.h" 1 3
# 25 "/usr/include/bits/errno.h" 3
# 1 "/usr/include/linux/errno.h" 1 3
# 1 "/usr/include/asm/errno.h" 1 3
# 5 "/usr/include/linux/errno.h" 2 3
# 26 "/usr/include/bits/errno.h" 2 3
# 36 "/usr/include/bits/errno.h" 3
extern int errno;
extern int *__errno_location (void) __attribute__ ((__const__));
# 37 "/usr/include/errno.h" 2 3
# 55 "/usr/include/errno.h" 3
extern char *program_invocation_name, *program_invocation_short_name;
# 69 "/usr/include/errno.h" 3
typedef int error_t;
# 27 "common.h" 2
# 95 "common.h"
# 1 "/usr/include/inttypes.h" 1 3
# 28 "/usr/include/inttypes.h" 3
# 1 "/usr/include/stdint.h" 1 3
# 28 "/usr/include/stdint.h" 3
# 1 "/usr/include/bits/wordsize.h" 1 3
# 29 "/usr/include/stdint.h" 2 3
# 49 "/usr/include/stdint.h" 3
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
__extension__
typedef unsigned long long int uint64_t;
typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;
__extension__
typedef long long int int_least64_t;
typedef unsigned char uint_least8_t;
typedef unsigned short int uint_least16_t;
typedef unsigned int uint_least32_t;
__extension__
typedef unsigned long long int uint_least64_t;
typedef signed char int_fast8_t;
typedef int int_fast16_t;
typedef int int_fast32_t;
__extension__
typedef long long int int_fast64_t;
typedef unsigned char uint_fast8_t;
typedef unsigned int uint_fast16_t;
typedef unsigned int uint_fast32_t;
__extension__
typedef unsigned long long int uint_fast64_t;
# 126 "/usr/include/stdint.h" 3
typedef int intptr_t;
typedef unsigned int uintptr_t;
# 138 "/usr/include/stdint.h" 3
__extension__
typedef long long int intmax_t;
__extension__
typedef unsigned long long int uintmax_t;
# 29 "/usr/include/inttypes.h" 2 3
typedef long int __gwchar_t;
# 274 "/usr/include/inttypes.h" 3
# 288 "/usr/include/inttypes.h" 3
typedef struct
{
long long int quot;
long long int rem;
} imaxdiv_t;
extern intmax_t imaxabs (intmax_t __n) __attribute__ ((__const__));
extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)
__attribute__ ((__const__));
extern intmax_t strtoimax (__const char *__restrict __nptr,
char **__restrict __endptr, int __base) ;
extern uintmax_t strtoumax (__const char *__restrict __nptr,
char ** __restrict __endptr, int __base) ;
extern intmax_t wcstoimax (__const __gwchar_t *__restrict __nptr,
__gwchar_t **__restrict __endptr, int __base)
;
extern uintmax_t wcstoumax (__const __gwchar_t *__restrict __nptr,
__gwchar_t ** __restrict __endptr, int __base)
;
# 396 "/usr/include/inttypes.h" 3
extern __inline intmax_t
strtoimax (__const char *__restrict nptr, char **__restrict endptr,
int base)
{
return __strtoll_internal (nptr, endptr, base, 0);
}
# 414 "/usr/include/inttypes.h" 3
extern __inline uintmax_t
strtoumax (__const char *__restrict nptr, char **__restrict endptr,
int base)
{
return __strtoull_internal (nptr, endptr, base, 0);
}
__extension__
extern long long int __wcstoll_internal (__const __gwchar_t *
__restrict __nptr,
__gwchar_t **__restrict __endptr,
int __base, int __group) ;
extern __inline intmax_t
wcstoimax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr,
int base)
{
return __wcstoll_internal (nptr, endptr, base, 0);
}
__extension__
extern unsigned long long int __wcstoull_internal (__const __gwchar_t *
__restrict __nptr,
__gwchar_t **
__restrict __endptr,
int __base,
int __group) ;
extern __inline uintmax_t
wcstoumax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr,
int base)
{
return __wcstoull_internal (nptr, endptr, base, 0);
}
# 96 "common.h" 2
typedef unsigned short UINT16;
typedef signed short INT16;
typedef unsigned char UINT8;
typedef unsigned int UINT32;
typedef unsigned long long UINT64;
typedef signed char INT8;
typedef signed int INT32;
typedef signed long long INT64;
# 118 "common.h"
# 1 "fastmemcpy.h" 1
# 1 "../libvo/fastmemcpy.h" 1
# 1 "../config.h" 1
# 5 "../libvo/fastmemcpy.h" 2
# 1 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 1 3
# 147 "/usr/lib/gcc-lib/i486-suse-linux/3.2/include/stddef.h" 3
typedef int ptrdiff_t;
# 10 "../libvo/fastmemcpy.h" 2
extern void * fast_memcpy(void * to, const void * from, size_t len);
extern void * mem2agpcpy(void * to, const void * from, size_t len);
# 23 "../libvo/fastmemcpy.h"
static inline void * mem2agpcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
if(dstStride == srcStride) mem2agpcpy(dst, src, srcStride*height);
else
{
for(i=0; i<height; i++)
{
mem2agpcpy(dst, src, bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
}
return retval;
}
static inline void * memcpy_pic(void * dst, void * src, int bytesPerLine, int height, int dstStride, int srcStride)
{
int i;
void *retval=dst;
if(dstStride == srcStride) fast_memcpy(dst,src,srcStride*height);
else
{
for(i=0; i<height; i++)
{
fast_memcpy(dst,src,bytesPerLine);
src+= srcStride;
dst+= dstStride;
}
}
return retval;
}
# 2 "fastmemcpy.h" 2
# 119 "common.h" 2
# 127 "common.h"
# 1 "bswap.h" 1
# 9 "bswap.h"
inline static unsigned short ByteSwap16(unsigned short x)
{
__asm("xchgb %b0,%h0" :
"=q" (x) :
"0" (x));
return x;
}
inline static unsigned int ByteSwap32(unsigned int x)
{
__asm("bswap %0":
"=r" (x) :
"0" (x));
return x;
}
inline static unsigned long long int ByteSwap64(unsigned long long int x)
{
register union { __extension__ uint64_t __ll;
uint32_t __l[2]; } __x;
asm("xchgl %0,%1":
"=r"(__x.__l[0]),"=r"(__x.__l[1]):
"0"(ByteSwap32((unsigned long)x)),"1"(ByteSwap32((unsigned long)(x>>32))));
return __x.__ll;
}
# 128 "common.h" 2
# 141 "common.h"
# 1 "/usr/include/assert.h" 1 3
# 142 "common.h" 2
# 170 "common.h"
static inline int32_t NEG_SSR32( int32_t a, int8_t s){
asm ("sarl %1, %0\n\t"
: "+r" (a)
: "ic" ((uint8_t)(-s))
);
return a;
}
static inline uint32_t NEG_USR32(uint32_t a, int8_t s){
asm ("shrl %1, %0\n\t"
: "+r" (a)
: "ic" ((uint8_t)(-s))
);
return a;
}
struct PutBitContext;
typedef void (*WriteDataFunc)(void *, UINT8 *, int);
typedef struct PutBitContext {
UINT32 bit_buf;
int bit_left;
UINT8 *buf, *buf_ptr, *buf_end;
INT64 data_out_size;
} PutBitContext;
void init_put_bits(PutBitContext *s,
UINT8 *buffer, int buffer_size,
void *opaque,
void (*write_data)(void *, UINT8 *, int));
INT64 get_bit_count(PutBitContext *s);
void align_put_bits(PutBitContext *s);
void flush_put_bits(PutBitContext *s);
void put_string(PutBitContext * pbc, char *s);
void jflush_put_bits(PutBitContext *s);
typedef struct GetBitContext {
UINT8 *buffer, *buffer_end;
int index;
# 236 "common.h"
int size;
} GetBitContext;
static inline int get_bits_count(GetBitContext *s);
typedef struct VLC {
int bits;
INT16 (*table)[2];
int table_size, table_allocated;
} VLC;
typedef struct RL_VLC_ELEM {
int16_t level;
int8_t len;
uint8_t run;
} RL_VLC_ELEM;
# 279 "common.h"
static inline void put_bits(PutBitContext *s, int n, unsigned int value)
{
unsigned int bit_buf;
int bit_left;
((void) (0));
bit_buf = s->bit_buf;
bit_left = s->bit_left;
if (n < bit_left) {
bit_buf = (bit_buf<<n) | value;
bit_left-=n;
} else {
bit_buf<<=bit_left;
bit_buf |= value >> (n - bit_left);
*(UINT32 *)s->buf_ptr = ByteSwap32(bit_buf);
s->buf_ptr+=4;
bit_left+=32 - n;
bit_buf = value;
}
s->bit_buf = bit_buf;
s->bit_left = bit_left;
}
# 382 "common.h"
static inline void jput_bits(PutBitContext *s, int n, unsigned int value)
{
unsigned int bit_buf, b;
int bit_left, i;
((void) (0));
bit_buf = s->bit_buf;
bit_left = s->bit_left;
if (n < bit_left) {
bit_buf = (bit_buf<<n) | value;
bit_left-=n;
} else {
bit_buf<<=bit_left;
bit_buf |= value >> (n - bit_left);
for(i=0;i<4;i++) {
b = (bit_buf >> 24);
*(s->buf_ptr++) = b;
if (b == 0xff)
*(s->buf_ptr++) = 0;
bit_buf <<= 8;
}
bit_left+= 32 - n;
bit_buf = value;
}
s->bit_buf = bit_buf;
s->bit_left = bit_left;
}
# 469 "common.h"
static inline uint8_t* pbBufPtr(PutBitContext *s)
{
return s->buf_ptr;
}
# 561 "common.h"
static inline int get_bits_count(GetBitContext *s){
return s->index;
}
# 681 "common.h"
static inline unsigned int get_bits(GetBitContext *s, int n){
register int tmp;
int re_index= (s)->index; int re_cache= 0;
re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);
tmp= NEG_USR32(re_cache, n);
re_index += (n);
(s)->index= re_index;
return tmp;
}
static inline unsigned int show_bits(GetBitContext *s, int n){
register int tmp;
int re_index= (s)->index; int re_cache= 0;
re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);
tmp= NEG_USR32(re_cache, n);
return tmp;
}
static inline void skip_bits(GetBitContext *s, int n){
int re_index= (s)->index; int re_cache= 0;
re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);
re_index += (n);
(s)->index= re_index;
}
static inline unsigned int get_bits1(GetBitContext *s){
int index= s->index;
uint8_t result= s->buffer[ index>>3 ];
result<<= (index&0x07);
result>>= 8 - 1;
index++;
s->index= index;
return result;
}
static inline unsigned int show_bits1(GetBitContext *s){
return show_bits(s, 1);
}
static inline void skip_bits1(GetBitContext *s){
skip_bits(s, 1);
}
void init_get_bits(GetBitContext *s,
UINT8 *buffer, int buffer_size);
int check_marker(GetBitContext *s, char *msg);
void align_get_bits(GetBitContext *s);
int init_vlc(VLC *vlc, int nb_bits, int nb_codes,
const void *bits, int bits_wrap, int bits_size,
const void *codes, int codes_wrap, int codes_size);
void free_vlc(VLC *vlc);
# 795 "common.h"
static inline int get_vlc(GetBitContext *s, VLC *vlc)
{
int code;
INT16 (*table)[2]= vlc->table;
int re_index= (s)->index; int re_cache= 0;
re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);
{ int n, index, nb_bits; index= NEG_USR32(re_cache, vlc->bits); code = table[index][0]; n = table[index][1]; if(3 > 1 && n < 0){ re_index += (vlc->bits); re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07); nb_bits = -n; index= NEG_USR32(re_cache, nb_bits) + code; code = table[index][0]; n = table[index][1]; if(3 > 2 && n < 0){ re_index += (nb_bits); re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07); nb_bits = -n; index= NEG_USR32(re_cache, nb_bits) + code; code = table[index][0]; n = table[index][1]; } } { re_cache <<= (n); re_index += (n); }}
(s)->index= re_index;
return code;
}
static __attribute__((always_inline)) inline int get_vlc2(GetBitContext *s, INT16 (*table)[2],
int bits, int max_depth)
{
int code;
int re_index= (s)->index; int re_cache= 0;
re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07);
{ int n, index, nb_bits; index= NEG_USR32(re_cache, bits); code = table[index][0]; n = table[index][1]; if(max_depth > 1 && n < 0){ re_index += (bits); re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07); nb_bits = -n; index= NEG_USR32(re_cache, nb_bits) + code; code = table[index][0]; n = table[index][1]; if(max_depth > 2 && n < 0){ re_index += (nb_bits); re_cache= ByteSwap32((*(UINT32*)(((uint8_t *)(s)->buffer)+(re_index>>3)))) << (re_index&0x07); nb_bits = -n; index= NEG_USR32(re_cache, nb_bits) + code; code = table[index][0]; n = table[index][1]; } } { re_cache <<= (n); re_index += (n); }}
(s)->index= re_index;
return code;
}
# 850 "common.h"
static inline int av_log2(unsigned int v)
{
int n;
n = 0;
if (v & 0xffff0000) {
v >>= 16;
n += 16;
}
if (v & 0xff00) {
v >>= 8;
n += 8;
}
if (v & 0xf0) {
v >>= 4;
n += 4;
}
if (v & 0xc) {
v >>= 2;
n += 2;
}
if (v & 0x2) {
n++;
}
return n;
}
static inline int mid_pred(int a, int b, int c)
{
int vmin, vmax;
vmax = vmin = a;
if (b < vmin)
vmin = b;
else
vmax = b;
if (c < vmin)
vmin = c;
else if (c > vmax)
vmax = c;
return a + b + c - vmin - vmax;
}
static inline int clip(int a, int amin, int amax)
{
if (a < amin)
return amin;
else if (a > amax)
return amax;
else
return a;
}
extern const UINT8 ff_sqrt_tab[128];
int ff_gcd(int a, int b);
static inline int ff_sqrt(int a)
{
int ret=0;
int s;
int ret_sq=0;
if(a<128) return ff_sqrt_tab[a];
for(s=15; s>=0; s--){
int b= ret_sq + (1<<(s*2)) + (ret<<s)*2;
if(b<=a){
ret_sq=b;
ret+= 1<<s;
}
}
return ret;
}
static inline int ff_get_fourcc(char *s){
((void) (0));
return (s[0]) + (s[1]<<8) + (s[2]<<16) + (s[3]<<24);
}
# 22 "ratecontrol.c" 2
# 1 "avcodec.h" 1
# 11 "avcodec.h"
enum CodecID {
CODEC_ID_NONE,
CODEC_ID_MPEG1VIDEO,
CODEC_ID_H263,
CODEC_ID_RV10,
CODEC_ID_MP2,
CODEC_ID_MP3LAME,
CODEC_ID_VORBIS,
CODEC_ID_AC3,
CODEC_ID_MJPEG,
CODEC_ID_MPEG4,
CODEC_ID_RAWVIDEO,
CODEC_ID_MSMPEG4V1,
CODEC_ID_MSMPEG4V2,
CODEC_ID_MSMPEG4V3,
CODEC_ID_WMV1,
CODEC_ID_WMV2,
CODEC_ID_H263P,
CODEC_ID_H263I,
CODEC_ID_SVQ1,
CODEC_ID_DVVIDEO,
CODEC_ID_DVAUDIO,
CODEC_ID_PCM_S16LE,
CODEC_ID_PCM_S16BE,
CODEC_ID_PCM_U16LE,
CODEC_ID_PCM_U16BE,
CODEC_ID_PCM_S8,
CODEC_ID_PCM_U8,
CODEC_ID_PCM_MULAW,
CODEC_ID_PCM_ALAW,
CODEC_ID_ADPCM_IMA_QT,
CODEC_ID_ADPCM_IMA_WAV,
CODEC_ID_ADPCM_MS,
};
enum CodecType {
CODEC_TYPE_UNKNOWN = -1,
CODEC_TYPE_VIDEO,
CODEC_TYPE_AUDIO,
};
enum PixelFormat {
PIX_FMT_ANY = -1,
PIX_FMT_YUV420P,
PIX_FMT_YUV422,
PIX_FMT_RGB24,
PIX_FMT_BGR24,
PIX_FMT_YUV422P,
PIX_FMT_YUV444P,
PIX_FMT_RGBA32,
PIX_FMT_BGRA32,
PIX_FMT_YUV410P,
PIX_FMT_YUV411P
};
enum SampleFormat {
SAMPLE_FMT_S16 = 0,
};
enum Motion_Est_ID {
ME_ZERO = 1,
ME_FULL,
ME_LOG,
ME_PHODS,
ME_EPZS,
ME_X1
};
typedef struct RcOverride{
int start_frame;
int end_frame;
int qscale;
float quality_factor;
} RcOverride;
extern int motion_estimation_method;
static const int Motion_Est_QTab[] = { ME_ZERO, ME_PHODS, ME_LOG,
ME_X1, ME_EPZS, ME_FULL };
# 142 "avcodec.h"
typedef struct AVCodecContext {
int bit_rate;
int bit_rate_tolerance;
int flags;
int sub_id;
int me_method;
# 187 "avcodec.h"
void *extradata;
int extradata_size;
# 198 "avcodec.h"
int frame_rate;
int width, height;
int aspect_ratio_info;
# 223 "avcodec.h"
int gop_size;
enum PixelFormat pix_fmt;
int repeat_pict;
# 244 "avcodec.h"
void (*draw_horiz_band)(struct AVCodecContext *s,
UINT8 **src_ptr, int linesize,
int y, int width, int height);
int sample_rate;
int channels;
int sample_fmt;
int frame_size;
int frame_number;
int real_pict_num;
int key_frame;
int pict_type;
# 284 "avcodec.h"
int delay;
uint8_t *mbskip_table;
int quality;
float qcompress;
float qblur;
int qmin;
int qmax;
int max_qdiff;
int max_b_frames;
float b_quant_factor;
int rc_strategy;
int b_frame_strategy;
int hurry_up;
struct AVCodec *codec;
void *priv_data;
int rtp_mode;
int rtp_payload_size;
# 375 "avcodec.h"
void (*rtp_callback)(void *data, int size, int packet_number);
int get_psnr;
float psnr_y;
float psnr_cb;
float psnr_cr;
int mv_bits;
int header_bits;
int i_tex_bits;
int p_tex_bits;
int i_count;
int p_count;
int skip_count;
int misc_bits;
int frame_bits;
void *opaque;
char codec_name[32];
enum CodecType codec_type;
enum CodecID codec_id;
unsigned int codec_tag;
int workaround_bugs;
# 436 "avcodec.h"
int luma_elim_threshold;
int chroma_elim_threshold;
int strict_std_compliance;
# 458 "avcodec.h"
float b_quant_offset;
int error_resilience;
int *quant_store;
unsigned qstride;
# 485 "avcodec.h"
uint8_t *dr_buffer[3];
int dr_stride;
void *dr_opaque_frame;
void (*get_buffer_callback)(struct AVCodecContext *c, int width, int height, int pict_type);
int has_b_frames;
int dr_uvstride;
int dr_ip_buffer_count;
int block_align;
int parse_only;
# 540 "avcodec.h"
int mpeg_quant;
char *stats_out;
char *stats_in;
float rc_qsquish;
float rc_qmod_amp;
int rc_qmod_freq;
RcOverride *rc_override;
int rc_override_count;
char *rc_eq;
int rc_max_rate;
int rc_min_rate;
int rc_buffer_size;
float rc_buffer_aggressivity;
float i_quant_factor;
# 619 "avcodec.h"
float i_quant_offset;
float rc_initial_cplx;
int aspected_width;
int aspected_height;
int dct_algo;
# 654 "avcodec.h"
long long int pts;
float lumi_masking;
float temporal_cplx_masking;
float spatial_cplx_masking;
float p_masking;
float dark_masking;
int fourcc;
int idct_algo;
# 719 "avcodec.h"
int slice_count;
int *slice_offset;
int error_concealment;
# 749 "avcodec.h"
unsigned long long int
ull_res0,ull_res1,ull_res2,ull_res3,ull_res4,ull_res5,
ull_res6,ull_res7,ull_res8,ull_res9,ull_res10,ull_res11;
float
flt_res0,flt_res1,flt_res2,flt_res3,flt_res4,flt_res5,
flt_res6,flt_res7,flt_res8,flt_res9,flt_res10,flt_res11,flt_res12;
void
*ptr_res0,*ptr_res1,*ptr_res2,*ptr_res3,*ptr_res4,*ptr_res5,
*ptr_res6,*ptr_res7,*ptr_res8,*ptr_res9,*ptr_res10,*ptr_res11,*ptr_res12;
unsigned long int
ul_res0,ul_res1,ul_res2,ul_res3,ul_res4,ul_res5,
ul_res6,ul_res7,ul_res8,ul_res9,ul_res10,ul_res11,ul_res12;
unsigned short int
us_res0,us_res1,us_res2,us_res3,us_res4,us_res5,
us_res6,us_res7,us_res8,us_res9,us_res10,us_res11,us_res12;
unsigned char
uc_res0,uc_res1,uc_res2,uc_res3,uc_res4,uc_res5,
uc_res6,uc_res7,uc_res8,uc_res9,uc_res10,uc_res11,uc_res12;
unsigned int
ui_res0,ui_res1,ui_res2,ui_res3,ui_res4,ui_res5,ui_res6,ui_res7,ui_res8,ui_res9,
ui_res10,ui_res11,ui_res12,ui_res13,ui_res14,ui_res15,ui_res16;
} AVCodecContext;
typedef struct AVCodec {
char *name;
int type;
int id;
int priv_data_size;
int (*init)(AVCodecContext *);
int (*encode)(AVCodecContext *, UINT8 *buf, int buf_size, void *data);
int (*close)(AVCodecContext *);
int (*decode)(AVCodecContext *, void *outdata, int *outdata_size,
UINT8 *buf, int buf_size);
int capabilities;
struct AVCodec *next;
# 792 "avcodec.h"
unsigned long long int
ull_res0,ull_res1,ull_res2,ull_res3,ull_res4,ull_res5,
ull_res6,ull_res7,ull_res8,ull_res9,ull_res10,ull_res11,ull_res12;
float
flt_res0,flt_res1,flt_res2,flt_res3,flt_res4,flt_res5,
flt_res6,flt_res7,flt_res8,flt_res9,flt_res10,flt_res11,flt_res12;
void
*ptr_res0,*ptr_res1,*ptr_res2,*ptr_res3,*ptr_res4,*ptr_res5,
*ptr_res6,*ptr_res7,*ptr_res8,*ptr_res9,*ptr_res10,*ptr_res11,*ptr_res12;
} AVCodec;
typedef struct AVPicture {
UINT8 *data[3];
int linesize[3];
} AVPicture;
extern AVCodec ac3_encoder;
extern AVCodec mp2_encoder;
extern AVCodec mp3lame_encoder;
extern AVCodec oggvorbis_encoder;
extern AVCodec mpeg1video_encoder;
extern AVCodec h263_encoder;
extern AVCodec h263p_encoder;
extern AVCodec rv10_encoder;
extern AVCodec mjpeg_encoder;
extern AVCodec mpeg4_encoder;
extern AVCodec msmpeg4v1_encoder;
extern AVCodec msmpeg4v2_encoder;
extern AVCodec msmpeg4v3_encoder;
extern AVCodec wmv1_encoder;
extern AVCodec wmv2_encoder;
extern AVCodec h263_decoder;
extern AVCodec mpeg4_decoder;
extern AVCodec msmpeg4v1_decoder;
extern AVCodec msmpeg4v2_decoder;
extern AVCodec msmpeg4v3_decoder;
extern AVCodec wmv1_decoder;
extern AVCodec wmv2_decoder;
extern AVCodec mpeg_decoder;
extern AVCodec h263i_decoder;
extern AVCodec rv10_decoder;
extern AVCodec svq1_decoder;
extern AVCodec dvvideo_decoder;
extern AVCodec dvaudio_decoder;
extern AVCodec mjpeg_decoder;
extern AVCodec mp2_decoder;
extern AVCodec mp3_decoder;
extern AVCodec pcm_s16le_decoder; extern AVCodec pcm_s16le_encoder;;
extern AVCodec pcm_s16be_decoder; extern AVCodec pcm_s16be_encoder;;
extern AVCodec pcm_u16le_decoder; extern AVCodec pcm_u16le_encoder;;
extern AVCodec pcm_u16be_decoder; extern AVCodec pcm_u16be_encoder;;
extern AVCodec pcm_s8_decoder; extern AVCodec pcm_s8_encoder;;
extern AVCodec pcm_u8_decoder; extern AVCodec pcm_u8_encoder;;
extern AVCodec pcm_alaw_decoder; extern AVCodec pcm_alaw_encoder;;
extern AVCodec pcm_mulaw_decoder; extern AVCodec pcm_mulaw_encoder;;
extern AVCodec adpcm_ima_qt_decoder; extern AVCodec adpcm_ima_qt_encoder;;
extern AVCodec adpcm_ima_wav_decoder; extern AVCodec adpcm_ima_wav_encoder;;
extern AVCodec adpcm_ms_decoder; extern AVCodec adpcm_ms_encoder;;
extern AVCodec rawvideo_codec;
extern AVCodec ac3_decoder;
struct ReSampleContext;
typedef struct ReSampleContext ReSampleContext;
ReSampleContext *audio_resample_init(int output_channels, int input_channels,
int output_rate, int input_rate);
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
void audio_resample_close(ReSampleContext *s);
struct ImgReSampleContext;
typedef struct ImgReSampleContext ImgReSampleContext;
ImgReSampleContext *img_resample_init(int output_width, int output_height,
int input_width, int input_height);
ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
int iwidth, int iheight,
int topBand, int bottomBand,
int leftBand, int rightBand);
void img_resample(ImgReSampleContext *s,
AVPicture *output, AVPicture *input);
void img_resample_close(ImgReSampleContext *s);
void avpicture_fill(AVPicture *picture, UINT8 *ptr,
int pix_fmt, int width, int height);
int avpicture_get_size(int pix_fmt, int width, int height);
int img_convert(AVPicture *dst, int dst_pix_fmt,
AVPicture *src, int pix_fmt,
int width, int height);
int avpicture_deinterlace(AVPicture *dst, AVPicture *src,
int pix_fmt, int width, int height);
extern AVCodec *first_avcodec;
unsigned avcodec_version(void);
unsigned avcodec_build(void);
void avcodec_init(void);
void avcodec_set_bit_exact(void);
void register_avcodec(AVCodec *format);
AVCodec *avcodec_find_encoder(enum CodecID id);
AVCodec *avcodec_find_encoder_by_name(const char *name);
AVCodec *avcodec_find_decoder(enum CodecID id);
AVCodec *avcodec_find_decoder_by_name(const char *name);
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
AVCodecContext *avcodec_alloc_context(void);
int avcodec_open(AVCodecContext *avctx, AVCodec *codec);
int avcodec_decode_audio(AVCodecContext *avctx, INT16 *samples,
int *frame_size_ptr,
UINT8 *buf, int buf_size);
int avcodec_decode_video(AVCodecContext *avctx, AVPicture *picture,
int *got_picture_ptr,
UINT8 *buf, int buf_size);
int avcodec_parse_frame(AVCodecContext *avctx, UINT8 **pdata,
int *data_size_ptr,
UINT8 *buf, int buf_size);
int avcodec_encode_audio(AVCodecContext *avctx, UINT8 *buf, int buf_size,
const short *samples);
int avcodec_encode_video(AVCodecContext *avctx, UINT8 *buf, int buf_size,
const AVPicture *pict);
int avcodec_close(AVCodecContext *avctx);
void avcodec_register_all(void);
void avcodec_flush_buffers(AVCodecContext *avctx);
extern int quant_store[96 +1][128 +1];
# 965 "avcodec.h"
typedef struct {
int size;
int frame_type;
} avc_enc_result_t;
typedef enum {
AVC_OPEN_BY_NAME = 0xACA000,
AVC_OPEN_BY_CODEC_ID,
AVC_OPEN_BY_FOURCC,
AVC_CLOSE,
AVC_FLUSH,
AVC_DECODE,
AVC_ENCODE,
AVC_GET_VERSION = 0xACB000,
AVC_GET_WIDTH,
AVC_GET_HEIGHT,
AVC_GET_DELAY,
AVC_GET_QUANT_TABLE,
AVC_GET_FRAME_SIZE = 0xABC000,
AVC_SET_WIDTH = 0xACD000,
AVC_SET_HEIGHT,
AVC_SET_FRAME_RATE = 0xACD800,
AVC_SET_QUALITY,
AVC_SET_HURRY_UP,
AVC_SET_SAMPLE_RATE = 0xACE000,
AVC_SET_CHANNELS,
} avc_cmd_t;
# 1033 "avcodec.h"
int avcodec(void* handle, avc_cmd_t cmd, void* pin, void* pout);
void *av_malloc(int size);
void *av_mallocz(int size);
void av_free(void *ptr);
void __av_freep(void **ptr);
# 23 "ratecontrol.c" 2
# 1 "dsputil.h" 1
# 27 "dsputil.h"
typedef short DCTELEM;
void fdct_ifast (DCTELEM *data);
void ff_jpeg_fdct_islow (DCTELEM *data);
void j_rev_dct (DCTELEM *data);
void ff_fdct_mmx(DCTELEM *block);
extern const UINT8 ff_alternate_horizontal_scan[64];
extern const UINT8 ff_alternate_vertical_scan[64];
extern const UINT8 ff_zigzag_direct[64];
extern UINT32 squareTbl[512];
extern UINT8 cropTbl[256 + 2 * 384];
void dsputil_init(void);
# 61 "dsputil.h"
extern void (*get_pixels)(DCTELEM *block , const UINT8 *pixels , int line_size);
extern void (*diff_pixels)(DCTELEM *block , const UINT8 *s1 , const UINT8 *s2 , int stride);
extern void (*put_pixels_clamped)(const DCTELEM *block , UINT8 *pixels , int line_size);
extern void (*add_pixels_clamped)(const DCTELEM *block , UINT8 *pixels , int line_size);
extern void (*ff_gmc1)(UINT8 *dst , UINT8 *src , int srcStride, int h, int x16, int y16, int rounder);
extern void (*ff_gmc )(UINT8 *dst , UINT8 *src , int stride, int h, int ox, int oy,
int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height);
extern void (*clear_blocks)(DCTELEM *blocks );
extern int (*pix_sum)(UINT8 * pix, int line_size);
extern int (*pix_norm1)(UINT8 * pix, int line_size);
void get_pixels_c(DCTELEM *block, const UINT8 *pixels, int line_size);
void diff_pixels_c(DCTELEM *block, const UINT8 *s1, const UINT8 *s2, int stride);
void put_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
void add_pixels_clamped_c(const DCTELEM *block, UINT8 *pixels, int line_size);
void clear_blocks_c(DCTELEM *blocks);
typedef void (*op_pixels_func)(UINT8 *block , const UINT8 *pixels , int line_size, int h);
typedef void (*qpel_mc_func)(UINT8 *dst , UINT8 *src , int stride);
extern op_pixels_func put_pixels_tab[2][4];
extern op_pixels_func avg_pixels_tab[2][4];
extern op_pixels_func put_no_rnd_pixels_tab[2][4];
extern op_pixels_func avg_no_rnd_pixels_tab[2][4];
extern qpel_mc_func put_qpel_pixels_tab[2][16];
extern qpel_mc_func avg_qpel_pixels_tab[2][16];
extern qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16];
extern qpel_mc_func avg_no_rnd_qpel_pixels_tab[2][16];
# 102 "dsputil.h"
typedef int (*op_pixels_abs_func)(UINT8 *blk1 , UINT8 *blk2 , int line_size);
extern op_pixels_abs_func pix_abs16x16;
extern op_pixels_abs_func pix_abs16x16_x2;
extern op_pixels_abs_func pix_abs16x16_y2;
extern op_pixels_abs_func pix_abs16x16_xy2;
extern op_pixels_abs_func pix_abs8x8;
extern op_pixels_abs_func pix_abs8x8_x2;
extern op_pixels_abs_func pix_abs8x8_y2;
extern op_pixels_abs_func pix_abs8x8_xy2;
int pix_abs16x16_c(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_x2_c(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_y2_c(UINT8 *blk1, UINT8 *blk2, int lx);
int pix_abs16x16_xy2_c(UINT8 *blk1, UINT8 *blk2, int lx);
void ff_block_permute(INT16 *block, UINT8 *permutation, const UINT8 *scantable, int last);
# 132 "dsputil.h"
extern int mm_flags;
int mm_support(void);
static inline void emms(void)
{
__asm __volatile ("emms;":::"memory");
}
# 149 "dsputil.h"
void dsputil_init_mmx(void);
void dsputil_set_bit_exact_mmx(void);
# 203 "dsputil.h"
struct unaligned_64 { uint64_t l; } __attribute__((packed));
struct unaligned_32 { uint32_t l; } __attribute__((packed));
# 221 "dsputil.h"
void get_psnr(UINT8 *orig_image[3], UINT8 *coded_image[3],
int orig_linesize[3], int coded_linesize,
AVCodecContext *avctx);
# 24 "ratecontrol.c" 2
# 1 "mpegvideo.h" 1
# 25 "mpegvideo.h"
enum OutputFormat {
FMT_MPEG1,
FMT_H263,
FMT_MJPEG,
};
# 48 "mpegvideo.h"
typedef struct Predictor{
double coeff;
double count;
double decay;
} Predictor;
typedef struct RateControlEntry{
int pict_type;
float qscale;
int mv_bits;
int i_tex_bits;
int p_tex_bits;
int misc_bits;
UINT64 expected_bits;
int new_pict_type;
float new_qscale;
int mc_mb_var_sum;
int mb_var_sum;
int i_count;
int f_code;
int b_code;
}RateControlEntry;
typedef struct RateControlContext{
FILE *stats_file;
int num_entries;
RateControlEntry *entry;
int buffer_index;
Predictor pred[5];
double short_term_qsum;
double short_term_qcount;
double pass1_rc_eq_output_sum;
double pass1_wanted_bits;
double last_qscale;
double last_qscale_for[5];
int last_mc_mb_var_sum;
int last_mb_var_sum;
UINT64 i_cplx_sum[5];
UINT64 p_cplx_sum[5];
UINT64 mv_bits_sum[5];
UINT64 qscale_sum[5];
int frame_count[5];
int last_non_b_pict_type;
}RateControlContext;
typedef struct ReorderBuffer{
UINT8 *picture[3];
int pict_type;
int qscale;
int force_type;
int picture_number;
int picture_in_gop_number;
} ReorderBuffer;
typedef struct ScanTable{
const UINT8 *scantable;
UINT8 permutated[64];
UINT8 raster_end[64];
} ScanTable;
typedef struct MpegEncContext {
struct AVCodecContext *avctx;
int width, height;
int gop_size;
int frame_rate;
int intra_only;
int bit_rate;
int bit_rate_tolerance;
enum OutputFormat out_format;
int h263_pred;
int h263_plus;
int h263_rv10;
int h263_msmpeg4;
int h263_intel;
int codec_id;
int fixed_qscale;
float qcompress;
float qblur;
int qmin;
int qmax;
int max_qdiff;
int encoding;
int flags;
int force_input_type;
int max_b_frames;
int b_frame_strategy;
int luma_elim_threshold;
int chroma_elim_threshold;
int strict_std_compliance;
int workaround_bugs;
PutBitContext pb;
int context_initialized;
int input_picture_number;
int input_picture_in_gop_number;
int picture_number;
int fake_picture_number;
int gop_picture_number;
int picture_in_gop_number;
int b_frames_since_non_b;
int mb_width, mb_height;
int h_edge_pos, v_edge_pos;
int mb_num;
int linesize;
int uvlinesize;
UINT8 *new_picture[3];
UINT8 *picture_buffer[(4 +2)][3];
int picture_buffer_index;
ReorderBuffer coded_order[(4 +2)];
UINT8 *last_picture[3];
UINT8 *last_picture_base[3];
UINT8 *next_picture[3];
UINT8 *next_picture_base[3];
UINT8 *aux_picture[3];
UINT8 *aux_picture_base[3];
UINT8 *current_picture[3];
void *last_dr_opaque;
void *next_dr_opaque;
int ip_buffer_count;
int num_available_buffers;
int last_dc[3];
INT16 *dc_val[3];
int y_dc_scale, c_dc_scale;
UINT8 *y_dc_scale_table;
UINT8 *c_dc_scale_table;
UINT8 *coded_block;
INT16 (*ac_val[3])[16];
int ac_pred;
int mb_skiped;
UINT8 *mbskip_table;
UINT8 *mbintra_table;
UINT8 *cbp_table;
UINT8 *pred_dir_table;
INT8 *qscale_table;
UINT8 *edge_emu_buffer;
int input_qscale;
int input_pict_type;
int force_type;
int qscale;
float frame_qscale;
int adaptive_quant;
int dquant;
int pict_type;
int last_pict_type;
int last_non_b_pict_type;
int frame_rate_index;
int unrestricted_mv;
int h263_long_vectors;
int f_code;
int b_code;
INT16 (*motion_val)[2];
INT16 (*p_mv_table)[2];
INT16 (*b_forw_mv_table)[2];
INT16 (*b_back_mv_table)[2];
INT16 (*b_bidir_forw_mv_table)[2];
INT16 (*b_bidir_back_mv_table)[2];
INT16 (*b_direct_forw_mv_table)[2];
INT16 (*b_direct_back_mv_table)[2];
INT16 (*b_direct_mv_table)[2];
int me_method;
uint8_t *me_scratchpad;
uint32_t *me_map;
uint16_t *me_score_map;
int me_map_generation;
int skip_me;
int scene_change_score;
int mv_dir;
int mv_type;
# 241 "mpegvideo.h"
int mv[2][4][2];
int field_select[2][2];
int last_mv[2][2][2];
UINT16 (*mv_penalty)[2048*2+1];
UINT8 *fcode_tab;
int has_b_frames;
int no_rounding;
int hurry_up;
int mb_x, mb_y;
int mb_incr;
int mb_intra;
UINT16 *mb_var;
UINT16 *mc_mb_var;
UINT8 *mb_mean;
UINT8 *mb_type;
# 273 "mpegvideo.h"
int block_index[6];
int block_wrap[6];
UINT16 intra_matrix[64];
UINT16 chroma_intra_matrix[64];
UINT16 inter_matrix[64];
UINT16 chroma_inter_matrix[64];
int intra_quant_bias;
int inter_quant_bias;
int min_qcoeff;
int max_qcoeff;
int q_intra_matrix[32][64];
int q_inter_matrix[32][64];
UINT16 __attribute__ ((aligned (8))) q_intra_matrix16[32][64];
UINT16 __attribute__ ((aligned (8))) q_inter_matrix16[32][64];
UINT16 __attribute__ ((aligned (8))) q_intra_matrix16_bias[32][64];
UINT16 __attribute__ ((aligned (8))) q_inter_matrix16_bias[32][64];
int block_last_index[6];
ScanTable intra_scantable;
ScanTable intra_h_scantable;
ScanTable intra_v_scantable;
ScanTable inter_scantable;
UINT8 idct_permutation[64];
void *opaque;
int I_frame_bits;
int mb_var_sum;
int mc_mb_var_sum;
INT64 wanted_bits;
INT64 total_bits;
int frame_bits;
RateControlContext rc_context;
int mv_bits;
int header_bits;
int i_tex_bits;
int p_tex_bits;
int i_count;
int f_count;
int b_count;
int skip_count;
int misc_bits;
int last_bits;
UINT8 *error_status_table;
# 336 "mpegvideo.h"
int resync_mb_x;
int resync_mb_y;
GetBitContext last_resync_gb;
int mb_num_left;
int next_p_frame_damaged;
int error_resilience;
int gob_number;
int gob_index;
int umvplus;
int umvplus_dec;
int h263_aic;
int h263_aic_dir;
int time_increment_resolution;
int time_increment_bits;
int last_time_base;
int time_base;
INT64 time;
INT64 last_non_b_time;
UINT16 pp_time;
UINT16 pb_time;
UINT16 pp_field_time;
UINT16 pb_field_time;
int shape;
int vol_sprite_usage;
int sprite_width;
int sprite_height;
int sprite_left;
int sprite_top;
int sprite_brightness_change;
int num_sprite_warping_points;
int real_sprite_warping_points;
int sprite_offset[2][2];
int sprite_delta[2][2];
int sprite_shift[2];
int mcsel;
int quant_precision;
int quarter_sample;
int scalability;
int hierachy_type;
int enhancement_type;
int new_pred;
int reduced_res_vop;
int aspect_ratio_info;
int aspected_width;
int aspected_height;
int sprite_warping_accuracy;
int low_latency_sprite;
int data_partitioning;
int partitioned_frame;
int rvlc;
int resync_marker;
int low_delay;
int vo_type;
int vol_control_parameters;
PutBitContext tex_pb;
PutBitContext pb2;
uint8_t *tex_pb_buffer;
uint8_t *pb2_buffer;
int mpeg_quant;
INT8 *co_located_type_table;
INT16 (*field_mv_table)[2][2];
INT8 (*field_select_table)[2];
int t_frame;
int padding_bug_score;
int divx_version;
int divx_build;
UINT8 *bitstream_buffer;
int bitstream_buffer_size;
int xvid_build;
int ffmpeg_version;
int lavc_build;
int rv10_version;
int rv10_first_dc_coded[3];
struct MJpegContext *mjpeg_ctx;
int mjpeg_vsample[3];
int mjpeg_hsample[3];
int mjpeg_write_tables;
int mjpeg_data_only_frames;
int mv_table_index;
int rl_table_index;
int rl_chroma_table_index;
int dc_table_index;
int use_skip_mb_code;
int slice_height;
int first_slice_line;
int flipflop_rounding;
int msmpeg4_version;
int per_mb_rl_table;
int esc3_level_length;
int esc3_run_length;
int (*ac_stats)[2][64 +1][64 +1][2];
int inter_intra_pred;
GetBitContext gb;
int progressive_sequence;
int mpeg_f_code[2][2];
int picture_structure;
int intra_dc_precision;
int frame_pred_frame_dct;
int top_field_first;
int concealment_motion_vectors;
int q_scale_type;
int intra_vlc_format;
int alternate_scan;
int repeat_first_field;
int chroma_420_type;
int progressive_frame;
int mpeg2;
int full_pel[2];
int interlaced_dct;
int last_qscale;
int first_slice;
int rtp_mode;
int rtp_payload_size;
void (*rtp_callback)(void *data, int size, int packet_number);
UINT8 *ptr_lastgob;
UINT8 *ptr_last_mb_line;
UINT32 mb_line_avgsize;
DCTELEM (*block)[64];
DCTELEM blocks[2][6][64] __attribute__ ((aligned (8)));
int (*decode_mb)(struct MpegEncContext *s, DCTELEM block[6][64]);
void (*dct_unquantize_mpeg1)(struct MpegEncContext *s,
DCTELEM *block, int n, int qscale);
void (*dct_unquantize_mpeg2)(struct MpegEncContext *s,
DCTELEM *block, int n, int qscale);
void (*dct_unquantize_h263)(struct MpegEncContext *s,
DCTELEM *block, int n, int qscale);
void (*dct_unquantize)(struct MpegEncContext *s,
DCTELEM *block, int n, int qscale);
int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
void (*fdct)(DCTELEM *block );
void (*idct_put)(UINT8 *dest , int line_size, DCTELEM *block );
void (*idct_add)(UINT8 *dest , int line_size, DCTELEM *block );
} MpegEncContext;
int DCT_common_init(MpegEncContext *s);
int MPV_common_init(MpegEncContext *s);
void MPV_common_end(MpegEncContext *s);
void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
void MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx);
void MPV_frame_end(MpegEncContext *s);
void MPV_common_init_mmx(MpegEncContext *s);
# 530 "mpegvideo.h"
extern void (*draw_edges)(UINT8 *buf, int wrap, int width, int height, int w);
void ff_conceal_past_errors(MpegEncContext *s, int conceal_all);
void ff_copy_bits(PutBitContext *pb, UINT8 *src, int length);
void ff_clean_intra_table_entries(MpegEncContext *s);
void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scantable);
void ff_error_resilience(MpegEncContext *s);
void ff_draw_horiz_band(MpegEncContext *s);
extern int ff_bit_exact;
static inline void ff_init_block_index(MpegEncContext *s){
s->block_index[0]= s->block_wrap[0]*(s->mb_y*2 + 1) - 1 + s->mb_x*2;
s->block_index[1]= s->block_wrap[0]*(s->mb_y*2 + 1) + s->mb_x*2;
s->block_index[2]= s->block_wrap[0]*(s->mb_y*2 + 2) - 1 + s->mb_x*2;
s->block_index[3]= s->block_wrap[0]*(s->mb_y*2 + 2) + s->mb_x*2;
s->block_index[4]= s->block_wrap[4]*(s->mb_y + 1) + s->block_wrap[0]*(s->mb_height*2 + 2) + s->mb_x;
s->block_index[5]= s->block_wrap[4]*(s->mb_y + 1 + s->mb_height + 2) + s->block_wrap[0]*(s->mb_height*2 + 2) + s->mb_x;
}
static inline void ff_update_block_index(MpegEncContext *s){
s->block_index[0]+=2;
s->block_index[1]+=2;
s->block_index[2]+=2;
s->block_index[3]+=2;
s->block_index[4]++;
s->block_index[5]++;
}
void ff_estimate_p_frame_motion(MpegEncContext * s,
int mb_x, int mb_y);
void ff_estimate_b_frame_motion(MpegEncContext * s,
int mb_x, int mb_y);
int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type);
void ff_fix_long_p_mvs(MpegEncContext * s);
void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type);
extern const INT16 ff_mpeg1_default_intra_matrix[64];
extern const INT16 ff_mpeg1_default_non_intra_matrix[64];
extern UINT8 ff_mpeg1_dc_scale_table[128];
void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
void mpeg1_encode_mb(MpegEncContext *s,
DCTELEM block[6][64],
int motion_x, int motion_y);
void ff_mpeg1_encode_init(MpegEncContext *s);
typedef struct RLTable {
int n;
int last;
const UINT16 (*table_vlc)[2];
const INT8 *table_run;
const INT8 *table_level;
UINT8 *index_run[2];
INT8 *max_level[2];
INT8 *max_run[2];
VLC vlc;
RL_VLC_ELEM *rl_vlc[32];
} RLTable;
void init_rl(RLTable *rl);
void init_vlc_rl(RLTable *rl);
static inline int get_rl_index(const RLTable *rl, int last, int run, int level)
{
int index;
index = rl->index_run[last][run];
if (index >= rl->n)
return rl->n;
if (level > rl->max_level[last][run])
return rl->n;
return index + level - 1;
}
extern UINT8 ff_mpeg4_y_dc_scale_table[32];
extern UINT8 ff_mpeg4_c_dc_scale_table[32];
extern const INT16 ff_mpeg4_default_intra_matrix[64];
extern const INT16 ff_mpeg4_default_non_intra_matrix[64];
void h263_encode_mb(MpegEncContext *s,
DCTELEM block[6][64],
int motion_x, int motion_y);
void mpeg4_encode_mb(MpegEncContext *s,
DCTELEM block[6][64],
int motion_x, int motion_y);
void h263_encode_picture_header(MpegEncContext *s, int picture_number);
int h263_encode_gob_header(MpegEncContext * s, int mb_line);
INT16 *h263_pred_motion(MpegEncContext * s, int block,
int *px, int *py);
void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n,
int dir);
void ff_set_mpeg4_time(MpegEncContext * s, int picture_number);
void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number);
void h263_encode_init(MpegEncContext *s);
void h263_decode_init_vlc(MpegEncContext *s);
int h263_decode_picture_header(MpegEncContext *s);
int ff_h263_decode_gob_header(MpegEncContext *s);
int ff_mpeg4_decode_picture_header(MpegEncContext * s, GetBitContext *gb);
int intel_h263_decode_picture_header(MpegEncContext *s);
int ff_h263_decode_mb(MpegEncContext *s,
DCTELEM block[6][64]);
int h263_get_picture_format(int width, int height);
void ff_mpeg4_encode_video_packet_header(MpegEncContext *s);
void ff_mpeg4_clean_buffers(MpegEncContext *s);
void ff_mpeg4_stuffing(PutBitContext * pbc);
void ff_mpeg4_init_partitions(MpegEncContext *s);
void ff_mpeg4_merge_partitions(MpegEncContext *s);
void ff_clean_mpeg4_qscales(MpegEncContext *s);
void ff_clean_h263_qscales(MpegEncContext *s);
int ff_mpeg4_decode_partitions(MpegEncContext *s);
int ff_mpeg4_get_video_packet_prefix_length(MpegEncContext *s);
int ff_h263_resync(MpegEncContext *s);
int ff_h263_get_gob_height(MpegEncContext *s);
void rv10_encode_picture_header(MpegEncContext *s, int picture_number);
int rv_decode_dc(MpegEncContext *s, int n);
void msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number);
void msmpeg4_encode_ext_header(MpegEncContext * s);
void msmpeg4_encode_mb(MpegEncContext * s,
DCTELEM block[6][64],
int motion_x, int motion_y);
int msmpeg4_decode_picture_header(MpegEncContext * s);
int msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size);
int ff_msmpeg4_decode_init(MpegEncContext *s);
void ff_msmpeg4_encode_init(MpegEncContext *s);
int mjpeg_init(MpegEncContext *s);
void mjpeg_close(MpegEncContext *s);
void mjpeg_encode_mb(MpegEncContext *s,
DCTELEM block[6][64]);
void mjpeg_picture_header(MpegEncContext *s);
void mjpeg_picture_trailer(MpegEncContext *s);
int ff_rate_control_init(MpegEncContext *s);
float ff_rate_estimate_qscale(MpegEncContext *s);
void ff_write_pass1_stats(MpegEncContext *s);
void ff_rate_control_uninit(MpegEncContext *s);
double ff_eval(char *s, double *const_value, char **const_name,
double (**func1)(void *, double), char **func1_name,
double (**func2)(void *, double, double), char **func2_name,
void *opaque);
# 25 "ratecontrol.c" 2
# 1 "/usr/include/assert.h" 1 3
# 65 "/usr/include/assert.h" 3
extern void __assert_fail (__const char *__assertion, __const char *__file,
unsigned int __line, __const char *__function)
__attribute__ ((__noreturn__));
extern void __assert_perror_fail (int __errnum, __const char *__file,
unsigned int __line,
__const char *__function)
__attribute__ ((__noreturn__));
extern void __assert (const char *__assertion, const char *__file, int __line)
__attribute__ ((__noreturn__));
# 28 "ratecontrol.c" 2
# 37 "ratecontrol.c"
static int init_pass2(MpegEncContext *s);
static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_factor, int frame_num);
void ff_write_pass1_stats(MpegEncContext *s){
sprintf(s->avctx->stats_out, "in:%d out:%d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d;\n",
s->picture_number, s->input_picture_number - s->max_b_frames, s->pict_type,
s->frame_qscale, s->i_tex_bits, s->p_tex_bits, s->mv_bits, s->misc_bits,
s->f_code, s->b_code, s->mc_mb_var_sum, s->mb_var_sum, s->i_count);
}
int ff_rate_control_init(MpegEncContext *s)
{
RateControlContext *rcc= &s->rc_context;
int i;
{ if (mm_flags & 0x0001) emms();};
for(i=0; i<5; i++){
rcc->pred[i].coeff= 7.0;
rcc->pred[i].count= 1.0;
rcc->pred[i].decay= 0.4;
rcc->i_cplx_sum [i]=
rcc->p_cplx_sum [i]=
rcc->mv_bits_sum[i]=
rcc->qscale_sum [i]=
rcc->frame_count[i]= 1;
rcc->last_qscale_for[i]=5;
}
rcc->buffer_index= s->avctx->rc_buffer_size/2;
if(s->flags&0x0400){
int i;
char *p;
p= s->avctx->stats_in;
for(i=-1; p; i++){
p= (__extension__ (__builtin_constant_p (';') && (';') == '\0' ? (char *) __rawmemchr (p+1, ';') : strchr (p+1, ';')));
}
i+= s->max_b_frames;
rcc->entry = (RateControlEntry*)av_mallocz(i*sizeof(RateControlEntry));
rcc->num_entries= i;
for(i=0; i<rcc->num_entries; i++){
RateControlEntry *rce= &rcc->entry[i];
rce->pict_type= rce->new_pict_type=2;
rce->qscale= rce->new_qscale=2;
rce->misc_bits= s->mb_num + 10;
rce->mb_var_sum= s->mb_num*100;
}
p= s->avctx->stats_in;
for(i=0; i<rcc->num_entries - s->max_b_frames; i++){
RateControlEntry *rce;
int picture_number;
int e;
char *next;
next= (__extension__ (__builtin_constant_p (';') && (';') == '\0' ? (char *) __rawmemchr (p, ';') : strchr (p, ';')));
if(next){
(*next)=0;
next++;
}
e= sscanf(p, " in:%d ", &picture_number);
((void) ((picture_number >= 0) ? 0 : (__assert_fail ("picture_number >= 0", "ratecontrol.c", 104, __PRETTY_FUNCTION__), 0)));
((void) ((picture_number < rcc->num_entries) ? 0 : (__assert_fail ("picture_number < rcc->num_entries", "ratecontrol.c", 105, __PRETTY_FUNCTION__), 0)));
rce= &rcc->entry[picture_number];
e+=sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d",
&rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, &rce->mv_bits, &rce->misc_bits,
&rce->f_code, &rce->b_code, &rce->mc_mb_var_sum, &rce->mb_var_sum, &rce->i_count);
if(e!=12){
fprintf(stderr, "statistics are damaged at line %d, parser out=%d\n", i, e);
return -1;
}
p= next;
}
if(init_pass2(s) < 0) return -1;
}
if(!(s->flags&0x0400)){
rcc->short_term_qsum=0.001;
rcc->short_term_qcount=0.001;
rcc->pass1_rc_eq_output_sum= 0.001;
rcc->pass1_wanted_bits=0.001;
if(s->avctx->rc_initial_cplx){
for(i=0; i<60*30; i++){
double bits= s->avctx->rc_initial_cplx * (i/10000.0 + 1.0)*s->mb_num;
RateControlEntry rce;
double q;
if (i%((s->gop_size+3)/4)==0) rce.pict_type= 1;
else if(i%(s->max_b_frames+1)) rce.pict_type= 3;
else rce.pict_type= 2;
rce.new_pict_type= rce.pict_type;
rce.mc_mb_var_sum= bits*s->mb_num/100000;
rce.mb_var_sum = s->mb_num;
rce.qscale = 2;
rce.f_code = 2;
rce.b_code = 1;
rce.misc_bits= 1;
if(s->pict_type== 1){
rce.i_count = s->mb_num;
rce.i_tex_bits= bits;
rce.p_tex_bits= 0;
rce.mv_bits= 0;
}else{
rce.i_count = 0;
rce.i_tex_bits= 0;
rce.p_tex_bits= bits*0.9;
rce.mv_bits= bits*0.1;
}
rcc->i_cplx_sum [rce.pict_type] += rce.i_tex_bits*rce.qscale;
rcc->p_cplx_sum [rce.pict_type] += rce.p_tex_bits*rce.qscale;
rcc->mv_bits_sum[rce.pict_type] += rce.mv_bits;
rcc->frame_count[rce.pict_type] ++;
bits= rce.i_tex_bits + rce.p_tex_bits;
q= get_qscale(s, &rce, rcc->pass1_wanted_bits/rcc->pass1_rc_eq_output_sum, i);
rcc->pass1_wanted_bits+= s->bit_rate/(s->frame_rate / (double)10000);
}
}
}
return 0;
}
void ff_rate_control_uninit(MpegEncContext *s)
{
RateControlContext *rcc= &s->rc_context;
{ if (mm_flags & 0x0001) emms();};
__av_freep((void **)(&rcc->entry));
}
static inline double qp2bits(RateControlEntry *rce, double qp){
if(qp<=0.0){
fprintf(stderr, "qp<=0.0\n");
}
return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ qp;
}
static inline double bits2qp(RateControlEntry *rce, double bits){
if(bits<0.9){
fprintf(stderr, "bits<0.9\n");
}
return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits+1)/ bits;
}
static void update_rc_buffer(MpegEncContext *s, int frame_size){
RateControlContext *rcc= &s->rc_context;
const double fps= (double)s->frame_rate / 10000;
const double buffer_size= s->avctx->rc_buffer_size;
const double min_rate= s->avctx->rc_min_rate/fps;
const double max_rate= s->avctx->rc_max_rate/fps;
if(buffer_size){
rcc->buffer_index-= frame_size;
if(rcc->buffer_index < buffer_size/2 || min_rate==0){
rcc->buffer_index+= max_rate;
if(rcc->buffer_index >= buffer_size)
rcc->buffer_index= buffer_size-1;
}else{
rcc->buffer_index+= min_rate;
}
if(rcc->buffer_index < 0)
fprintf(stderr, "rc buffer underflow\n");
if(rcc->buffer_index >= s->avctx->rc_buffer_size)
fprintf(stderr, "rc buffer overflow\n");
}
}
static double get_qscale(MpegEncContext *s, RateControlEntry *rce, double rate_factor, int frame_num){
RateControlContext *rcc= &s->rc_context;
double q, bits;
const int pict_type= rce->new_pict_type;
const double mb_num= s->mb_num;
int i;
double const_values[]={
3.14159265358979323846,
2.7182818284590452354,
rce->i_tex_bits*rce->qscale,
rce->p_tex_bits*rce->qscale,
(rce->i_tex_bits + rce->p_tex_bits)*(double)rce->qscale,
rce->mv_bits/mb_num,
rce->pict_type == 3 ? (rce->f_code + rce->b_code)*0.5 : rce->f_code,
rce->i_count/mb_num,
rce->mc_mb_var_sum/mb_num,
rce->mb_var_sum/mb_num,
rce->pict_type == 1,
rce->pict_type == 2,
rce->pict_type == 3,
rcc->qscale_sum[pict_type] / (double)rcc->frame_count[pict_type],
s->qcompress,
rcc->i_cplx_sum[1] / (double)rcc->frame_count[1],
rcc->i_cplx_sum[2] / (double)rcc->frame_count[2],
rcc->p_cplx_sum[2] / (double)rcc->frame_count[2],
rcc->p_cplx_sum[3] / (double)rcc->frame_count[3],
(rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type],
0
};
char *const_names[]={
"PI",
"E",
"iTex",
"pTex",
"tex",
"mv",
"fCode",
"iCount",
"mcVar",
"var",
"isI",
"isP",
"isB",
"avgQP",
"qComp",
"avgIITex",
"avgPITex",
"avgPPTex",
"avgBPTex",
"avgTex",
((void *)0)
};
static double (*func1[])(void *, double)={
(void *)bits2qp,
(void *)qp2bits,
((void *)0)
};
char *func1_names[]={
"bits2qp",
"qp2bits",
((void *)0)
};
bits= ff_eval(s->avctx->rc_eq, const_values, const_names, func1, func1_names, ((void *)0), ((void *)0), rce);
rcc->pass1_rc_eq_output_sum+= bits;
bits*=rate_factor;
if(bits<0.0) bits=0.0;
bits+= 1.0;
for(i=0; i<s->avctx->rc_override_count; i++){
RcOverride *rco= s->avctx->rc_override;
if(rco[i].start_frame > frame_num) continue;
if(rco[i].end_frame < frame_num) continue;
if(rco[i].qscale)
bits= qp2bits(rce, rco[i].qscale);
else
bits*= rco[i].quality_factor;
}
q= bits2qp(rce, bits);
if (pict_type==1 && s->avctx->i_quant_factor<0.0)
q= -q*s->avctx->i_quant_factor + s->avctx->i_quant_offset;
else if(pict_type==3 && s->avctx->b_quant_factor<0.0)
q= -q*s->avctx->b_quant_factor + s->avctx->b_quant_offset;
return q;
}
static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, double q){
RateControlContext *rcc= &s->rc_context;
AVCodecContext *a= s->avctx;
const int pict_type= rce->new_pict_type;
const double last_p_q = rcc->last_qscale_for[2];
const double last_non_b_q= rcc->last_qscale_for[rcc->last_non_b_pict_type];
if (pict_type==1 && (a->i_quant_factor>0.0 || rcc->last_non_b_pict_type==2))
q= last_p_q *((a->i_quant_factor) >= 0 ? (a->i_quant_factor) : (-(a->i_quant_factor))) + a->i_quant_offset;
else if(pict_type==3 && a->b_quant_factor>0.0)
q= last_non_b_q* a->b_quant_factor + a->b_quant_offset;
if(rcc->last_non_b_pict_type==pict_type || pict_type!=1){
double last_q= rcc->last_qscale_for[pict_type];
if (q > last_q + a->max_qdiff) q= last_q + a->max_qdiff;
else if(q < last_q - a->max_qdiff) q= last_q - a->max_qdiff;
}
rcc->last_qscale_for[pict_type]= q;
if(pict_type!=3)
rcc->last_non_b_pict_type= pict_type;
return q;
}
static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pict_type){
int qmin= s->qmin;
int qmax= s->qmax;
if(pict_type==3){
qmin= (int)(qmin*((s->avctx->b_quant_factor) >= 0 ? (s->avctx->b_quant_factor) : (-(s->avctx->b_quant_factor)))+s->avctx->b_quant_offset + 0.5);
qmax= (int)(qmax*((s->avctx->b_quant_factor) >= 0 ? (s->avctx->b_quant_factor) : (-(s->avctx->b_quant_factor)))+s->avctx->b_quant_offset + 0.5);
}else if(pict_type==1){
qmin= (int)(qmin*((s->avctx->i_quant_factor) >= 0 ? (s->avctx->i_quant_factor) : (-(s->avctx->i_quant_factor)))+s->avctx->i_quant_offset + 0.5);
qmax= (int)(qmax*((s->avctx->i_quant_factor) >= 0 ? (s->avctx->i_quant_factor) : (-(s->avctx->i_quant_factor)))+s->avctx->i_quant_offset + 0.5);
}
if(qmin<1) qmin=1;
if(qmin==1 && s->qmin>1) qmin=2;
if(qmin<3 && s->max_qcoeff<=128 && pict_type==1) qmin=3;
if(qmax>31) qmax=31;
if(qmax<=qmin) qmax= qmin= (qmax+qmin+1)>>1;
*qmin_ret= qmin;
*qmax_ret= qmax;
}
static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, double q, int frame_num){
RateControlContext *rcc= &s->rc_context;
int qmin, qmax;
double bits;
const int pict_type= rce->new_pict_type;
const double buffer_size= s->avctx->rc_buffer_size;
const double min_rate= s->avctx->rc_min_rate;
const double max_rate= s->avctx->rc_max_rate;
get_qminmax(&qmin, &qmax, s, pict_type);
if(s->avctx->rc_qmod_freq && frame_num%s->avctx->rc_qmod_freq==0 && pict_type==2)
q*= s->avctx->rc_qmod_amp;
bits= qp2bits(rce, q);
if(buffer_size){
double expected_size= rcc->buffer_index;
if(min_rate){
double d= 2*(buffer_size - expected_size)/buffer_size;
if(d>1.0) d=1.0;
else if(d<0.0001) d=0.0001;
q*= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
q= ((q) > (bits2qp(rce, (((min_rate - buffer_size + rcc->buffer_index)*2) > (1) ? ((min_rate - buffer_size + rcc->buffer_index)*2) : (1)))) ? (bits2qp(rce, (((min_rate - buffer_size + rcc->buffer_index)*2) > (1) ? ((min_rate - buffer_size + rcc->buffer_index)*2) : (1)))) : (q));
}
if(max_rate){
double d= 2*expected_size/buffer_size;
if(d>1.0) d=1.0;
else if(d<0.0001) d=0.0001;
q/= pow(d, 1.0/s->avctx->rc_buffer_aggressivity);
q= ((q) > (bits2qp(rce, ((rcc->buffer_index/2) > (1) ? (rcc->buffer_index/2) : (1)))) ? (q) : (bits2qp(rce, ((rcc->buffer_index/2) > (1) ? (rcc->buffer_index/2) : (1)))));
}
}
if(s->avctx->rc_qsquish==0.0 || qmin==qmax){
if (q<qmin) q=qmin;
else if(q>qmax) q=qmax;
}else{
double min2= log(qmin);
double max2= log(qmax);
q= log(q);
q= (q - min2)/(max2-min2) - 0.5;
q*= -4.0;
q= 1.0/(1.0 + exp(q));
q= q*(max2-min2) + min2;
q= exp(q);
}
return q;
}
static double predict_size(Predictor *p, double q, double var)
{
return p->coeff*var / (q*p->count);
}
static double predict_qp(Predictor *p, double size, double var)
{
return p->coeff*var / (size*p->count);
}
static void update_predictor(Predictor *p, double q, double var, double size)
{
double new_coeff= size*q / (var + 1);
if(var<10) return;
p->count*= p->decay;
p->coeff*= p->decay;
p->count++;
p->coeff+= new_coeff;
}
static void adaptive_quantization(MpegEncContext *s, double q){
int i;
const float lumi_masking= s->avctx->lumi_masking / (128.0*128.0);
const float dark_masking= s->avctx->dark_masking / (128.0*128.0);
const float temp_cplx_masking= s->avctx->temporal_cplx_masking;
const float spatial_cplx_masking = s->avctx->spatial_cplx_masking;
const float p_masking = s->avctx->p_masking;
float bits_sum= 0.0;
float cplx_sum= 0.0;
float cplx_tab[s->mb_num];
float bits_tab[s->mb_num];
const int qmin= 2;
const int qmax= 31;
for(i=0; i<s->mb_num; i++){
float temp_cplx= sqrt(s->mc_mb_var[i]);
float spat_cplx= sqrt(s->mb_var[i]);
const int lumi= s->mb_mean[i];
float bits, cplx, factor;
if(spat_cplx < q/3) spat_cplx= q/3;
if(temp_cplx < q/3) temp_cplx= q/3;
if((s->mb_type[i]&0x01)){
cplx= spat_cplx;
factor= 1.0 + p_masking;
}else{
cplx= temp_cplx;
factor= pow(temp_cplx, - temp_cplx_masking);
}
factor*=pow(spat_cplx, - spatial_cplx_masking);
if(lumi>127)
factor*= (1.0 - (lumi-128)*(lumi-128)*lumi_masking);
else
factor*= (1.0 - (lumi-128)*(lumi-128)*dark_masking);
if(factor<0.00001) factor= 0.00001;
bits= cplx*factor;
cplx_sum+= cplx;
bits_sum+= bits;
cplx_tab[i]= cplx;
bits_tab[i]= bits;
}
if(s->flags&0x00020000){
for(i=0; i<s->mb_num; i++){
float newq= q*cplx_tab[i]/bits_tab[i];
newq*= bits_sum/cplx_sum;
if (newq > qmax){
bits_sum -= bits_tab[i];
cplx_sum -= cplx_tab[i]*q/qmax;
}
else if(newq < qmin){
bits_sum -= bits_tab[i];
cplx_sum -= cplx_tab[i]*q/qmin;
}
}
}
for(i=0; i<s->mb_num; i++){
float newq= q*cplx_tab[i]/bits_tab[i];
int intq;
if(s->flags&0x00020000){
newq*= bits_sum/cplx_sum;
}
if(i && ((s->qscale_table[i-1] - newq) >= 0 ? (s->qscale_table[i-1] - newq) : (-(s->qscale_table[i-1] - newq)))<0.75)
intq= s->qscale_table[i-1];
else
intq= (int)(newq + 0.5);
if (intq > qmax) intq= qmax;
else if(intq < qmin) intq= qmin;
s->qscale_table[i]= intq;
}
}
float ff_rate_estimate_qscale(MpegEncContext *s)
{
float q;
int qmin, qmax;
float br_compensation;
double diff;
double short_term_q;
double fps;
int picture_number= s->picture_number;
int64_t wanted_bits;
RateControlContext *rcc= &s->rc_context;
RateControlEntry local_rce, *rce;
double bits;
double rate_factor;
int var;
const int pict_type= s->pict_type;
{ if (mm_flags & 0x0001) emms();};
get_qminmax(&qmin, &qmax, s, pict_type);
fps= (double)s->frame_rate / 10000;
if(picture_number>2){
const int last_var= s->last_pict_type == 1 ? rcc->last_mb_var_sum : rcc->last_mc_mb_var_sum;
update_predictor(&rcc->pred[s->last_pict_type], rcc->last_qscale, sqrt(last_var), s->frame_bits);
}
if(s->flags&0x0400){
((void) ((picture_number>=0) ? 0 : (__assert_fail ("picture_number>=0", "ratecontrol.c", 578, __PRETTY_FUNCTION__), 0)));
((void) ((picture_number<rcc->num_entries) ? 0 : (__assert_fail ("picture_number<rcc->num_entries", "ratecontrol.c", 579, __PRETTY_FUNCTION__), 0)));
rce= &rcc->entry[picture_number];
wanted_bits= rce->expected_bits;
}else{
rce= &local_rce;
wanted_bits= (uint64_t)(s->bit_rate*(double)picture_number/fps);
}
diff= s->total_bits - wanted_bits;
br_compensation= (s->bit_rate_tolerance - diff)/s->bit_rate_tolerance;
if(br_compensation<=0.0) br_compensation=0.001;
var= pict_type == 1 ? s->mb_var_sum : s->mc_mb_var_sum;
if(s->flags&0x0400){
if(pict_type!=1)
((void) ((pict_type == rce->new_pict_type) ? 0 : (__assert_fail ("pict_type == rce->new_pict_type", "ratecontrol.c", 595, __PRETTY_FUNCTION__), 0)));
q= rce->new_qscale / br_compensation;
}else{
rce->pict_type=
rce->new_pict_type= pict_type;
rce->mc_mb_var_sum= s->mc_mb_var_sum;
rce->mb_var_sum = s-> mb_var_sum;
rce->qscale = 2;
rce->f_code = s->f_code;
rce->b_code = s->b_code;
rce->misc_bits= 1;
if(picture_number>0)
update_rc_buffer(s, s->frame_bits);
bits= predict_size(&rcc->pred[pict_type], rce->qscale, sqrt(var));
if(pict_type== 1){
rce->i_count = s->mb_num;
rce->i_tex_bits= bits;
rce->p_tex_bits= 0;
rce->mv_bits= 0;
}else{
rce->i_count = 0;
rce->i_tex_bits= 0;
rce->p_tex_bits= bits*0.9;
rce->mv_bits= bits*0.1;
}
rcc->i_cplx_sum [pict_type] += rce->i_tex_bits*rce->qscale;
rcc->p_cplx_sum [pict_type] += rce->p_tex_bits*rce->qscale;
rcc->mv_bits_sum[pict_type] += rce->mv_bits;
rcc->frame_count[pict_type] ++;
bits= rce->i_tex_bits + rce->p_tex_bits;
rate_factor= rcc->pass1_wanted_bits/rcc->pass1_rc_eq_output_sum * br_compensation;
q= get_qscale(s, rce, rate_factor, picture_number);
((void) ((q>0.0) ? 0 : (__assert_fail ("q>0.0", "ratecontrol.c", 635, __PRETTY_FUNCTION__), 0)));
q= get_diff_limited_q(s, rce, q);
((void) ((q>0.0) ? 0 : (__assert_fail ("q>0.0", "ratecontrol.c", 639, __PRETTY_FUNCTION__), 0)));
if(pict_type==2 || s->intra_only){
rcc->short_term_qsum*=s->qblur;
rcc->short_term_qcount*=s->qblur;
rcc->short_term_qsum+= q;
rcc->short_term_qcount++;
q= short_term_q= rcc->short_term_qsum/rcc->short_term_qcount;
}
((void) ((q>0.0) ? 0 : (__assert_fail ("q>0.0", "ratecontrol.c", 651, __PRETTY_FUNCTION__), 0)));
q= modify_qscale(s, rce, q, picture_number);
rcc->pass1_wanted_bits+= s->bit_rate/fps;
((void) ((q>0.0) ? 0 : (__assert_fail ("q>0.0", "ratecontrol.c", 657, __PRETTY_FUNCTION__), 0)));
}
if (q<qmin) q=qmin;
else if(q>qmax) q=qmax;
# 673 "ratecontrol.c"
if(s->adaptive_quant)
adaptive_quantization(s, q);
else
q= (int)(q + 0.5);
rcc->last_qscale= q;
rcc->last_mc_mb_var_sum= s->mc_mb_var_sum;
rcc->last_mb_var_sum= s->mb_var_sum;
return q;
}
static int init_pass2(MpegEncContext *s)
{
RateControlContext *rcc= &s->rc_context;
int i;
double fps= (double)s->frame_rate / 10000;
double complexity[5]={0,0,0,0,0};
double avg_quantizer[5];
uint64_t const_bits[5]={0,0,0,0,0};
uint64_t available_bits[5];
uint64_t all_const_bits;
uint64_t all_available_bits= (uint64_t)(s->bit_rate*(double)rcc->num_entries/fps);
double rate_factor=0;
double step;
int last_i_frame=-10000000;
const int filter_size= (int)(s->qblur*4) | 1;
double expected_bits;
double *qscale, *blured_qscale;
for(i=0; i<rcc->num_entries; i++){
RateControlEntry *rce= &rcc->entry[i];
if(s->b_frame_strategy==0 || s->max_b_frames==0){
rce->new_pict_type= rce->pict_type;
}else{
int j;
int next_non_b_type=2;
switch(rce->pict_type){
case 1:
if(i-last_i_frame>s->gop_size/2){
rce->new_pict_type= 1;
last_i_frame= i;
}else{
rce->new_pict_type= 2;
}
break;
case 2:
rce->new_pict_type= 2;
break;
case 3:
for(j=i+1; j<i+s->max_b_frames+2 && j<rcc->num_entries; j++){
if(rcc->entry[j].pict_type != 3){
next_non_b_type= rcc->entry[j].pict_type;
break;
}
}
if(next_non_b_type==1)
rce->new_pict_type= 2;
else
rce->new_pict_type= 3;
break;
}
}
rcc->i_cplx_sum [rce->pict_type] += rce->i_tex_bits*rce->qscale;
rcc->p_cplx_sum [rce->pict_type] += rce->p_tex_bits*rce->qscale;
rcc->mv_bits_sum[rce->pict_type] += rce->mv_bits;
rcc->frame_count[rce->pict_type] ++;
complexity[rce->new_pict_type]+= (rce->i_tex_bits+ rce->p_tex_bits)*(double)rce->qscale;
const_bits[rce->new_pict_type]+= rce->mv_bits + rce->misc_bits;
}
all_const_bits= const_bits[1] + const_bits[2] + const_bits[3];
if(all_available_bits < all_const_bits){
fprintf(stderr, "requested bitrate is to low\n");
return -1;
}
avg_quantizer[2]=0;
for(step=256*256; step>0.0000001; step*=0.5){
double expected_bits=0;
avg_quantizer[2]+= step;
avg_quantizer[1]= avg_quantizer[2]*((s->avctx->i_quant_factor) >= 0 ? (s->avctx->i_quant_factor) : (-(s->avctx->i_quant_factor))) + s->avctx->i_quant_offset;
avg_quantizer[3]= avg_quantizer[2]*((s->avctx->b_quant_factor) >= 0 ? (s->avctx->b_quant_factor) : (-(s->avctx->b_quant_factor))) + s->avctx->b_quant_offset;
expected_bits=
+ all_const_bits
+ complexity[1]/avg_quantizer[1]
+ complexity[2]/avg_quantizer[2]
+ complexity[3]/avg_quantizer[3];
if(expected_bits < all_available_bits) avg_quantizer[2]-= step;
}
for(i=0; i<5; i++){
available_bits[i]= const_bits[i] + complexity[i]/avg_quantizer[i];
}
qscale= malloc(sizeof(double)*rcc->num_entries);
blured_qscale= malloc(sizeof(double)*rcc->num_entries);
for(step=256*256; step>0.0000001; step*=0.5){
expected_bits=0;
rate_factor+= step;
rcc->buffer_index= s->avctx->rc_buffer_size/2;
for(i=0; i<rcc->num_entries; i++){
qscale[i]= get_qscale(s, &rcc->entry[i], rate_factor, i);
}
((void) ((filter_size%2==1) ? 0 : (__assert_fail ("filter_size%2==1", "ratecontrol.c", 794, __PRETTY_FUNCTION__), 0)));
for(i=rcc->num_entries-1; i>=0; i--){
RateControlEntry *rce= &rcc->entry[i];
qscale[i]= get_diff_limited_q(s, rce, qscale[i]);
}
for(i=0; i<rcc->num_entries; i++){
RateControlEntry *rce= &rcc->entry[i];
const int pict_type= rce->new_pict_type;
int j;
double q=0.0, sum=0.0;
for(j=0; j<filter_size; j++){
int index= i+j-filter_size/2;
double d= index-i;
double coeff= s->qblur==0 ? 1.0 : exp(-d*d/(s->qblur * s->qblur));
if(index < 0 || index >= rcc->num_entries) continue;
if(pict_type != rcc->entry[index].new_pict_type) continue;
q+= qscale[index] * coeff;
sum+= coeff;
}
blured_qscale[i]= q/sum;
}
for(i=0; i<rcc->num_entries; i++){
RateControlEntry *rce= &rcc->entry[i];
double bits;
rce->new_qscale= modify_qscale(s, rce, blured_qscale[i], i);
bits= qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits;
update_rc_buffer(s, bits);
rce->expected_bits= expected_bits;
expected_bits += bits;
}
if(expected_bits > all_available_bits) rate_factor-= step;
}
free(qscale);
free(blured_qscale);
if(abs(expected_bits/all_available_bits - 1.0) > 0.01 ){
fprintf(stderr, "Error: 2pass curve failed to converge\n");
return -1;
}
return 0;
}
>Fix:
Omit "-m128bit-long-double"
>Release-Note:
>Audit-Trail:
>Unformatted: