Go to the documentation of this file. 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;
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;
461 fn(*
this, dst, data, nChan, nTxChan);
477 for (
const float* e = p + n; p != e; p++) result += *p;
void(* ApplyConstFn)(float weight, float *dst, void *data, int nChan)
@ e_top
Top edge, from UV (1,1) to (0,1)
static ApplyFn applyFunctions[40]
#define PTEX_NAMESPACE_END
void splitT(PtexSeparableKernel &k)
void mergeT(BorderMode mode)
void adjustSubfaceToMain(int eid)
void splitR(PtexSeparableKernel &k)
bool adjustMainToSubface(int eid)
PtexSeparableKernel & operator=(const PtexSeparableKernel &k)
@ m_black
texel beyond border are assumed to be black
static ApplyConstFn applyConstFunctions[20]
DataType
Type of data stored in texture file.
void splitL(PtexSeparableKernel &k)
void mergeL(BorderMode mode)
void set(Res resVal, int uVal, int vVal, int uwVal, int vwVal, const float *kuVal, const float *kvVal, int rotVal=0)
void mergeB(BorderMode mode)
void applyConst(float weight, float *dst, void *data, Ptex::DataType dt, int nChan)
PtexSeparableKernel(const PtexSeparableKernel &k)
void applyConst(float *dst, void *data, DataType dt, int nChan)
@ e_bottom
Bottom edge, from UV (0,0) to (1,0)
@ e_right
Right edge, from UV (1,0) to (1,1)
static float accumulate(const float *p, int n)
@ e_left
Left edge, from UV (0,1) to (0,0)
void(* ApplyFn)(PtexSeparableKernel &k, float *dst, void *data, int nChan, int nTxChan)
void splitB(PtexSeparableKernel &k)
void apply(float *dst, void *data, DataType dt, int nChan, int nTxChan)
void mergeR(BorderMode mode)
float makeSymmetric(float initialWeight)
Public API classes for reading, writing, caching, and filtering Ptex files.
BorderMode
How to handle mesh border when filtering.