Fixed Visual C++ release build for Visual C++ 2005
* Some math functions become intrinsic in release mode, so we need to convert all the math functions into SDL math functions, like we did with the stdlib functions. * Constant initializers of 8-bit values become calls to memset() in release mode, but memset() itself is an intrinsic when explicitly called. So we'll just explicitly call memset() in those cases. --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403474
This commit is contained in:
parent
44fa7675c8
commit
e32916c7f0
9 changed files with 227 additions and 43 deletions
15
acinclude.m4
15
acinclude.m4
|
@ -1,3 +1,18 @@
|
||||||
|
define(AC_CHECK_DEFINE,[dnl
|
||||||
|
AC_CACHE_CHECK(for $1 in $2, ac_cv_define_$1,
|
||||||
|
AC_EGREP_CPP([YES_IS_DEFINED], [
|
||||||
|
#include <$2>
|
||||||
|
#ifdef $1
|
||||||
|
YES_IS_DEFINED
|
||||||
|
#endif
|
||||||
|
], ac_cv_define_$1=yes, ac_cv_define_$1=no)
|
||||||
|
)
|
||||||
|
if test "$ac_cv_define_$1" = "yes" ; then
|
||||||
|
AC_DEFINE(HAVE_$1)
|
||||||
|
fi
|
||||||
|
])dnl
|
||||||
|
AC_DEFINE(HAVE_$1)
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
dnl Configure Paths for Alsa
|
dnl Configure Paths for Alsa
|
||||||
dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
|
dnl Some modifications by Richard Boulton <richard-alsa@tartarus.org>
|
||||||
|
|
|
@ -129,6 +129,9 @@ if test x$enable_libc = xyes; then
|
||||||
have_inttypes=yes
|
have_inttypes=yes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl Check for defines
|
||||||
|
AC_CHECK_DEFINE(M_PI, math.h)
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
case "$host" in
|
case "$host" in
|
||||||
*-*-cygwin* | *-*-mingw32*)
|
*-*-cygwin* | *-*-mingw32*)
|
||||||
|
@ -146,10 +149,10 @@ if test x$enable_libc = xyes; then
|
||||||
if test x$ac_cv_func_strtod = xyes; then
|
if test x$ac_cv_func_strtod = xyes; then
|
||||||
AC_DEFINE(HAVE_STRTOD)
|
AC_DEFINE(HAVE_STRTOD)
|
||||||
fi
|
fi
|
||||||
AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf iconv sigaction setjmp nanosleep)
|
AC_CHECK_FUNCS(malloc calloc realloc free getenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf copysign cos cosf fabs floor log pow scalbn sin sinf sqrt iconv sigaction setjmp nanosleep)
|
||||||
|
|
||||||
AC_CHECK_LIB(iconv, libiconv_open, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
|
|
||||||
AC_CHECK_LIB(m, pow, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
|
AC_CHECK_LIB(m, pow, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
|
||||||
|
AC_CHECK_LIB(iconv, libiconv_open, [EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x$have_inttypes != xyes; then
|
if test x$have_inttypes != xyes; then
|
||||||
|
|
|
@ -129,7 +129,18 @@
|
||||||
#undef HAVE_SSCANF
|
#undef HAVE_SSCANF
|
||||||
#undef HAVE_SNPRINTF
|
#undef HAVE_SNPRINTF
|
||||||
#undef HAVE_VSNPRINTF
|
#undef HAVE_VSNPRINTF
|
||||||
#undef HAVE_ICONV
|
#undef HAVE_M_PI
|
||||||
|
#undef HAVE_COPYSIGN
|
||||||
|
#undef HAVE_COS
|
||||||
|
#undef HAVE_COSF
|
||||||
|
#undef HAVE_FABS
|
||||||
|
#undef HAVE_FLOOR
|
||||||
|
#undef HAVE_LOG
|
||||||
|
#undef HAVE_POW
|
||||||
|
#undef HAVE_SCALBN
|
||||||
|
#undef HAVE_SIN
|
||||||
|
#undef HAVE_SINF
|
||||||
|
#undef HAVE_SQRT
|
||||||
#undef HAVE_SIGACTION
|
#undef HAVE_SIGACTION
|
||||||
#undef HAVE_SETJMP
|
#undef HAVE_SETJMP
|
||||||
#undef HAVE_NANOSLEEP
|
#undef HAVE_NANOSLEEP
|
||||||
|
|
|
@ -116,6 +116,18 @@ typedef unsigned int uintptr_t;
|
||||||
#define HAVE__STRICMP 1
|
#define HAVE__STRICMP 1
|
||||||
#define HAVE__STRNICMP 1
|
#define HAVE__STRNICMP 1
|
||||||
#define HAVE_SSCANF 1
|
#define HAVE_SSCANF 1
|
||||||
|
#define HAVE_M_PI 1
|
||||||
|
#define HAVE_COPYSIGN 1
|
||||||
|
#define HAVE_COS 1
|
||||||
|
#define HAVE_COSF 1
|
||||||
|
#define HAVE_FABS 1
|
||||||
|
#define HAVE_FLOOR 1
|
||||||
|
#define HAVE_LOG 1
|
||||||
|
#define HAVE_POW 1
|
||||||
|
#define HAVE_SCALBN 1
|
||||||
|
#define HAVE_SIN 1
|
||||||
|
#define HAVE_SINF 1
|
||||||
|
#define HAVE_SQRT 1
|
||||||
#else
|
#else
|
||||||
#define HAVE_STDARG_H 1
|
#define HAVE_STDARG_H 1
|
||||||
#define HAVE_STDDEF_H 1
|
#define HAVE_STDDEF_H 1
|
||||||
|
|
|
@ -72,6 +72,9 @@
|
||||||
#ifdef HAVE_CTYPE_H
|
#ifdef HAVE_CTYPE_H
|
||||||
# include <ctype.h>
|
# include <ctype.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_MATH_H
|
||||||
|
# include <math.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_ICONV_H
|
#ifdef HAVE_ICONV_H
|
||||||
# include <iconv.h>
|
# include <iconv.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -639,6 +642,76 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen,
|
||||||
const char *fmt, va_list ap);
|
const char *fmt, va_list ap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_M_PI
|
||||||
|
#define M_PI 3.14159265358979323846264338327950288 /* pi */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_COPYSIGN
|
||||||
|
#define SDL_copysign copysign
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_COS
|
||||||
|
#define SDL_cos cos
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_cos(double x);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_COSF
|
||||||
|
#define SDL_cosf cosf
|
||||||
|
#else
|
||||||
|
#define SDL_cosf(x) (float)SDL_cos((double)x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_FABS
|
||||||
|
#define SDL_fabs fabs
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_fabs(double x);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_FLOOR
|
||||||
|
#define SDL_floor floor
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_floor(double x);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LOG
|
||||||
|
#define SDL_log log
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_log(double x);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_POW
|
||||||
|
#define SDL_pow pow
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SCALBN
|
||||||
|
#define SDL_scalbn scalbn
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SIN
|
||||||
|
#define SDL_sin sin
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_sin(double x);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SINF
|
||||||
|
#define SDL_sinf sinf
|
||||||
|
#else
|
||||||
|
#define SDL_sinf(x) (float)SDL_sin((double)x)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SQRT
|
||||||
|
#define SDL_sqrt sqrt
|
||||||
|
#else
|
||||||
|
extern DECLSPEC double SDLCALL SDL_sqrt(double x);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The SDL implementation of iconv() returns these error codes */
|
/* The SDL implementation of iconv() returns these error codes */
|
||||||
#define SDL_ICONV_ERROR (size_t)-1
|
#define SDL_ICONV_ERROR (size_t)-1
|
||||||
#define SDL_ICONV_E2BIG (size_t)-2
|
#define SDL_ICONV_E2BIG (size_t)-2
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
#include "SDL_audio.h"
|
#include "SDL_audio.h"
|
||||||
#include "SDL_audio_c.h"
|
#include "SDL_audio_c.h"
|
||||||
|
|
||||||
#include "../libm/math.h"
|
|
||||||
|
|
||||||
//#define DEBUG_CONVERT
|
//#define DEBUG_CONVERT
|
||||||
|
|
||||||
/* These are fractional multiplication routines. That is, their inputs
|
/* These are fractional multiplication routines. That is, their inputs
|
||||||
|
@ -1658,13 +1656,9 @@ SDL_BuildWindowedSinc(SDL_AudioCVT * cvt, SDL_AudioFormat format,
|
||||||
if (i == m / 2) {
|
if (i == m / 2) {
|
||||||
fSinc[i] = two_pi_fc;
|
fSinc[i] = two_pi_fc;
|
||||||
} else {
|
} else {
|
||||||
fSinc[i] =
|
fSinc[i] = SDL_sinf(two_pi_fc * ((float) i - m_over_two)) / ((float) i - m_over_two);
|
||||||
sinf(two_pi_fc * ((float) i - m_over_two)) / ((float) i -
|
|
||||||
m_over_two);
|
|
||||||
/* Apply blackman window */
|
/* Apply blackman window */
|
||||||
fSinc[i] *=
|
fSinc[i] *= 0.42f - 0.5f * SDL_cosf(two_pi_over_m * (float) i) + 0.08f * SDL_cosf(four_pi_over_m * (float) i);
|
||||||
0.42f - 0.5f * cosf(two_pi_over_m * (float) i) +
|
|
||||||
0.08f * cosf(four_pi_over_m * (float) i);
|
|
||||||
}
|
}
|
||||||
norm_sum += fSinc[i] < 0 ? -fSinc[i] : fSinc[i]; /* fabs(fSinc[i]); */
|
norm_sum += fSinc[i] < 0 ? -fSinc[i] : fSinc[i]; /* fabs(fSinc[i]); */
|
||||||
}
|
}
|
||||||
|
@ -1740,7 +1734,7 @@ SDL_GCD(int a, int b)
|
||||||
static void SDLCALL
|
static void SDLCALL
|
||||||
SDL_Resample(SDL_AudioCVT * cvt, SDL_AudioFormat format)
|
SDL_Resample(SDL_AudioCVT * cvt, SDL_AudioFormat format)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i;
|
||||||
|
|
||||||
#ifdef DEBUG_CONVERT
|
#ifdef DEBUG_CONVERT
|
||||||
printf("Converting audio rate via proper resampling (mono)\n");
|
printf("Converting audio rate via proper resampling (mono)\n");
|
||||||
|
@ -1752,8 +1746,8 @@ SDL_Resample(SDL_AudioCVT * cvt, SDL_AudioFormat format)
|
||||||
for (i = cvt->len / sizeof (type); i; --i) { \
|
for (i = cvt->len / sizeof (type); i; --i) { \
|
||||||
src--; \
|
src--; \
|
||||||
dst[-1] = src[0]; \
|
dst[-1] = src[0]; \
|
||||||
for( j = -cvt->len_mult; j < -1; ++j ) { \
|
if (cvt->len_mult > 1) { \
|
||||||
dst[j] = 0; \
|
SDL_memset(dst-cvt->len_mult, 0, cvt->len_mult-1); \
|
||||||
} \
|
} \
|
||||||
dst -= cvt->len_mult; \
|
dst -= cvt->len_mult; \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -20,34 +20,56 @@
|
||||||
slouken@libsdl.org
|
slouken@libsdl.org
|
||||||
*/
|
*/
|
||||||
#include "SDL_config.h"
|
#include "SDL_config.h"
|
||||||
|
#include "SDL_stdinc.h"
|
||||||
#ifdef HAVE_MATH_H
|
|
||||||
#define _USE_MATH_DEFINES
|
|
||||||
#include <math.h>
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* Math routines from uClibc: http://www.uclibc.org */
|
/* Math routines from uClibc: http://www.uclibc.org */
|
||||||
|
|
||||||
#define M_PI 3.14159265358979323846264338327950288 /* pi */
|
#ifdef HAVE_COPYSIGN
|
||||||
|
#define copysign SDL_uclibc_copysign
|
||||||
|
#else
|
||||||
|
#define copysign SDL_copysign
|
||||||
|
#endif
|
||||||
|
|
||||||
extern double __ieee754_log(double x);
|
#ifdef HAVE_COS
|
||||||
extern double __ieee754_pow(double x, double y);
|
#define cos SDL_uclibc_cos
|
||||||
extern double __ieee754_sqrt(double x);
|
#else
|
||||||
|
#define cos SDL_cos
|
||||||
|
#endif
|
||||||
|
|
||||||
#define log(x) __ieee754_log(x)
|
#ifdef HAVE_FABS
|
||||||
#define pow(x, y) __ieee754_pow(x, y)
|
#define fabs SDL_uclibc_fabs
|
||||||
#define sqrt(x) __ieee754_sqrt(x)
|
#else
|
||||||
|
#define fabs SDL_fabs
|
||||||
|
#endif
|
||||||
|
|
||||||
extern double copysign(double x, double y);
|
#ifdef HAVE_FLOOR
|
||||||
extern double cos(double x);
|
#define floor SDL_uclibc_floor
|
||||||
extern double fabs(double x);
|
#else
|
||||||
extern double floor(double x);
|
#define floor SDL_floor
|
||||||
extern double scalbn(double x, int n);
|
#endif
|
||||||
extern double sin(double x);
|
|
||||||
|
|
||||||
#define sinf(x) (float)sin((double)x)
|
#ifndef HAVE_LOG
|
||||||
#define cosf(x) (float)cos((double)x)
|
#define __ieee754_log SDL_log
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* HAVE_MATH_H */
|
#ifndef HAVE_POW
|
||||||
|
#define __ieee754_pow SDL_pow
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SCALBN
|
||||||
|
#define scalbn SDL_uclibc_scalbn
|
||||||
|
#else
|
||||||
|
#define scalbn SDL_scalbn
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SIN
|
||||||
|
#define sin SDL_uclibc_sin
|
||||||
|
#else
|
||||||
|
#define sin SDL_sin
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_SQRT
|
||||||
|
#define __ieee754_sqrt SDL_sqrt
|
||||||
|
#endif
|
||||||
|
|
||||||
/* vi: set ts=4 sw=4 expandtab: */
|
/* vi: set ts=4 sw=4 expandtab: */
|
||||||
|
|
|
@ -66,7 +66,7 @@ SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
|
||||||
int i, n = w * bpp; \
|
int i, n = w * bpp; \
|
||||||
Uint8 *p = pixels; \
|
Uint8 *p = pixels; \
|
||||||
\
|
\
|
||||||
if (n > 15) { \
|
if (n > 63) { \
|
||||||
int adjust = 16 - ((uintptr_t)p & 15); \
|
int adjust = 16 - ((uintptr_t)p & 15); \
|
||||||
if (adjust < 16) { \
|
if (adjust < 16) { \
|
||||||
n -= adjust; \
|
n -= adjust; \
|
||||||
|
@ -92,7 +92,35 @@ SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
|
||||||
SSE_END; \
|
SSE_END; \
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_SSE_FILLRECT(1, Uint8)
|
static void
|
||||||
|
SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
|
||||||
|
{
|
||||||
|
SSE_BEGIN;
|
||||||
|
|
||||||
|
while (h--) {
|
||||||
|
int i, n = w;
|
||||||
|
Uint8 *p = pixels;
|
||||||
|
|
||||||
|
if (n > 63) {
|
||||||
|
int adjust = 16 - ((uintptr_t)p & 15);
|
||||||
|
if (adjust) {
|
||||||
|
n -= adjust;
|
||||||
|
SDL_memset(p, color, adjust);
|
||||||
|
p += adjust;
|
||||||
|
}
|
||||||
|
SSE_WORK;
|
||||||
|
}
|
||||||
|
if (n & 63) {
|
||||||
|
int remainder = (n & 63);
|
||||||
|
SDL_memset(p, color, remainder);
|
||||||
|
p += remainder;
|
||||||
|
}
|
||||||
|
pixels += pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
SSE_END;
|
||||||
|
}
|
||||||
|
/*DEFINE_SSE_FILLRECT(1, Uint8)*/
|
||||||
DEFINE_SSE_FILLRECT(2, Uint16)
|
DEFINE_SSE_FILLRECT(2, Uint16)
|
||||||
DEFINE_SSE_FILLRECT(4, Uint32)
|
DEFINE_SSE_FILLRECT(4, Uint32)
|
||||||
|
|
||||||
|
@ -131,7 +159,7 @@ SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
|
||||||
int i, n = w * bpp; \
|
int i, n = w * bpp; \
|
||||||
Uint8 *p = pixels; \
|
Uint8 *p = pixels; \
|
||||||
\
|
\
|
||||||
if (n > 7) { \
|
if (n > 63) { \
|
||||||
int adjust = 8 - ((uintptr_t)p & 7); \
|
int adjust = 8 - ((uintptr_t)p & 7); \
|
||||||
if (adjust < 8) { \
|
if (adjust < 8) { \
|
||||||
n -= adjust; \
|
n -= adjust; \
|
||||||
|
@ -157,7 +185,35 @@ SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
|
||||||
MMX_END; \
|
MMX_END; \
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFINE_MMX_FILLRECT(1, Uint8)
|
static void
|
||||||
|
SDL_FillRect1MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
|
||||||
|
{
|
||||||
|
MMX_BEGIN;
|
||||||
|
|
||||||
|
while (h--) {
|
||||||
|
int i, n = w;
|
||||||
|
Uint8 *p = pixels;
|
||||||
|
|
||||||
|
if (n > 63) {
|
||||||
|
int adjust = 8 - ((uintptr_t)p & 7);
|
||||||
|
if (adjust) {
|
||||||
|
n -= adjust;
|
||||||
|
SDL_memset(p, color, adjust);
|
||||||
|
p += adjust;
|
||||||
|
}
|
||||||
|
MMX_WORK;
|
||||||
|
}
|
||||||
|
if (n & 63) {
|
||||||
|
int remainder = (n & 63);
|
||||||
|
SDL_memset(p, color, remainder);
|
||||||
|
p += remainder;
|
||||||
|
}
|
||||||
|
pixels += pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
MMX_END;
|
||||||
|
}
|
||||||
|
/*DEFINE_MMX_FILLRECT(1, Uint8)*/
|
||||||
DEFINE_MMX_FILLRECT(2, Uint16)
|
DEFINE_MMX_FILLRECT(2, Uint16)
|
||||||
DEFINE_MMX_FILLRECT(4, Uint32)
|
DEFINE_MMX_FILLRECT(4, Uint32)
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
|
|
||||||
/* Gamma correction support */
|
/* Gamma correction support */
|
||||||
|
|
||||||
#include "../libm/math.h"
|
|
||||||
|
|
||||||
#include "SDL_sysvideo.h"
|
#include "SDL_sysvideo.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,7 +50,7 @@ CalculateGammaRamp(float gamma, Uint16 * ramp)
|
||||||
int value;
|
int value;
|
||||||
gamma = 1.0f / gamma;
|
gamma = 1.0f / gamma;
|
||||||
for (i = 0; i < 256; ++i) {
|
for (i = 0; i < 256; ++i) {
|
||||||
value = (int) (pow((double) i / 256.0, gamma) * 65535.0 + 0.5);
|
value = (int) (SDL_pow((double) i / 256.0, gamma) * 65535.0 + 0.5);
|
||||||
if (value > 65535) {
|
if (value > 65535) {
|
||||||
value = 65535;
|
value = 65535;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +73,7 @@ CalculateGammaFromRamp(float *gamma, Uint16 * ramp)
|
||||||
if ((ramp[i] != 0) && (ramp[i] != 65535)) {
|
if ((ramp[i] != 0) && (ramp[i] != 65535)) {
|
||||||
double B = (double) i / 256.0;
|
double B = (double) i / 256.0;
|
||||||
double A = ramp[i] / 65535.0;
|
double A = ramp[i] / 65535.0;
|
||||||
sum += (float) (log(A) / log(B));
|
sum += (float) (SDL_log(A) / SDL_log(B));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue