Ptex: PtexUtils Namespace Reference

Ptex

Classes | Typedefs | Functions | Variables
PtexUtils Namespace Reference

## Classes
struct | VecAccum
struct | VecAccum< T, 0 >
struct | VecAccumN
struct | VecMult
struct | VecMult< T, 0 >
struct | VecMultN

## Typedefs
typedef void | ReduceFn(const void *src, int sstride, int ures, int vres, void *dst, int dstride, DataType dt, int nchannels)
typedef void(* | ApplyConstFn) (float weight, float *dst, void *data, int nChan)

## Functions
bool | isConstant (const void *data, int stride, int ures, int vres, int pixelSize)
void | interleave (const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
void | deinterleave (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)
void | decodeDifference (void *data, int size, DataType dt)
void | reduce (const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
void | reduceu (const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
void | reducev (const void *src, int sstride, int uw, int vw, void *dst, int dstride, DataType dt, int nchan)
void | reduceTri (const void *src, int sstride, int w, int, void *dst, int dstride, DataType dt, int nchan)
void | fill (const void *src, void *dst, int dstride, int ures, int vres, int pixelsize)
void | copy (const void *src, int sstride, void *dst, int dstride, int vres, int rowlen)
void | blend (const void *src, float weight, void *dst, bool flip, int rowlen, DataType dt, int nchan)
void | average (const void *src, int sstride, int uw, int vw, void *dst, DataType dt, int nchan)
void | multalpha (void *data, int npixels, DataType dt, int nchannels, int alphachan)
void | divalpha (void *data, int npixels, DataType dt, int nchannels, int alphachan)
void | genRfaceids (const FaceInfo *faces, int nfaces, uint32_t *rfaceids, uint32_t *faceids)
bool | isPowerOfTwo (int x)
uint32_t | ones (uint32_t x)
uint32_t | floor_log2 (uint32_t x)
uint32_t | ceil_log2 (uint32_t x)
float | reciprocalPow2 (int power)
int | calcResFromWidth (float w)
float | smoothstep (float x, float a, float b)
float | qsmoothstep (float x, float a, float b)
template<typename T >
T | abs (T x)
float | abs (float x)
template<typename T >
T | min (T a, T b)
template<typename T >
T | max (T a, T b)
template<typename T >
T | clamp (T x, T lo, T hi)
template<typename T >
T | halve (T val)
float | halve (float val)
PtexHalf | halve (PtexHalf val)
template<typename T >
T | quarter (T val)
float | quarter (float val)
PtexHalf | quarter (PtexHalf val)
void | applyConst (float weight, float *dst, void *data, Ptex::DataType dt, int nChan)

## Variables
ApplyConstFn | applyConstFunctions [20]

## Typedef Documentation

## ◆ ApplyConstFn

typedef void(* PtexUtils::ApplyConstFn) (float weight, float *dst, void *data, int nChan)

Definition at line 244 of file PtexUtils.h.

## ◆ ReduceFn

typedef void PtexUtils::ReduceFn(const void *src, int sstride, int ures, int vres, void *dst, int dstride, DataType dt, int nchannels)

Definition at line 174 of file PtexUtils.h.

## Function Documentation

## ◆ abs() [1/2]

template<typename T >

T PtexUtils::abs | ( | T | x | ) |
| inline

Definition at line 133 of file PtexUtils.h.

Referenced by PtexWidth4Filter::blur(), PtexSeparableFilter::eval(), and PtexBicubicFilter::kernelFn().

## ◆ abs() [2/2]

float PtexUtils::abs | ( | float | x | ) |
| inline

Definition at line 135 of file PtexUtils.h.

## ◆ applyConst()

void PtexUtils::applyConst | ( | float | weight,
|  | float * | dst,
|  | void * | data,
|  | Ptex::DataType | dt,
|  | int | nChan
| ) |  |
| inline

Definition at line 246 of file PtexUtils.h.

References PTEX_NAMESPACE_END.

Referenced by PtexTriangleKernelIter::applyConst(), and PtexSeparableKernel::applyConst().

## ◆ average()

void PtexUtils::average | ( | const void * | src,
|  | int | sstride,
|  | int | uw,
|  | int | vw,
|  | void * | dst,
|  | DataType | dt,
|  | int | nchan
| ) |  |

Definition at line 516 of file PtexUtils.cpp.

References Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, and Ptex::dt_uint8.

Referenced by blend(), PtexMainWriter::storeConstValue(), and PtexIncrWriter::writeFace().

## ◆ blend()

void PtexUtils::blend | ( | const void * | src,
|  | float | weight,
|  | void * | dst,
|  | bool | flip,
|  | int | rowlen,
|  | DataType | dt,
|  | int | nchan
| ) |  |

Definition at line 474 of file PtexUtils.cpp.

References average(), Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, and Ptex::dt_uint8.

Referenced by copy().

## ◆ calcResFromWidth()

int PtexUtils::calcResFromWidth | ( | float | w | ) |
| inline

Definition at line 102 of file PtexUtils.h.

Referenced by PtexTriangleFilter::buildKernel(), PtexBoxFilter::buildKernel(), PtexBilinearFilter::buildKernel(), and PtexWidth4Filter::buildKernelAxis().

## ◆ ceil_log2()

uint32_t PtexUtils::ceil_log2 | ( | uint32_t | x | ) |
| inline

Definition at line 79 of file PtexUtils.h.

References isPowerOfTwo(), and ones().

## ◆ clamp()

template<typename T >

T PtexUtils::clamp | ( | T | x,
|  | T | lo,
|  | T | hi
| ) |  |
| inline

Definition at line 153 of file PtexUtils.h.

References max(), and min().

Referenced by PtexSeparableFilter::eval(), PtexPointFilter::eval(), PtexTriangleFilter::eval(), PtexPointFilterTri::eval(), and MetaDataTypeName().

## ◆ copy()

void PtexUtils::copy | ( | const void * | src,
|  | int | sstride,
|  | void * | dst,
|  | int | dstride,
|  | int | vres,
|  | int | rowlen
| ) |  |

Definition at line 432 of file PtexUtils.cpp.

References blend().

Referenced by PtexReader::getData(), PtexReader::TiledFaceBase::reduce(), PtexMainWriter::writeFace(), and PtexIncrWriter::writeFace().

## ◆ decodeDifference()

void PtexUtils::decodeDifference | ( | void * | data,
|  | int | size,
|  | DataType | dt
| ) |  |

Definition at line 265 of file PtexUtils.cpp.

References Ptex::dt_uint16, Ptex::dt_uint8, quarter(), and reduce().

Referenced by encodeDifference(), quarter(), and PtexReader::readFaceData().

## ◆ deinterleave()

void PtexUtils::deinterleave | ( | const void * | src,
|  | int | sstride,
|  | int | uw,
|  | int | vw,
|  | void * | dst,
|  | int | dstride,
|  | DataType | dt,
|  | int | nchan
| ) |  |

Definition at line 220 of file PtexUtils.cpp.

References Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, Ptex::dt_uint8, and encodeDifference().

Referenced by interleave(), quarter(), and PtexWriterBase::writeFaceBlock().

## ◆ divalpha()

void PtexUtils::divalpha | ( | void * | data,
|  | int | npixels,
|  | DataType | dt,
|  | int | nchannels,
|  | int | alphachan
| ) |  |

Definition at line 612 of file PtexUtils.cpp.

References Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, Ptex::dt_uint8, and Ptex::OneValue().

Referenced by multalpha(), PtexMainWriter::storeConstValue(), and PtexIncrWriter::writeFace().

## ◆ encodeDifference()

void PtexUtils::encodeDifference | ( | void * | data,
|  | int | size,
|  | DataType | dt
| ) |  |

Definition at line 245 of file PtexUtils.cpp.

References decodeDifference(), Ptex::dt_uint16, and Ptex::dt_uint8.

Referenced by deinterleave(), quarter(), and PtexWriterBase::writeFaceBlock().

## ◆ fill()

void PtexUtils::fill | ( | const void * | src,
|  | void * | dst,
|  | int | dstride,
|  | int | ures,
|  | int | vres,
|  | int | pixelsize
| ) |  |

Definition at line 416 of file PtexUtils.cpp.

Referenced by PtexReader::getData(), PtexReader::TiledReducedFace::getTile(), and PtexReader::TiledFaceBase::reduce().

## ◆ floor_log2()

uint32_t PtexUtils::floor_log2 | ( | uint32_t | x | ) |
| inline

Definition at line 68 of file PtexUtils.h.

References ones().

Referenced by PtexWriterBase::calcTileRes().

## ◆ genRfaceids()

void PtexUtils::genRfaceids | ( | const FaceInfo * | faces,
|  | int | nfaces,
|  | uint32_t * | rfaceids,
|  | uint32_t * | faceids
| ) |  |

Definition at line 624 of file PtexUtils.cpp.

Referenced by PtexMainWriter::generateReductions(), and PtexReader::readFaceInfo().

## ◆ halve() [1/3]

template<typename T >

T PtexUtils::halve | ( | T | val | ) |
| inline

Definition at line 156 of file PtexUtils.h.

Referenced by reduce(), and reduceu().

## ◆ halve() [2/3]

float PtexUtils::halve | ( | float | val | ) |
| inline

Definition at line 158 of file PtexUtils.h.

## ◆ halve() [3/3]

PtexHalf PtexUtils::halve | ( | PtexHalf | val | ) |
| inline

Definition at line 159 of file PtexUtils.h.

## ◆ interleave()

void PtexUtils::interleave | ( | const void * | src,
|  | int | sstride,
|  | int | uw,
|  | int | vw,
|  | void * | dst,
|  | int | dstride,
|  | DataType | dt,
|  | int | nchan
| ) |  |

Definition at line 183 of file PtexUtils.cpp.

References deinterleave(), Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, and Ptex::dt_uint8.

Referenced by isConstant(), quarter(), and PtexReader::readFaceData().

## ◆ isConstant()

bool PtexUtils::isConstant | ( | const void * | data,
|  | int | stride,
|  | int | ures,
|  | int | vres,
|  | int | pixelSize
| ) |  |

Definition at line 141 of file PtexUtils.cpp.

References interleave().

Referenced by quarter(), PtexMainWriter::writeFace(), PtexIncrWriter::writeFace(), PtexWriterBase::writeFaceData(), and PtexFaceData::~PtexFaceData().

## ◆ isPowerOfTwo()

bool PtexUtils::isPowerOfTwo | ( | int | x | ) |
| inline

Definition at line 52 of file PtexUtils.h.

Referenced by ceil_log2().

## ◆ max()

template<typename T >

T PtexUtils::max | ( | T | a,
|  | T | b
| ) |  |
| inline

Definition at line 150 of file PtexUtils.h.

Referenced by PtexReaderCache::adjustFilesOpen(), PtexReaderCache::adjustMemUsed(), PTEX_NAMESPACE_BEGIN::Apply(), PtexTriangleKernelIter::applyConst(), PtexTriangleFilter::applyIter(), PTEX_NAMESPACE_BEGIN::ApplyN(), PTEX_NAMESPACE_BEGIN::ApplyS(), PtexTriangleFilter::buildKernel(), PtexBoxFilter::buildKernel(), PtexBilinearFilter::buildKernel(), PtexWidth4Filter::buildKernelAxis(), clamp(), PtexTriangleKernel::clampExtent(), PtexMainWriter::generateReductions(), and PtexReader::open().

## ◆ min()

template<typename T >

T PtexUtils::min | ( | T | a,
|  | T | b
| ) |  |
| inline

Definition at line 147 of file PtexUtils.h.

Referenced by PTEX_NAMESPACE_BEGIN::Apply(), PtexSeparableFilter::apply(), PtexTriangleKernelIter::applyConst(), PtexTriangleFilter::applyIter(), PTEX_NAMESPACE_BEGIN::ApplyN(), PTEX_NAMESPACE_BEGIN::ApplyS(), PtexTriangleFilter::buildKernel(), PtexBoxFilter::buildKernel(), PtexBilinearFilter::buildKernel(), PtexWriterBase::calcTileRes(), clamp(), PtexTriangleKernel::clampExtent(), PtexTriangleKernel::clampRes(), PtexSeparableFilter::eval(), PtexTriangleFilter::eval(), PtexIncrWriter::finish(), PtexMainWriter::generateReductions(), PtexReader::getPixel(), PtexSeparableKernel::makeSymmetric(), PtexReader::open(), PtexIncrWriter::PtexIncrWriter(), and PtexReader::reopenFP().

## ◆ multalpha()

void PtexUtils::multalpha | ( | void * | data,
|  | int | npixels,
|  | DataType | dt,
|  | int | nchannels,
|  | int | alphachan
| ) |  |

Definition at line 573 of file PtexUtils.cpp.

References divalpha(), Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, Ptex::dt_uint8, and Ptex::OneValueInv().

Referenced by PtexReader::readConstData(), PtexReader::readEditFaceData(), PtexReader::readFaceData(), PtexMainWriter::writeFace(), and PtexIncrWriter::writeFace().

## ◆ ones()

uint32_t PtexUtils::ones | ( | uint32_t | x | ) |
| inline

Definition at line 57 of file PtexUtils.h.

Referenced by ceil_log2(), and floor_log2().

## ◆ qsmoothstep()

float PtexUtils::qsmoothstep | ( | float | x,
|  | float | a,
|  | float | b
| ) |  |
| inline

Definition at line 123 of file PtexUtils.h.

## ◆ quarter() [1/3]

template<typename T >

T PtexUtils::quarter | ( | T | val | ) |
| inline

Definition at line 162 of file PtexUtils.h.

Referenced by decodeDifference(), and reducev().

## ◆ quarter() [2/3]

float PtexUtils::quarter | ( | float | val | ) |
| inline

Definition at line 164 of file PtexUtils.h.

## ◆ quarter() [3/3]

PtexHalf PtexUtils::quarter | ( | PtexHalf | val | ) |
| inline

Definition at line 165 of file PtexUtils.h.

References decodeDifference(), deinterleave(), encodeDifference(), interleave(), and isConstant().

## ◆ reciprocalPow2()

float PtexUtils::reciprocalPow2 | ( | int | power | ) |
| inline

Definition at line 91 of file PtexUtils.h.

Referenced by PtexBoxFilter::buildKernel(), PtexBilinearFilter::buildKernel(), and PtexWidth4Filter::buildKernelAxis().

## ◆ reduce()

void PtexUtils::reduce | ( | const void * | src,
|  | int | sstride,
|  | int | uw,
|  | int | vw,
|  | void * | dst,
|  | int | dstride,
|  | DataType | dt,
|  | int | nchan
| ) |  |

Definition at line 293 of file PtexUtils.cpp.

References Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, Ptex::dt_uint8, halve(), and reduceu().

Referenced by decodeDifference(), PtexReader::ConstantFace::getPixel(), PtexReader::PackedFace::getTile(), PtexWriterBase::PtexWriterBase(), PtexReader::FaceData::res(), and PtexReader::TiledFaceBase::tileRes().

## ◆ reduceTri()

void PtexUtils::reduceTri | ( | const void * | src,
|  | int | sstride,
|  | int | w,
|  | int | ,
|  | void * | dst,
|  | int | dstride,
|  | DataType | dt,
|  | int | nchan
| ) |  |

Definition at line 400 of file PtexUtils.cpp.

References Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, and Ptex::dt_uint8.

Referenced by PtexReader::getData(), PtexWriterBase::PtexWriterBase(), and reducev().

## ◆ reduceu()

void PtexUtils::reduceu | ( | const void * | src,
|  | int | sstride,
|  | int | uw,
|  | int | vw,
|  | void * | dst,
|  | int | dstride,
|  | DataType | dt,
|  | int | nchan
| ) |  |

Definition at line 327 of file PtexUtils.cpp.

References Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, Ptex::dt_uint8, halve(), and reducev().

Referenced by PtexReader::getData(), and reduce().

## ◆ reducev()

void PtexUtils::reducev | ( | const void * | src,
|  | int | sstride,
|  | int | uw,
|  | int | vw,
|  | void * | dst,
|  | int | dstride,
|  | DataType | dt,
|  | int | nchan
| ) |  |

Definition at line 360 of file PtexUtils.cpp.

References Ptex::dt_float, Ptex::dt_half, Ptex::dt_uint16, Ptex::dt_uint8, quarter(), and reduceTri().

Referenced by PtexReader::getData(), and reduceu().

## ◆ smoothstep()

float PtexUtils::smoothstep | ( | float | x,
|  | float | a,
|  | float | b
| ) |  |
| inline

Definition at line 115 of file PtexUtils.h.

## Variable Documentation

## ◆ applyConstFunctions

ApplyConstFn PtexUtils::applyConstFunctions

Initial value:
= {
ApplyConstN<uint8_t>, ApplyConstN<uint16_t>, ApplyConstN<PtexHalf>, ApplyConstN<float>,
ApplyConst<uint8_t,1>, ApplyConst<uint16_t,1>, ApplyConst<PtexHalf,1>, ApplyConst<float,1>,
ApplyConst<uint8_t,2>, ApplyConst<uint16_t,2>, ApplyConst<PtexHalf,2>, ApplyConst<float,2>,
ApplyConst<uint8_t,3>, ApplyConst<uint16_t,3>, ApplyConst<PtexHalf,3>, ApplyConst<float,3>,
ApplyConst<uint8_t,4>, ApplyConst<uint16_t,4>, ApplyConst<PtexHalf,4>, ApplyConst<float,4>,
}

Definition at line 662 of file PtexUtils.cpp.