|
template<typename T > |
OIIO_HOSTDEVICE
OIIO_CONSTEXPR14 bool | ispow2 (T x) noexcept |
|
OIIO_HOSTDEVICE
OIIO_CONSTEXPR14 int | ceil2 (int x) noexcept |
|
OIIO_HOSTDEVICE
OIIO_CONSTEXPR14 int | floor2 (int x) noexcept |
|
OIIO_HOSTDEVICE int | pow2roundup (int x) |
|
OIIO_HOSTDEVICE int | pow2rounddown (int x) |
|
template<typename V , typename M > |
OIIO_HOSTDEVICE V | round_to_multiple (V value, M multiple) |
|
template<typename T > |
OIIO_HOSTDEVICE T | round_to_multiple_of_pow2 (T x, T m) |
|
OIIO_HOSTDEVICE uint32_t | clamped_mult32 (uint32_t a, uint32_t b) |
|
OIIO_HOSTDEVICE uint64_t | clamped_mult64 (uint64_t a, uint64_t b) |
|
OIIO_FORCEINLINE
OIIO_HOSTDEVICE uint32_t | rotl32 (uint32_t x, int k) |
| Bitwise circular rotation left by k bits (for 32 bit unsigned integers) More...
|
|
OIIO_FORCEINLINE
OIIO_HOSTDEVICE uint64_t | rotl64 (uint64_t x, int k) |
| Bitwise circular rotation left by k bits (for 64 bit unsigned integers) More...
|
|
template<class T > |
OIIO_HOSTDEVICE T | safe_mod (T a, T b) |
|
template<class T > |
OIIO_HOSTDEVICE T | clamp (const T &a, const T &low, const T &high) |
| clamp a to bounds [low,high]. More...
|
|
template<> |
simd::vfloat4 | clamp (const simd::vfloat4 &a, const simd::vfloat4 &low, const simd::vfloat4 &high) |
|
template<> |
simd::vfloat8 | clamp (const simd::vfloat8 &a, const simd::vfloat8 &low, const simd::vfloat8 &high) |
|
OIIO_HOSTDEVICE float | madd (float a, float b, float c) |
| Fused multiply and add: (a*b + c) More...
|
|
OIIO_HOSTDEVICE float | msub (float a, float b, float c) |
| Fused multiply and subtract: -(a*b - c) More...
|
|
OIIO_HOSTDEVICE float | nmadd (float a, float b, float c) |
| Fused negative multiply and add: -(a*b) + c. More...
|
|
OIIO_HOSTDEVICE float | nmsub (float a, float b, float c) |
| Negative fused multiply and subtract: -(a*b) - c. More...
|
|
template<class T , class Q > |
OIIO_HOSTDEVICE T | lerp (const T &v0, const T &v1, const Q &x) |
|
template<class T , class Q > |
OIIO_HOSTDEVICE T | bilerp (const T &v0, const T &v1, const T &v2, const T &v3, const Q &s, const Q &t) |
|
template<class T , class Q > |
OIIO_HOSTDEVICE void | bilerp (const T *v0, const T *v1, const T *v2, const T *v3, Q s, Q t, int n, T *result) |
|
template<class T , class Q > |
OIIO_HOSTDEVICE void | bilerp_mad (const T *v0, const T *v1, const T *v2, const T *v3, Q s, Q t, Q scale, int n, T *result) |
|
template<class T , class Q > |
OIIO_HOSTDEVICE T | trilerp (T v0, T v1, T v2, T v3, T v4, T v5, T v6, T v7, Q s, Q t, Q r) |
|
template<class T , class Q > |
OIIO_HOSTDEVICE void | trilerp (const T *v0, const T *v1, const T *v2, const T *v3, const T *v4, const T *v5, const T *v6, const T *v7, Q s, Q t, Q r, int n, T *result) |
|
template<class T , class Q > |
OIIO_HOSTDEVICE void | trilerp_mad (const T *v0, const T *v1, const T *v2, const T *v3, const T *v4, const T *v5, const T *v6, const T *v7, Q s, Q t, Q r, Q scale, int n, T *result) |
|
template<typename T > |
OIIO_HOSTDEVICE void | evalBSplineWeights (T w[4], T fraction) |
|
template<typename T > |
OIIO_HOSTDEVICE void | evalBSplineWeightDerivs (T dw[4], T fraction) |
|
template<class T > |
OIIO_HOSTDEVICE void | bicubic_interp (const T **val, T s, T t, int n, T *result) |
|
OIIO_HOSTDEVICE int | ifloor (float x) |
| Return floor(x) cast to an int. More...
|
|
OIIO_HOSTDEVICE float | floorfrac (float x, int *xint) |
|
simd::vfloat4 | floorfrac (const simd::vfloat4 &x, simd::vint4 *xint) |
|
simd::vfloat8 | floorfrac (const simd::vfloat8 &x, simd::vint8 *xint) |
|
simd::vfloat16 | floorfrac (const simd::vfloat16 &x, simd::vint16 *xint) |
|
template<typename T > |
OIIO_HOSTDEVICE T | radians (T deg) |
| Convert degrees to radians. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | degrees (T rad) |
| Convert radians to degrees. More...
|
|
OIIO_HOSTDEVICE void | sincos (float x, float *sine, float *cosine) |
|
OIIO_HOSTDEVICE void | sincos (double x, double *sine, double *cosine) |
|
OIIO_HOSTDEVICE float | sign (float x) |
|
template<typename IN_TYPE , typename OUT_TYPE > |
OIIO_HOSTDEVICE OUT_TYPE | bit_cast (const IN_TYPE in) |
|
OIIO_HOSTDEVICE int | bitcast_to_int (float x) |
|
OIIO_HOSTDEVICE float | bitcast_to_float (int x) |
|
template<class T > |
OIIO_HOSTDEVICE void | swap_endian (T *f, int len=1) |
|
template<typename S , typename D , typename F > |
OIIO_HOSTDEVICE D | scaled_conversion (const S &src, F scale, F min, F max) |
|
template<typename S , typename D > |
void | convert_type (const S *src, D *dst, size_t n, D _min, D _max) |
|
template<> |
void | convert_type< uint8_t, float > (const uint8_t *src, float *dst, size_t n, float _min, float _max) |
|
template<> |
void | convert_type< uint16_t, float > (const uint16_t *src, float *dst, size_t n, float _min, float _max) |
|
template<> |
void | convert_type< float, uint16_t > (const float *src, uint16_t *dst, size_t n, uint16_t _min, uint16_t _max) |
|
template<> |
void | convert_type< float, uint8_t > (const float *src, uint8_t *dst, size_t n, uint8_t _min, uint8_t _max) |
|
template<typename S , typename D > |
void | convert_type (const S *src, D *dst, size_t n) |
|
template<typename S , typename D > |
D | convert_type (const S &src) |
|
template<unsigned int FROM_BITS, unsigned int TO_BITS> |
OIIO_HOSTDEVICE unsigned int | bit_range_convert (unsigned int in) |
|
OIIO_HOSTDEVICE unsigned int | bit_range_convert (unsigned int in, unsigned int FROM_BITS, unsigned int TO_BITS) |
|
OIIO_HOSTDEVICE void | float_to_rational (float f, unsigned int &num, unsigned int &den) |
|
OIIO_HOSTDEVICE void | float_to_rational (float f, int &num, int &den) |
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_sqrt (T x) |
| Safe (clamping) sqrt: safe_sqrt(x<0) returns 0, not NaN. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_inversesqrt (T x) |
| Safe (clamping) inverse sqrt: safe_inversesqrt(x<=0) returns 0. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_asin (T x) |
| Safe (clamping) arcsine: clamp to the valid domain. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_acos (T x) |
| Safe (clamping) arccosine: clamp to the valid domain. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_log2 (T x) |
| Safe log2: clamp to valid domain. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_log (T x) |
| Safe log: clamp to valid domain. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_log10 (T x) |
| Safe log10: clamp to valid domain. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_logb (T x) |
| Safe logb: clamp to valid domain. More...
|
|
template<typename T > |
OIIO_HOSTDEVICE T | safe_pow (T x, T y) |
|
OIIO_HOSTDEVICE int | fast_rint (float x) |
| Round to nearest integer, returning as an int. More...
|
|
simd::vint4 | fast_rint (const simd::vfloat4 &x) |
|
OIIO_HOSTDEVICE float | fast_sin (float x) |
|
OIIO_HOSTDEVICE float | fast_cos (float x) |
|
OIIO_HOSTDEVICE void | fast_sincos (float x, float *sine, float *cosine) |
|
OIIO_HOSTDEVICE float | fast_tan (float x) |
|
OIIO_HOSTDEVICE float | fast_sinpi (float x) |
|
OIIO_HOSTDEVICE float | fast_cospi (float x) |
|
OIIO_HOSTDEVICE float | fast_acos (float x) |
|
OIIO_HOSTDEVICE float | fast_asin (float x) |
|
OIIO_HOSTDEVICE float | fast_atan (float x) |
|
OIIO_HOSTDEVICE float | fast_atan2 (float y, float x) |
|
template<typename T > |
OIIO_HOSTDEVICE T | fast_log2 (const T &xval) |
|
template<> |
OIIO_HOSTDEVICE float | fast_log2 (const float &xval) |
|
template<typename T > |
OIIO_HOSTDEVICE T | fast_log (const T &x) |
|
template<typename T > |
OIIO_HOSTDEVICE T | fast_log10 (const T &x) |
|
OIIO_HOSTDEVICE float | fast_logb (float x) |
|
OIIO_HOSTDEVICE float | fast_log1p (float x) |
|
template<typename T > |
OIIO_HOSTDEVICE T | fast_exp2 (const T &xval) |
|
template<> |
OIIO_HOSTDEVICE float | fast_exp2 (const float &xval) |
|
template<typename T > |
OIIO_HOSTDEVICE T | fast_exp (const T &x) |
|
OIIO_HOSTDEVICE float | fast_correct_exp (float x) |
| Faster float exp than is in libm, but still 100% accurate. More...
|
|
OIIO_HOSTDEVICE float | fast_exp10 (float x) |
|
OIIO_HOSTDEVICE float | fast_expm1 (float x) |
|
OIIO_HOSTDEVICE float | fast_sinh (float x) |
|
OIIO_HOSTDEVICE float | fast_cosh (float x) |
|
OIIO_HOSTDEVICE float | fast_tanh (float x) |
|
OIIO_HOSTDEVICE float | fast_safe_pow (float x, float y) |
|
template<typename T , typename U > |
OIIO_HOSTDEVICE T | fast_pow_pos (const T &x, const U &y) |
|
OIIO_HOSTDEVICE float | fast_cbrt (float x) |
|
OIIO_HOSTDEVICE float | fast_erf (float x) |
|
OIIO_HOSTDEVICE float | fast_erfc (float x) |
|
OIIO_HOSTDEVICE float | fast_ierf (float x) |
|
template<class T , class Func > |
T | invert (Func &func, T y, T xmin=0.0, T xmax=1.0, int maxiters=32, T eps=1.0e-6, bool *brack=0) |
|
OIIO_HOSTDEVICE float | interpolate_linear (float x, span_strided< const float > y) |
|
A variety of floating-point math helper routines (and, slight misnomer, some int stuff as well).
Definition in file fmath.h.