Go to the documentation of this file.
   44 #include <smmintrin.h> 
   57 inline uint32_t 
ones(uint32_t x)
 
   60     x = (x & 0x55555555) + ((x >> 1) & 0x55555555); 
 
   61     x = (x & 0x33333333) + ((x >> 2) & 0x33333333); 
 
   62     x = (x & 0x0f0f0f0f) + ((x >> 4) & 0x0f0f0f0f); 
 
   88     return ones(x>>1) + !isPow2;
 
  111     int result = 127 - ((wi >> 23) & 0xff);
 
  117     if ( x < a ) 
return 0;
 
  118     if ( x >= b ) 
return 1;
 
  120     return x*x * (3 - 2*x);
 
  126     if ( x < a ) 
return 0;
 
  127     if ( x >= b ) 
return 1;
 
  129     return x*x*x * (10 + x * (-15 + x*6));
 
  133 inline T 
abs(T x) { 
return x > 0 ? x : -x; }
 
  147 inline T 
min(T a, T b) { 
return a < b ? a : b; }
 
  150 inline T 
max(T a, T b) { 
return a > b ? a : b; }
 
  156 inline T 
halve(T val) { 
return T(val>>1); }
 
  158 inline float halve(
float val) { 
return 0.5f * val; }
 
  164 inline float quarter(
float val) { 
return 0.25f * val; }
 
  167 bool isConstant(
const void* data, 
int stride, 
int ures, 
int vres, 
int pixelSize);
 
  168 void interleave(
const void* src, 
int sstride, 
int ures, 
int vres,
 
  169                 void* dst, 
int dstride, 
DataType dt, 
int nchannels);
 
  170 void deinterleave(
const void* src, 
int sstride, 
int ures, 
int vres,
 
  171                   void* dst, 
int dstride, 
DataType dt, 
int nchannels);
 
  174 typedef void ReduceFn(
const void* src, 
int sstride, 
int ures, 
int vres,
 
  175                       void* dst, 
int dstride, 
DataType dt, 
int nchannels);
 
  176 void reduce(
const void* src, 
int sstride, 
int ures, 
int vres,
 
  177             void* dst, 
int dstride, 
DataType dt, 
int nchannels);
 
  178 void reduceu(
const void* src, 
int sstride, 
int ures, 
int vres,
 
  179              void* dst, 
int dstride, 
DataType dt, 
int nchannels);
 
  180 void reducev(
const void* src, 
int sstride, 
int ures, 
int vres,
 
  181              void* dst, 
int dstride, 
DataType dt, 
int nchannels);
 
  182 void reduceTri(
const void* src, 
int sstride, 
int ures, 
int vres,
 
  183                void* dst, 
int dstride, 
DataType dt, 
int nchannels);
 
  184 void average(
const void* src, 
int sstride, 
int ures, 
int vres,
 
  185              void* dst, 
DataType dt, 
int nchannels);
 
  186 void fill(
const void* src, 
void* dst, 
int dstride,
 
  187           int ures, 
int vres, 
int pixelsize);
 
  188 void copy(
const void* src, 
int sstride, 
void* dst, 
int dstride,
 
  189           int nrows, 
int rowlen);
 
  190 void blend(
const void* src, 
float weight, 
void* dst, 
bool flip,
 
  191            int rowlen, 
DataType dt, 
int nchannels);
 
  192 void multalpha(
void* data, 
int npixels, 
DataType dt, 
int nchannels, 
int alphachan);
 
  193 void divalpha(
void* data, 
int npixels, 
DataType dt, 
int nchannels, 
int alphachan);
 
  196                  uint32_t* rfaceids, uint32_t* faceids);
 
  199 template<
typename T, 
int n>
 
  204         *dst += (float)*val * weight;
 
  206         VecAccum<T,n-1>()(dst+1, val+1, weight);
 
  215     void operator()(
float* dst, 
const T* val, 
int nchan, 
float weight)
 
  217         for (
int i = 0; i < nchan; i++) dst[i] += (
float)val[i] * weight;
 
  222 template<
typename T, 
int n>
 
  227         *dst = (float)*val * weight;
 
  229         VecMult<T,n-1>()(dst+1, val+1, weight);
 
  238     void operator()(
float* dst, 
const T* val, 
int nchan, 
float weight)
 
  240         for (
int i = 0; i < nchan; i++) dst[i] = (
float)val[i] * weight;
 
  244 typedef void (*
ApplyConstFn)(
float weight, 
float* dst, 
void* data, 
int nChan);
 
  250     fn(weight, dst, data, nChan);
 
  254 inline float floor(
float f) {
 
  256     _mm_store_ss(&result, _mm_round_ps(_mm_set1_ps(f), (_MM_FROUND_NO_EXC | _MM_FROUND_TO_NEG_INF)));
 
  259 inline float ceil(
float f) {
 
  261     _mm_store_ss(&result, _mm_round_ps(_mm_set1_ps(f), (_MM_FROUND_NO_EXC | _MM_FROUND_TO_POS_INF)));
 
  
void operator()(float *dst, const T *val, float weight)
void operator()(float *dst, const T *val, int nchan, float weight)
float smoothstep(float x, float a, float b)
#define PTEX_NAMESPACE_END
void deinterleave(const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
void divalpha(void *data, int npixels, DataType dt, int nchannels, int alphachan)
void ReduceFn(const void *src, int sstride, int ures, int vres, void *dst, int dstride, DataType dt, int nchannels)
void fill(const void *src, void *dst, int dstride, int ures, int vres, int pixelsize)
void operator()(float *dst, const T *val, int nchan, float weight)
DataType
Type of data stored in texture file.
void operator()(float *dst, const T *val, float weight)
Half-precision (16-bit) floating-point type.
void copy(const void *src, int sstride, void *dst, int dstride, int vres, int rowlen)
uint32_t ceil_log2(uint32_t x)
void operator()(float *, const T *, float)
void reducev(const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
void blend(const void *src, float weight, void *dst, bool flip, int rowlen, DataType dt, int nchan)
void interleave(const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
ApplyConstFn applyConstFunctions[20]
void applyConst(float weight, float *dst, void *data, Ptex::DataType dt, int nChan)
void(* ApplyConstFn)(float weight, float *dst, void *data, int nChan)
float reciprocalPow2(int power)
float qsmoothstep(float x, float a, float b)
void decodeDifference(void *data, int size, DataType dt)
int calcResFromWidth(float w)
uint32_t floor_log2(uint32_t x)
void reduceu(const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
void operator()(float *, const T *, float)
uint32_t ones(uint32_t x)
bool isConstant(const void *data, int stride, int ures, int vres, int pixelSize)
void genRfaceids(const FaceInfo *faces, int nfaces, uint32_t *rfaceids, uint32_t *faceids)
void average(const void *src, int sstride, int uw, int vw, void *dst, DataType dt, int nchan)
Public API classes for reading, writing, caching, and filtering Ptex files.
void multalpha(void *data, int npixels, DataType dt, int nchannels, int alphachan)
void reduceTri(const void *src, int sstride, int w, int, void *dst, int dstride, DataType dt, int nchan)
Half-precision floating-point type.
void reduce(const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
void encodeDifference(void *data, int size, DataType dt)