1 #ifndef PtexSeparableKernel_h 
    2 #define PtexSeparableKernel_h 
   53     static const int kmax = 10; 
 
   58         : res(0), u(0), v(0), uw(0), vw(0), ku(kubuff), kv(kvbuff) {}
 
   74              const float* kuVal, 
const float* kvVal)
 
   76         assert(uwVal <= kmax && vwVal <= kmax);
 
   82         memcpy(kubuff, kuVal, 
sizeof(*ku)*uw);
 
   83         memcpy(kvbuff, kvVal, 
sizeof(*kv)*vw);
 
   90         while (ku[0] == 0) { ku++; u++; uw--; }
 
   91         while (ku[uw-1] == 0) { uw--; }
 
   92         while (kv[0] == 0) { kv++; v++; vw--; }
 
   93         while (kv[vw-1] == 0) { vw--; }
 
   94         assert(uw > 0 && vw > 0);
 
  114         int w = uw + u - res.
u();
 
  115         float* kp = ku + uw - w;
 
  133         int w = vw + v - res.
v();
 
  134         float* kp = kv + vw - w;
 
  166         int w = u + uw - res.
u();
 
  171             k.
set(res, 0, v, w, vw, ku + uw - w, kv);
 
  209         int w = v + vw - res.
v();
 
  213             k.
set(res, u, 0, uw, w, ku, kv + vw - w);
 
  228         u = res.
u() - u - 
uw;
 
  229         std::reverse(ku, ku+uw);
 
  234         v = res.
v() - v - 
vw;
 
  235         std::reverse(kv, kv+vw);
 
  269         int resu = res.
u(), resv = res.
v();
 
  272             primary = (u < resu);
 
  274             if (!primary) u -= resu;
 
  277             primary = (v < resv);
 
  278             if (!primary) v -= resv;
 
  281             primary = (u >= resu);
 
  282             if (primary) u -= resu;
 
  285             primary = (v >= resv);
 
  287             if (primary) v -= resv;
 
  298         case e_top:    u += res.
u(); 
break;
 
  299         case e_left:   u += res.
u(); v += res.
v(); 
break;
 
  317         for (
int i = uw/2; i > 0; i--) {
 
  318             *dst++ = src[0] + src[1];
 
  346         for (
int i = vw/2; i > 0; i--) {
 
  347             *dst++ = src[0] + src[1];
 
  364         float* src = ku + uw-1;
 
  365         float* dst = ku + uw*2-2;
 
  366         for (
int i = uw; i > 0; i--) {
 
  367             dst[0] = dst[1] = *src-- / 2;
 
  377         float* src = kv + vw-1;
 
  378         float* dst = kv + vw*2-2;
 
  379         for (
int i = vw; i > 0; i--) {
 
  380             dst[0] = dst[1] = *src-- / 2;
 
  390         assert(u == 0 && v == 0);
 
  405         for (
int i = 0; i < 
uw; i++) {
 
  406             float sum = ku[i] + kv[i];
 
  410         newWeight *= newWeight; 
 
  413         float scale = newWeight == 0 ? 1.f : initialWeight / newWeight;
 
  436                 for (
int i = 0; i < 
uw; i++) ku[i] *= -1;
 
  437                 newWeight = -newWeight;
 
  441                 for (
int i = 0; i < 
uw; i++) ku[i] *= scale;
 
  442                 newWeight = initialWeight;
 
  452         fn(*
this, dst, data, nChan, nTxChan);
 
  468         for (
const float* e = p + n; p != e; p++) result += *p;
 
Left edge, from UV (0,1) to (0,0) 
void set(Res resVal, int uVal, int vVal, int uwVal, int vwVal, const float *kuVal, const float *kvVal)
Common data structures and enums used throughout the API. 
void apply(float *dst, void *data, DataType dt, int nChan, int nTxChan)
void applyConst(float *dst, void *data, DataType dt, int nChan)
Top edge, from UV (1,1) to (0,1) 
static float accumulate(const float *p, int n)
DataType
Type of data stored in texture file. 
void mergeL(BorderMode mode)
void mergeB(BorderMode mode)
PtexSeparableKernel & operator=(const PtexSeparableKernel &k)
bool adjustMainToSubface(int eid)
float makeSymmetric(float initialWeight)
int v() const 
V resolution in texels. 
static ApplyFn applyFunctions[40]
Bottom edge, from UV (0,0) to (1,0) 
static ApplyConstFn applyConstFunctions[20]
BorderMode
How to handle mesh border when filtering. 
int u() const 
U resolution in texels. 
int8_t vlog2
log base 2 of v resolution, in texels 
void mergeR(BorderMode mode)
void adjustSubfaceToMain(int eid)
void(* ApplyFn)(PtexSeparableKernel &k, float *dst, void *data, int nChan, int nTxChan)
void mergeT(BorderMode mode)
void(* ApplyConstFn)(float weight, float *dst, void *data, int nChan)
texel beyond border are assumed to be black 
void splitL(PtexSeparableKernel &k)
void swapuv()
Swap the u and v resolution values in place. 
void splitB(PtexSeparableKernel &k)
int8_t ulog2
log base 2 of u resolution, in texels 
Right edge, from UV (1,0) to (1,1) 
void splitT(PtexSeparableKernel &k)
Pixel resolution of a given texture. 
PtexSeparableKernel(const PtexSeparableKernel &k)
Public API classes for reading, writing, caching, and filtering Ptex files. 
void splitR(PtexSeparableKernel &k)
static void applyConst(float weight, float *dst, void *data, Ptex::DataType dt, int nChan)