1#ifndef PtexSeparableKernel_h
2#define PtexSeparableKernel_h
55 static const int kmax = 10;
81 const float* kuVal,
const float* kvVal,
int rotVal=0)
83 assert(uwVal <=
kmax && vwVal <=
kmax);
98 while (
ku[0] == 0) {
ku++;
u++;
uw--; }
99 while (
ku[
uw-1] == 0) {
uw--; }
100 while (
kv[0] == 0) {
kv++;
v++;
vw--; }
101 while (
kv[
vw-1] == 0) {
vw--; }
102 assert(
uw > 0 &&
vw > 0);
123 float* kp =
ku +
uw - w;
142 float* kp =
kv +
vw - w;
257 switch (rotVal & 3) {
273 if (
res.ulog2 > 0)
res.ulog2--;
274 if (
res.vlog2 > 0)
res.vlog2--;
278 int resu =
res.u(), resv =
res.v();
281 primary = (
u < resu);
283 if (!primary)
u -= resu;
286 primary = (
v < resv);
287 if (!primary)
v -= resv;
290 primary = (
u >= resu);
291 if (primary)
u -= resu;
294 primary = (
v >= resv);
296 if (primary)
v -= resv;
305 case e_bottom:
v +=
res.v();
break;
307 case e_top:
u +=
res.u();
break;
308 case e_left:
u +=
res.u();
v +=
res.v();
break;
326 for (
int i =
uw/2; i > 0; i--) {
327 *dst++ = src[0] + src[1];
355 for (
int i =
vw/2; i > 0; i--) {
356 *dst++ = src[0] + src[1];
373 float* src =
ku +
uw-1;
374 float* dst =
ku +
uw*2-2;
375 for (
int i =
uw; i > 0; i--) {
376 dst[0] = dst[1] = *src-- / 2;
386 float* src =
kv +
vw-1;
387 float* dst =
kv +
vw*2-2;
388 for (
int i =
vw; i > 0; i--) {
389 dst[0] = dst[1] = *src-- / 2;
399 assert(
u == 0 &&
v == 0);
402 if (
res.ulog2 >
res.vlog2) {
405 else if (
res.vlog2 >
res.ulog2) {
414 for (
int i = 0; i <
uw; i++) {
415 float sum =
ku[i] +
kv[i];
419 newWeight *= newWeight;
422 float scale = newWeight == 0 ? 1.f : initialWeight / newWeight;
445 for (
int i = 0; i <
uw; i++)
ku[i] *= -1;
446 newWeight = -newWeight;
450 for (
int i = 0; i <
uw; i++)
ku[i] *= scale;
451 newWeight = initialWeight;
457 void apply(
float* dst,
void* data, DataType dt,
int nChan,
int nTxChan)
461 fn(*
this, dst, data, nChan, nTxChan);
464 void applyConst(
float* dst,
void* data, DataType dt,
int nChan)
477 for (
const float* e = p + n; p != e; p++) result += *p;
#define PTEX_NAMESPACE_END
Public API classes for reading, writing, caching, and filtering Ptex files.
void mergeT(BorderMode mode)
void mergeB(BorderMode mode)
void apply(float *dst, void *data, DataType dt, int nChan, int nTxChan)
float makeSymmetric(float initialWeight)
void(* ApplyConstFn)(float weight, float *dst, void *data, int nChan)
void set(Res resVal, int uVal, int vVal, int uwVal, int vwVal, const float *kuVal, const float *kvVal, int rotVal=0)
void splitT(PtexSeparableKernel &k)
void adjustSubfaceToMain(int eid)
void splitB(PtexSeparableKernel &k)
PtexSeparableKernel(const PtexSeparableKernel &k)
void(* ApplyFn)(PtexSeparableKernel &k, float *dst, void *data, int nChan, int nTxChan)
static ApplyConstFn applyConstFunctions[20]
static ApplyFn applyFunctions[40]
PtexSeparableKernel & operator=(const PtexSeparableKernel &k)
void splitL(PtexSeparableKernel &k)
void mergeR(BorderMode mode)
void applyConst(float *dst, void *data, DataType dt, int nChan)
bool adjustMainToSubface(int eid)
void mergeL(BorderMode mode)
void splitR(PtexSeparableKernel &k)
static float accumulate(const float *p, int n)
void applyConst(float weight, float *dst, void *data, Ptex::DataType dt, int nChan)