HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PXL_DeepSampleList Class Reference

#include <PXL_DeepSampleList.h>

+ Inheritance diagram for PXL_DeepSampleList:

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_DeepSampleListoperator= (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_DeepChannelListPtrchannels () const
 Accessors. More...
 
float zfront (int sample) const
 Return z-back for given sample. More...
 
const floatzfront (float *storage, int start=0, int end=-1) const
 
float zback (int sample) const
 Return z-back for a given sample. More...
 
const floatzback (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 uint8flags (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 uint64coverage (uint64 *storage, int start=0, int end=-1) const
 
const floatchannelData (int channel, int sample, float *storage) const
 
const floatchannelData (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 floatfillZfront (float *storage, int start, int end) const
 
const floatfillZback (float *storage, int start, int end) const
 
const uint8fillSampleFlags (uint8 *storage, int start, int end) const
 
const uint64fillCoverage (uint64 *storage, int start, int end) const
 
const floatfillChannel (int ch, float *storage, int start, int end) const
 
uint8flagBuffer ()
 
uint64coverageBuffer ()
 Get write-able array of coverage. More...
 
floatchannelBuffer (int i)
 Get write-able array of data for a given channel. More...
 
const uint8flagBuffer () const
 
const uint64coverageBuffer () const
 Get read-only array of coverages. More...
 
const floatchannelBuffer (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
 
floatzfrontBuffer ()
 
floatzbackBuffer ()
 
const floatzfrontBuffer () const
 
const floatzbackBuffer () 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_IntrusiveRefCounteroperator= (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...
 

Detailed Description

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
    The number of samples in the list Each sample has:
  • float z:
    Z-Depth of the sample
  • uint8 flags:
    Flags associated with the sample
  • uint64 coverage:
    The sample coverage mask
  • float *channel_data:
    Image channel values

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.

Member Enumeration Documentation

Enumerator
VOLUME_SAMPLE 
MATTE_SURFACE 

Definition at line 68 of file PXL_DeepSampleList.h.

Constructor & Destructor Documentation

PXL_DeepSampleList::PXL_DeepSampleList ( const PXL_DeepChannelListPtr channels,
int  nsamples,
bool  precomposited 
)
PXL_DeepSampleList::PXL_DeepSampleList ( const PXL_DeepSampleList src)
PXL_DeepSampleList::~PXL_DeepSampleList ( )

Member Function Documentation

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.

float* PXL_DeepSampleList::channelBuffer ( int  i)
inline

Get write-able array of data for a given channel.

Definition at line 233 of file PXL_DeepSampleList.h.

const float* PXL_DeepSampleList::channelBuffer ( int  i) const
inline

Get read-only array of data for a given channel.

Definition at line 245 of file PXL_DeepSampleList.h.

const float* PXL_DeepSampleList::channelData ( int  channel,
int  sample,
float storage 
) const
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.

const float* PXL_DeepSampleList::channelData ( int  channel,
float storage,
int  start = 0,
int  end = -1 
) const
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.

const PXL_DeepChannelListPtr& PXL_DeepSampleList::channels ( ) const
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 PXL_DeepSampleListPtr PXL_DeepSampleList::combine ( const PXL_DeepSampleListPtr a,
const PXL_DeepSampleListPtr b 
)
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.

void PXL_DeepSampleList::composite ( int  of_channel,
bool  force = false 
)

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

void PXL_DeepSampleList::copyZ ( const PXL_DeepSampleList s)
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

uint64 PXL_DeepSampleList::coverage ( int  sample) const
inline

Return the sub-sample pixel location for a given sample.

Definition at line 149 of file PXL_DeepSampleList.h.

const uint64* PXL_DeepSampleList::coverage ( uint64 storage,
int  start = 0,
int  end = -1 
) const
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.

uint64* PXL_DeepSampleList::coverageBuffer ( )
inline

Get write-able array of coverage.

Definition at line 231 of file PXL_DeepSampleList.h.

const uint64* PXL_DeepSampleList::coverageBuffer ( ) const
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.

void PXL_DeepSampleList::dump ( const char *  msg = "",
int  start = 0,
int  end = -1 
) const

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.

const float* PXL_DeepSampleList::fillChannel ( int  ch,
float storage,
int  start,
int  end 
) const
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.

const uint64* PXL_DeepSampleList::fillCoverage ( uint64 storage,
int  start,
int  end 
) const
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.

const uint8* PXL_DeepSampleList::fillSampleFlags ( uint8 storage,
int  start,
int  end 
) const
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.

const float* PXL_DeepSampleList::fillZback ( float storage,
int  start,
int  end 
) const
inline

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.

const float* PXL_DeepSampleList::fillZfront ( float storage,
int  start,
int  end 
) const
inline

Return a pointer to an array of the sample z-front values. If the data isn't laid out properly for the user, the data can be copied to the storage buffer.

for (int i = start; i != end; ++i) storage[i-start] = getZ(i);
return storage;

Definition at line 204 of file PXL_DeepSampleList.h.

int PXL_DeepSampleList::findFullOpacity ( int  of_channel,
float  opacity_thresh = 1.0 
) const

The returns the number of records in the list before full opacity is reached.

uint8* PXL_DeepSampleList::flagBuffer ( )
inline

Get write-able array of flags

Definition at line 229 of file PXL_DeepSampleList.h.

const uint8* PXL_DeepSampleList::flagBuffer ( ) const
inline

Get read-only array of flags

Definition at line 241 of file PXL_DeepSampleList.h.

uint8 PXL_DeepSampleList::flags ( int  sample) const
inline

Return flags for a given sample (see SampleFlag enum)

Definition at line 134 of file PXL_DeepSampleList.h.

const uint8* PXL_DeepSampleList::flags ( uint8 storage,
int  start = 0,
int  end = -1 
) const
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.

bool PXL_DeepSampleList::isMatte ( int  sample) const
inline

Check to see whether a sample is a matte sample.

Definition at line 141 of file PXL_DeepSampleList.h.

bool PXL_DeepSampleList::isVolume ( int  sample) const
inline

Check to see whether a sample is a volume.

Definition at line 137 of file PXL_DeepSampleList.h.

static PXL_DeepSampleListPtr PXL_DeepSampleList::load ( UT_JSONParser j,
const PXL_DeepChannelListPtr c 
)
static

See PXL_DeepSampleList::save(). This method will create a sample list from an encoded sample.

PXL_DeepSampleList& PXL_DeepSampleList::operator= ( const PXL_DeepSampleList src)
delete
bool PXL_DeepSampleList::preComposited ( ) const
inline

Return whether the samples in the list are pre-composited or un-composited

Definition at line 85 of file PXL_DeepSampleList.h.

int PXL_DeepSampleList::sampleCapacity ( ) const
inline

Return the maximum number of samples.

Definition at line 81 of file PXL_DeepSampleList.h.

int PXL_DeepSampleList::sampleCount ( ) const
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 bool PXL_DeepSampleList::save ( UT_JSONWriter j,
const PXL_DeepSampleListPtr list,
const PXL_DeepChannelListPtr channels 
)
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.

void PXL_DeepSampleList::setPreComposited ( bool  c)
inline

Set the pre-composited state.

Definition at line 92 of file PXL_DeepSampleList.h.

void PXL_DeepSampleList::setSampleCount ( int  nsamples)

Initialize data structures, possibly enlarging buffers for the sample count.

int PXL_DeepSampleList::size ( void  ) const
inline

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.

void PXL_DeepSampleList::trimLength ( int  nrecords)
inline

Trim the list to the number of records specified.

Definition at line 252 of file PXL_DeepSampleList.h.

void PXL_DeepSampleList::uncomposite ( int  of_channel,
bool  force = false 
)

Perform uncompositing of sampels using the opacity channel.

float PXL_DeepSampleList::zback ( int  sample) const
inline

Return z-back for a given sample.

Definition at line 122 of file PXL_DeepSampleList.h.

const float* PXL_DeepSampleList::zback ( float storage,
int  start = 0,
int  end = -1 
) const
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.

float* PXL_DeepSampleList::zbackBuffer ( )
inline

Get write-able array of z values.

Definition at line 226 of file PXL_DeepSampleList.h.

const float* PXL_DeepSampleList::zbackBuffer ( ) const
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.

void PXL_DeepSampleList::zeroData ( int  sample)

Clear a single sample.

float PXL_DeepSampleList::zfront ( int  sample) const
inline

Return z-back for given sample.

Definition at line 109 of file PXL_DeepSampleList.h.

const float* PXL_DeepSampleList::zfront ( float storage,
int  start = 0,
int  end = -1 
) const
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.

float* PXL_DeepSampleList::zfrontBuffer ( )
inline

Get write-able array of z values.

Definition at line 225 of file PXL_DeepSampleList.h.

const float* PXL_DeepSampleList::zfrontBuffer ( ) const
inline

Get read-only array of z values.

Definition at line 237 of file PXL_DeepSampleList.h.

float PXL_DeepSampleList::zmid ( int  sample) const
inline

Return the z midpoint for a given sample.

Definition at line 130 of file PXL_DeepSampleList.h.


The documentation for this class was generated from the following file: