Nuke binary plugins 15.0.5
 
Loading...
Searching...
No Matches
DD::Image::RowCacheTile Class Reference

#include <RowCacheTile.h>

Inheritance diagram for DD::Image::RowCacheTile:
DD::Image::Interest DD::Image::Box

Public Member Functions

 RowCacheTile (Iop &iop, ChannelMask channels, bool mt=false, InterestRatchet *ir=nullptr)
 
 RowCacheTile (Iop &iop, DD::Image::Box box, ChannelMask channels, bool mt=false, InterestRatchet *ir=nullptr)
 
 RowCacheTile (Iop &iop, int x, int Y, int r, int T, ChannelMask channels, bool mt=false, InterestRatchet *ir=nullptr)
 
void at (int x, int y, ChannelMask, float *)
 
float at (int x, int y, Channel)
 
- Public Member Functions inherited from DD::Image::Interest
 Interest (Iop &, ChannelMask, bool mt=false, InterestRatchet *ir=nullptr, float fracCPU=1.0f)
 
 Interest (Iop &, int x, int y, int r, int t, ChannelMask, bool mt=false, InterestRatchet *ir=nullptr, float fracCPU=1.0f)
 
 Interest (Iop &, const Box &box, ChannelMask, bool mt=false, InterestRatchet *ir=nullptr, float fracCPU=1.0f)
 
 Interest (const Interest &)=delete
 
Interestoperator= (const Interest &)=delete
 
ChannelMask channels () const
 
void unlock ()
 
bool unlocked () const
 
bool valid () const
 
bool done (int y) const
 
bool have_memory (Channel z, int y) const
 
LinePointers operator[] (Channel z) const
 
bool is_zero (Channel z, int y) const
 
void load_range (int, int)
 
Cache * cache () const
 
void at (int x, int y, ChannelMask m, float *o)
 
float at (int x, int y, Channel z)
 
 ~Interest ()
 
- Public Member Functions inherited from DD::Image::Box
iterator begin () const
 
iterator end () const
 
 Box (int x, int y, int r, int t)
 
 Box (const Box &b)
 
int x () const
 
void x (int v)
 
int y () const
 
void y (int v)
 
int r () const
 
void r (int v)
 
int t () const
 
void t (int v)
 
int w () const
 
void w (int v)
 
int h () const
 
void h (int v)
 
float center_x () const
 
float center_y () const
 
void set (int x, int y, int r, int t)
 
void set (const Box &b)
 
bool is_constant () const
 
void clear ()
 
void move (int dx, int dy)
 
void pad (int dx, int dy, int dr, int dt)
 
void pad (int dx, int dy)
 
void pad (int d)
 
int clampx (int x) const
 
int clampy (int y) const
 
void merge (const Box &)
 
void merge (int x, int y)
 
void merge (int x, int y, int r, int t)
 
void expand (int amount)
 
void expand (int widthAmount, int heightAmount)
 
void scale (float scaleAmount)
 
void intersect (const Box &)
 
void intersect (int x, int y, int r, int t)
 
bool intersects (const Box &other) const
 
bool intersects (int x, int y, int r, int t) const
 
bool contains (const Box &other) const
 
int64_t area () const
 

Static Public Member Functions

static const float * NilRow ()
 
- Static Public Member Functions inherited from DD::Image::Interest
static IopinputIop (Iop &iop)
 

Protected Member Functions

 RowCacheTile (bool loadOnDemand, Iop &iop, DD::Image::Box box, ChannelMask channels, bool mt=false, InterestRatchet *ir=nullptr)
 
- Protected Member Functions inherited from DD::Image::Interest
void reserve_range (int bottom, int top)
 

Friends

template<class TileType >
class TSamplerImpl
 
class GeneralTile
 
std::ostream & operator<< (std::ostream &, const RowCacheTile &)
 

Additional Inherited Members

- Public Types inherited from DD::Image::Interest
typedef const float * RowPtr
 type of actual row data. to be replaced with a strided pointer
 
typedef RowPtr const * LinePointers
 type of the linebuffer returned by operator[].
 
- Public Types inherited from DD::Image::Box
typedef iterator const_iterator
 

Detailed Description

A tile is the fastest way to get data from an image, but has the disadvantage that every pixel inside the requested area is calculated by the constructor. Thus this is only efficient if you expect to address every pixel in the region.

The data is locked into the cache by the existence of the RowCacheTile, just like Interest does, but the constructor also calculates any lines that are not there yet. If you are running multithreaded then there is a good chance that other threads are calculating the same or overlapping tiles, so the filling of this tile is in fact multithreaded. (I may change this in the future so the constructor actually lauches threads to try to fill the tile in as fast as possible).

The absolute fastest way to get data is to use operator[], but you will have to do boundary and channel mask checking yourself.

You can also use at(), which match the same-named methods on Iop, but are significantly faster.

Constructor & Destructor Documentation

◆ RowCacheTile() [1/3]

DD::Image::RowCacheTile::RowCacheTile ( Iop iop,
ChannelMask  channels,
bool  mt = false,
InterestRatchet ir = nullptr 
)
inline

This constructor gets all the data in the reqested() area of the Iop.

◆ RowCacheTile() [2/3]

DD::Image::RowCacheTile::RowCacheTile ( Iop iop,
int  x,
int  y,
int  r,
int  t,
ChannelMask  channels,
bool  mt = false,
InterestRatchet ir = nullptr 
)
inline

The constructor is exactly like the Interest constructor except it immediately calls load_range(y(), t()).

You must check Op::aborted() after the constructor. If this is true then data is missing from the tile, and you should destroy it without using any of the data. (future versions will use exceptions, making this much less of a pain, but you must then not assume the constructor will even return!)

The constructor will probably (unless the data already is in the cache()) execute the input Iop for every line in the tile. This can take a very long time. It may throw an exception if an error happens or the user interrupts processing, you must check for aborted() and don't try to use the data in that case.

◆ RowCacheTile() [3/3]

DD::Image::RowCacheTile::RowCacheTile ( bool  loadOnDemand,
Iop iop,
DD::Image::Box  box,
ChannelMask  channels,
bool  mt = false,
InterestRatchet ir = nullptr 
)
inlineprotected

Constructor. This version expects an additional loadOnDemand argument. If set to True, the tile properties will be initialised but image data will not be available immediately after this call. It will instead be provided on demand as pixels are read from the tile. This can be useful for cases such as sampling where the tile defines a possible area that may be read from but the exact pixels which are needed are not known when the tile is constructed.

Member Function Documentation

◆ at() [1/2]

void DD::Image::RowCacheTile::at ( int  x,
int  y,
ChannelMask  channels,
float *  out 
)

Return several channels of a pixel in the tile.

This is the same as the Interest::at() but is faster because it can assume the line is already loaded.

Referenced by DD::Image::GeneralTile::at(), and DD::Image::Transform::motionBlurSample().

◆ at() [2/2]

float DD::Image::RowCacheTile::at ( int  x,
int  y,
Channel  channel 
)

Return a single channel of a pixel in the tile.

This is the same as the Interest::at() but is faster because it can assume the line is already loaded.

References DD::Image::Box::clampx(), DD::Image::Box::clampy(), DD::Image::Box::x(), and DD::Image::Box::y().

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  ,
const RowCacheTile  
)
friend

Not implemented in the library but you can define it.



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com