HDK
|
#include <PXL_DeepSampleList.h>
Classes | |
class | Sum |
Class to help with weighted sums of pixels. More... | |
Public Types | |
enum | SampleFlag { VOLUME_SAMPLE = 0x01, MATTE_SURFACE = 0x02 } |
Public Member Functions | |
PXL_DeepSampleList (const PXL_DeepChannelListPtr &channels, int nsamples, bool precomposited) | |
PXL_DeepSampleList (const PXL_DeepSampleList &src) | |
~PXL_DeepSampleList () | |
PXL_DeepSampleList & | operator= (const PXL_DeepSampleList &src)=delete |
PXL_DeepSampleListPtr | splitSegments (const PXL_DeepSampleList &l) const |
void | clear () |
int | sampleCapacity () const |
Return the maximum number of samples. More... | |
bool | preComposited () const |
void | setSampleCount (int nsamples) |
void | setPreComposited (bool c) |
Set the pre-composited state. More... | |
const PXL_DeepChannelListPtr & | channels () const |
Accessors. More... | |
float | zfront (int sample) const |
Return z-back for given sample. More... | |
const float * | zfront (float *storage, int start=0, int end=-1) const |
float | zback (int sample) const |
Return z-back for a given sample. More... | |
const float * | zback (float *storage, int start=0, int end=-1) const |
float | zmid (int sample) const |
Return the z midpoint for a given sample. More... | |
uint8 | flags (int sample) const |
Return flags for a given sample (see SampleFlag enum) More... | |
bool | isVolume (int sample) const |
Check to see whether a sample is a volume. More... | |
bool | isMatte (int sample) const |
Check to see whether a sample is a matte sample. More... | |
const uint8 * | flags (uint8 *storage, int start=0, int end=-1) const |
uint64 | coverage (int sample) const |
Return the sub-sample pixel location for a given sample. More... | |
const uint64 * | coverage (uint64 *storage, int start=0, int end=-1) const |
const float * | channelData (int channel, int sample, float *storage) const |
const float * | channelData (int channel, float *storage, int start=0, int end=-1) const |
bool | save (UT_JSONWriter &j, const PXL_DeepChannelListPtr &channels) const |
Encode the sample list into a JSON stream. More... | |
void | dump (const PXL_DeepChannelListPtr &channels, const char *msg="", int start=0, int end=-1) const |
Dump sample list for debugging. More... | |
void | dump (const char *msg="", int start=0, int end=-1) const |
Dump sample list (without channel data) for debugging. More... | |
const float * | fillZfront (float *storage, int start, int end) const |
const float * | fillZback (float *storage, int start, int end) const |
const uint8 * | fillSampleFlags (uint8 *storage, int start, int end) const |
const uint64 * | fillCoverage (uint64 *storage, int start, int end) const |
const float * | fillChannel (int ch, float *storage, int start, int end) const |
uint8 * | flagBuffer () |
uint64 * | coverageBuffer () |
Get write-able array of coverage. More... | |
float * | channelBuffer (int i) |
Get write-able array of data for a given channel. More... | |
const uint8 * | flagBuffer () const |
const uint64 * | coverageBuffer () const |
Get read-only array of coverages. More... | |
const float * | channelBuffer (int i) const |
Get read-only array of data for a given channel. More... | |
int | findFullOpacity (int of_channel, float opacity_thresh=1.0) const |
void | trimLength (int nrecords) |
Trim the list to the number of records specified. More... | |
void | copySample (int didx, const PXL_DeepSampleList &s, int sidx, float scale=1) |
void | extractSegment (int didx, const PXL_DeepSampleList &s, int sidx, float zf, float zb, float scale=1) |
Split the source sample into the destination index at the given z value. More... | |
void | setConditional (int didx, const PXL_DeepSampleList &s, int sidx) |
void | addSample (int didx, const PXL_DeepSampleList &s, int sidx, float scale=1) |
void | zeroData () |
Initialize all records to zero. More... | |
void | zeroData (int sample) |
Clear a single sample. More... | |
void | composite (int of_channel, bool force=false) |
Perform compositing on the sample array using the given opacity channel. More... | |
void | uncomposite (int of_channel, bool force=false) |
Perform uncompositing of sampels using the opacity channel. More... | |
int | sampleCount () const |
int | size () const |
float * | zfrontBuffer () |
float * | zbackBuffer () |
const float * | zfrontBuffer () const |
const float * | zbackBuffer () const |
void | copyZfront (const PXL_DeepSampleList &s) |
void | copyZback (const PXL_DeepSampleList &s) |
void | copyZ (const PXL_DeepSampleList &s) |
void | copyFlags (const PXL_DeepSampleList &s) |
void | copySampleId (const PXL_DeepSampleList &s) |
void | copyChannel (int ch, const PXL_DeepSampleList &s) |
void | copyAllChannels (const PXL_DeepSampleList &s) |
Public Member Functions inherited from UT_IntrusiveRefCounter< PXL_DeepSampleList > | |
SYS_FORCE_INLINE | UT_IntrusiveRefCounter () noexcept |
Default constructor: Sets counter to 0. More... | |
SYS_FORCE_INLINE | UT_IntrusiveRefCounter (const UT_IntrusiveRefCounter &) noexcept |
Copy constructor: Sets counter to 0. More... | |
UT_IntrusiveRefCounter & | operator= (const UT_IntrusiveRefCounter &) noexcept |
Assignment operator: Does not modify counter. More... | |
SYS_FORCE_INLINE uint32 | use_count () const noexcept |
Return current counter. More... | |
SYS_FORCE_INLINE bool | conditionalAddRef () noexcept |
Static Public Member Functions | |
static PXL_DeepSampleListPtr | combine (const PXL_DeepSampleListPtr &a, const PXL_DeepSampleListPtr &b) |
static bool | save (UT_JSONWriter &j, const PXL_DeepSampleListPtr &list, const PXL_DeepChannelListPtr &channels) |
Save, handling null pointers properly. More... | |
static PXL_DeepSampleListPtr | load (UT_JSONParser &j, const PXL_DeepChannelListPtr &c) |
Additional Inherited Members | |
Protected Member Functions inherited from UT_IntrusiveRefCounter< PXL_DeepSampleList > | |
SYS_FORCE_INLINE | ~UT_IntrusiveRefCounter () |
Destructor: Only derived classes can destruct this. More... | |
Class to represent a list of deep pixel samples.
The class stores multiple samples for multiple image channels. The image channels Each pixel list has:
int sampleCount
float z
: uint8 flags
: uint64 coverage
: float *channel_data
: The coverage mask will either be 0 (indicating full coverage) or a bit-mask representing the coverage. If there are more than 64 samples, the sample id's rotate (i.e. mask |= 1 << (sample_id % 64)).
Definition at line 41 of file PXL_DeepSampleList.h.
Enumerator | |
---|---|
VOLUME_SAMPLE | |
MATTE_SURFACE |
Definition at line 68 of file PXL_DeepSampleList.h.
PXL_DeepSampleList::PXL_DeepSampleList | ( | const PXL_DeepChannelListPtr & | channels, |
int | nsamples, | ||
bool | precomposited | ||
) |
PXL_DeepSampleList::PXL_DeepSampleList | ( | const PXL_DeepSampleList & | src | ) |
PXL_DeepSampleList::~PXL_DeepSampleList | ( | ) |
void PXL_DeepSampleList::addSample | ( | int | didx, |
const PXL_DeepSampleList & | s, | ||
int | sidx, | ||
float | scale = 1 |
||
) |
Add the source sample to this sample (with an optional scale). This only adjusts non-ordinal channels.
Get write-able array of data for a given channel.
Definition at line 233 of file PXL_DeepSampleList.h.
Get read-only array of data for a given channel.
Definition at line 245 of file PXL_DeepSampleList.h.
|
inline |
Return the channel data for a given sample. The storage
array must contain at least channelSize(channel)
floats.
Definition at line 159 of file PXL_DeepSampleList.h.
|
inline |
Return all the data for a given channel. The storage
array must be at least sampleCount()*channelSize
(channel) floats.
Definition at line 163 of file PXL_DeepSampleList.h.
|
inline |
Accessors.
Definition at line 95 of file PXL_DeepSampleList.h.
void PXL_DeepSampleList::clear | ( | ) |
Clear buffers etc. This keeps a reference to the channels and the precompositing state.
|
static |
Merge two lists sorted into a single list. If the definition of the pixel lists (i.e. the channels) don't match, then the method will return a
. The method properly handles nullptr
values.
Perform compositing on the sample array using the given opacity channel.
void PXL_DeepSampleList::copyAllChannels | ( | const PXL_DeepSampleList & | s | ) |
Copy over data from a source sample list
void PXL_DeepSampleList::copyChannel | ( | int | ch, |
const PXL_DeepSampleList & | s | ||
) |
Copy over data from a source sample list
void PXL_DeepSampleList::copyFlags | ( | const PXL_DeepSampleList & | s | ) |
Copy over data from a source sample list
void PXL_DeepSampleList::copySample | ( | int | didx, |
const PXL_DeepSampleList & | s, | ||
int | sidx, | ||
float | scale = 1 |
||
) |
Copy the source sample into the destination index. If a scale
is specified, the channel data will be scaled by that amount.
void PXL_DeepSampleList::copySampleId | ( | const PXL_DeepSampleList & | s | ) |
Copy over data from a source sample list
|
inline |
Copy over data from a source sample list
Definition at line 258 of file PXL_DeepSampleList.h.
void PXL_DeepSampleList::copyZback | ( | const PXL_DeepSampleList & | s | ) |
Copy over data from a source sample list
void PXL_DeepSampleList::copyZfront | ( | const PXL_DeepSampleList & | s | ) |
Copy over data from a source sample list
Return the sub-sample pixel location for a given sample.
Definition at line 149 of file PXL_DeepSampleList.h.
|
inline |
Return an array of the sub-pixel locations for all samples. See zfront()
for an explanation of the storage
array.
Definition at line 153 of file PXL_DeepSampleList.h.
|
inline |
Get write-able array of coverage.
Definition at line 231 of file PXL_DeepSampleList.h.
|
inline |
Get read-only array of coverages.
Definition at line 243 of file PXL_DeepSampleList.h.
void PXL_DeepSampleList::dump | ( | const PXL_DeepChannelListPtr & | channels, |
const char * | msg = "" , |
||
int | start = 0 , |
||
int | end = -1 |
||
) | const |
Dump sample list for debugging.
Dump sample list (without channel data) for debugging.
void PXL_DeepSampleList::extractSegment | ( | int | didx, |
const PXL_DeepSampleList & | s, | ||
int | sidx, | ||
float | zf, | ||
float | zb, | ||
float | scale = 1 |
||
) |
Split the source sample into the destination index at the given z value.
|
inline |
Return a pointer to an array of the channel data. See fillZfront()
for explanation of storage
.
Definition at line 220 of file PXL_DeepSampleList.h.
|
inline |
Return a pointer to an array of the sub-pixel locations. See fillZfront()
for explanation of storage
.
Definition at line 216 of file PXL_DeepSampleList.h.
|
inline |
Return a pointer to an array of the sample flags. See fillZfront()
for explanation of storage
.
Definition at line 212 of file PXL_DeepSampleList.h.
Return a pointer to an array of the z-back flags. See fillZfront()
for explanation of storage
.
Definition at line 208 of file PXL_DeepSampleList.h.
The returns the number of records in the list before full opacity is reached.
|
inline |
Get write-able array of flags
Definition at line 229 of file PXL_DeepSampleList.h.
|
inline |
Get read-only array of flags
Definition at line 241 of file PXL_DeepSampleList.h.
Return flags for a given sample (see SampleFlag enum)
Definition at line 134 of file PXL_DeepSampleList.h.
|
inline |
Fill buffer with flags for the samples (see SampleFlag enum). See zfront()
for an explanation of the storage
array.
Definition at line 145 of file PXL_DeepSampleList.h.
|
inline |
Check to see whether a sample is a matte sample.
Definition at line 141 of file PXL_DeepSampleList.h.
|
inline |
Check to see whether a sample is a volume.
Definition at line 137 of file PXL_DeepSampleList.h.
|
static |
See PXL_DeepSampleList::save(). This method will create a sample list from an encoded sample.
|
delete |
|
inline |
Return whether the samples in the list are pre-composited or un-composited
Definition at line 85 of file PXL_DeepSampleList.h.
|
inline |
Return the maximum number of samples.
Definition at line 81 of file PXL_DeepSampleList.h.
|
inline |
Return number of samples in the deep pixel list
Definition at line 76 of file PXL_DeepSampleList.h.
bool PXL_DeepSampleList::save | ( | UT_JSONWriter & | j, |
const PXL_DeepChannelListPtr & | channels | ||
) | const |
Encode the sample list into a JSON stream.
|
static |
Save, handling null pointers properly.
void PXL_DeepSampleList::setConditional | ( | int | didx, |
const PXL_DeepSampleList & | s, | ||
int | sidx | ||
) |
Set conditinal assignment based on weight. This only adjusts ordinal channels.
|
inline |
Set the pre-composited state.
Definition at line 92 of file PXL_DeepSampleList.h.
Initialize data structures, possibly enlarging buffers for the sample count.
Return number of samples in the deep pixel list
Definition at line 77 of file PXL_DeepSampleList.h.
PXL_DeepSampleListPtr PXL_DeepSampleList::splitSegments | ( | const PXL_DeepSampleList & | l | ) | const |
Split any volume segments into multiple segements based on the z values of the other sample list.
Trim the list to the number of records specified.
Definition at line 252 of file PXL_DeepSampleList.h.
Perform uncompositing of sampels using the opacity channel.
Return z-back for a given sample.
Definition at line 122 of file PXL_DeepSampleList.h.
|
inline |
Return a buffer with all z-back values for all samples. See zfront()
for an explanation of the storage
array.
Definition at line 126 of file PXL_DeepSampleList.h.
|
inline |
Get write-able array of z values.
Definition at line 226 of file PXL_DeepSampleList.h.
|
inline |
Get read-only array of z values.
Definition at line 238 of file PXL_DeepSampleList.h.
void PXL_DeepSampleList::zeroData | ( | ) |
Initialize all records to zero.
Return z-back for given sample.
Definition at line 109 of file PXL_DeepSampleList.h.
|
inline |
Return a buffer with all z-front values for all samples.
If the sample list doesn't store the z-front values in a flat array, the values will be copied to the storage
array and that value will be returned. If the sample list is able to return a pointer to internal data, the storage
array will be left unchanged.
Definition at line 118 of file PXL_DeepSampleList.h.
|
inline |
Get write-able array of z values.
Definition at line 225 of file PXL_DeepSampleList.h.
|
inline |
Get read-only array of z values.
Definition at line 237 of file PXL_DeepSampleList.h.
Return the z midpoint for a given sample.
Definition at line 130 of file PXL_DeepSampleList.h.