DD::Image::RowCacheTile Class Reference

Inherits DD::Image::Interest.

List of all members.

Public Member Functions

 RowCacheTile (Iop &iop, ChannelMask channels, bool mt=false, InterestRatchet *ir=0)
 RowCacheTile (Iop &iop, DD::Image::Box box, ChannelMask channels, bool mt=false, InterestRatchet *ir=0)
 RowCacheTile (Iop &iop, int x, int Y, int r, int T, ChannelMask channels, bool mt=false, InterestRatchet *ir=0)
void at (int x, int y, ChannelMask, float *)
float at (int x, int y, Channel)

Static Public Member Functions

static const float * NilRow ()

Friends

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

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

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

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

DD::Image::RowCacheTile::RowCacheTile ( Iop iop,
int  x,
int  y,
int  r,
int  t,
ChannelMask  channels,
bool  mt = false,
InterestRatchet ir = 0 
) [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.


Member Function Documentation

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.

Reimplemented from DD::Image::Interest.

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

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.

Reimplemented from DD::Image::Interest.

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


Friends And Related Function Documentation

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

Not implemented in the library but you can define it.