mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Reduce some double-precision constants
This commit is contained in:
parent
131ce96263
commit
5ebf62b1a3
@ -116,8 +116,8 @@ void logscale(float4 *pixbuf, float4 *outbuf, float k1, float k2) {
|
||||
|
||||
|
||||
// See helpers/filt_err.py for source of these values.
|
||||
#define MIN_SD 0.23299530
|
||||
#define MAX_SD 4.33333333
|
||||
#define MIN_SD 0.23299530f
|
||||
#define MAX_SD 4.33333333f
|
||||
|
||||
__global__
|
||||
void density_est(float4 *pixbuf, float4 *outbuf, float *denbuf,
|
||||
|
@ -50,6 +50,34 @@ class BaseCode(HunkOCode):
|
||||
"""
|
||||
|
||||
defs = """
|
||||
#undef M_E
|
||||
#undef M_LOG2E
|
||||
#undef M_LOG10E
|
||||
#undef M_LN2
|
||||
#undef M_LN10
|
||||
#undef M_PI
|
||||
#undef M_PI_2
|
||||
#undef M_PI_4
|
||||
#undef M_1_PI
|
||||
#undef M_2_PI
|
||||
#undef M_2_SQRTPI
|
||||
#undef M_SQRT2
|
||||
#undef M_SQRT1_2
|
||||
|
||||
#define M_E 2.71828174591064f
|
||||
#define M_LOG2E 1.44269502162933f
|
||||
#define M_LOG10E 0.43429449200630f
|
||||
#define M_LN2 0.69314718246460f
|
||||
#define M_LN10 2.30258512496948f
|
||||
#define M_PI 3.14159274101257f
|
||||
#define M_PI_2 1.57079637050629f
|
||||
#define M_PI_4 0.78539818525314f
|
||||
#define M_1_PI 0.31830987334251f
|
||||
#define M_2_PI 0.63661974668503f
|
||||
#define M_2_SQRTPI 1.12837922573090f
|
||||
#define M_SQRT2 1.41421353816986f
|
||||
#define M_SQRT1_2 0.70710676908493f
|
||||
|
||||
// TODO: use launch parameter preconfig to eliminate unnecessary parts
|
||||
__device__
|
||||
uint32_t gtid() {
|
||||
|
@ -250,7 +250,7 @@ var(30, 'perspective', """
|
||||
float pvfcos = {{px.get(
|
||||
'xf.perspective_dist*np.cos(xf.perspective_angle*np.pi/2)', 'pvfcos')}};
|
||||
|
||||
float t = 1.0 / (pdist - ty * pvsin);
|
||||
float t = 1.0f / (pdist - ty * pvsin);
|
||||
ox += w * pdist * tx * t;
|
||||
oy += w * pvfcos * ty * t;
|
||||
""")
|
||||
@ -503,7 +503,7 @@ var(55, 'bipolar', """
|
||||
float t = x2y2 + 1.0f;
|
||||
float x2 = tx * 2.0f;
|
||||
float ps = -M_PI_2 * {{px.get('xf.bipolar_shift')}}
|
||||
float y = 0.5 * atan2f(2.0f * ty, x2y2 - 1.0f) + ps;
|
||||
float y = 0.5f * atan2f(2.0f * ty, x2y2 - 1.0f) + ps;
|
||||
|
||||
if (y > M_PI_2)
|
||||
y = -M_PI_2 + fmodf(y + M_PI_2, M_PI);
|
||||
@ -873,7 +873,7 @@ var(85, 'cos', """
|
||||
""")
|
||||
|
||||
var(86, 'tan', """
|
||||
float tanden = 1.0f/(cosf(2.0*tx) + coshf(2.0f*ty));
|
||||
float tanden = 1.0f/(cosf(2.0f*tx) + coshf(2.0f*ty));
|
||||
ox += w * tanden * sinf(2.0f*tx);
|
||||
oy += w * tanden * sinhf(2.0f*ty);
|
||||
""")
|
||||
|
Loading…
Reference in New Issue
Block a user