Nuke binary plugins 15.1.5
 
Loading...
Searching...
No Matches
DD::Image::FileReader Class Reference

#include <FileReader.h>

Inheritance diagram for DD::Image::FileReader:
DD::Image::Reader

Public Member Functions

 FileReader (Read *, int fd, const unsigned char *buffer, FILE_OFFSET buflength)
 
 ~FileReader () override
 
int lock (FILE_OFFSET offset, int min_length, int length)
 
int lock (FILE_OFFSET offset, int l)
 
int lock (FILE_OFFSET offset, unsigned l)
 
const unsigned char & byte (FILE_OFFSET n) const
 
const unsigned char * at (FILE_OFFSET n) const
 
void unlock ()
 
int read (void *p, FILE_OFFSET offset, int min_, int max_)
 
int read (void *p, FILE_OFFSET offset, int l)
 
int read (void *p, FILE_OFFSET offset, unsigned l)
 
bool readAllLinesRequested () const
 
- Public Member Functions inherited from DD::Image::Reader
 Reader (Read *iop)
 
virtual ~Reader ()
 
virtual bool supports_stereo () const
 
virtual bool fileStereo () const
 
virtual bool videosequence () const
 
int rowPadMultiple () const noexcept
 Rows must be padded to be multiples of this value, in bytes. 0 means no padding.
 
void setRowPadMultiple (int rowPadMultiple) noexcept
 Rows must be padded to be multiples of this value, in bytes. 0 means no padding.
 
bool aborted () const
 Allows a reader to check directly if its op has been aborted.
 
const Iop::Infoinfo () const
 
int x () const
 
int y () const
 
int r () const
 
int t () const
 
int w () const
 
int h () const
 
bool is_constant () const
 
int clampx (int x) const
 
int clampy (int y) const
 
const Formatformat () const
 
const Formatfull_size_format () const
 
int ydirection () const
 
ChannelMask channels () const
 
int first_frame () const
 
int last_frame () const
 
int width () const
 
int height () const
 
const char * filename () const
 
int frame () const
 
bool premult () const
 
Channel channel (const char *name)
 
const char * channel_name (Channel c)
 
void format (const Format &f)
 
void full_size_format (const Format &f)
 
virtual void setLUT (LUT *lut)
 
virtual LUTlut ()
 
virtual std::string getDefaultColorspace () const
 
ReaderImpl * getImpl ()
 Get private implementation.
 
ReaderImpl * getImpl () const
 
virtual AudioReaderI * audioReader ()
 

Related Functions

(Note that these are not member functions.)

typedef unsigned long FILE_OFFSET
 

Additional Inherited Members

- Static Public Member Functions inherited from DD::Image::Reader
static U32 lsb32 (const unsigned char *p)
 
static U32 msb32 (const unsigned char *p)
 
static U16 lsb16 (const unsigned char *p)
 
static U16 msb16 (const unsigned char *p)
 
static void flip (U16 *p, unsigned n)
 
static void flip (U32 *p, unsigned n)
 
static void flip (U64 *p, unsigned n)
 
static void fromlsb (U64 *p, unsigned n)
 
static void frommsb (U64 *p, unsigned n)
 
static void fromlsb (U32 *p, unsigned n)
 
static void frommsb (U32 *p, unsigned n)
 
static void fromlsb (U16 *p, unsigned n)
 
static void frommsb (U16 *p, unsigned n)
 
static void setInPreviewMode (bool preview)
 
static bool inPreviewMode ()
 
- Protected Types inherited from DD::Image::Reader
enum  PlanarPreference { ePlanarNever , ePlanarAllow , ePlanarAlways }
 
- Protected Member Functions inherited from DD::Image::Reader
virtual void prefetchMetaData ()
 
virtual const MetaData::BundlefetchMetaData (const char *key)
 
virtual PlanarPreference planarPreference () const
 
virtual bool useStripes () const
 
virtual size_t stripeHeight () const
 
virtual PlanarI::PlaneID getPlaneFromChannel (Channel chan)
 
virtual void open ()
 
virtual void engine (int y, int x, int r, ChannelMask, Row &)
 
virtual void fetchPlane (ImagePlane &imagePlane)
 
void from_byte (Channel z, float *, const uchar *, const uchar *, int W, int delta=1)
 
void from_short (Channel z, float *, const U16 *, const U16 *, int W, int bits, int delta=1)
 
void from_float (Channel z, float *, const float *, const float *, int W, int delta=1)
 
void set_info (int width, int height, int depth, double aspect=0)
 
- Protected Attributes inherited from DD::Image::Reader
Readiop
 
LUTlut_
 
Iop::Info info_
 

Detailed Description

Reader subclass to read Unix files. This Reader subclass will read Unix files as blocks of memory and tries to be somewhat multi-threaded and have as little overhead as possible. This is used by most of the file formats.

Constructor & Destructor Documentation

◆ FileReader()

FileReader::FileReader ( Read i,
int  fd,
const unsigned char *  buffer,
FILE_OFFSET  buflength 
)

The constructor takes the block of memory already read by Read and preserves it.

◆ ~FileReader()

FileReader::~FileReader ( )
override

The destructor closes the file.

Member Function Documentation

◆ lock() [1/3]

int FileReader::lock ( FILE_OFFSET  offset,
int  min_length,
int  length 
)

lock() makes byte(n) work for any value between offset and offset+length. All bytes between the last one in the file and length are set to zero. If less than min_length bytes are available it produces an error. You must call unlock exactly once to free the block (and cannot call lock() again until then).

References DD::Image::end(), DD::Image::Reader::filename(), DD::Image::Lock::lock(), DD::Image::Lock::unlock(), and DD::Image::SignalLock::wait().

◆ lock() [2/3]

int DD::Image::FileReader::lock ( FILE_OFFSET  offset,
int  l 
)
inline

Same as lock(offset,l,l), the minimum length needed to produce an error is equal to the maximum length.

References lock().

Referenced by lock().

◆ lock() [3/3]

int DD::Image::FileReader::lock ( FILE_OFFSET  offset,
unsigned  l 
)
inline

Same as lock(offset, int(l)) to avoid type warnings for code that uses unsigned values as offsets into the file.

References lock().

Referenced by lock().

◆ byte()

const unsigned char & DD::Image::FileReader::byte ( FILE_OFFSET  n) const
inline

After calling lock() you can access any byte in the locked range by calling this fast inline function. Attempts to access bytes outside the currently lock()'ed range will return garbage.

To get 16-bit unsigned quantities, use msb16(at(n)) or lsb16(at(n)). To get 32-bit unsigned quantities use msb32(at(n)) or lsb32(at(n)).

◆ at()

const unsigned char * DD::Image::FileReader::at ( FILE_OFFSET  n) const
inline

Return a pointer to an object in the locked region. This will work as long as you know the object does not cross a "page boundary", in the current version these pages are 32K in size.

◆ unlock()

void FileReader::unlock ( )

Call this when you are done using byte() to call a locked region of the file. This will allow this or other threads to lock a different region.

References DD::Image::Lock::lock(), DD::Image::SignalLock::signal(), and DD::Image::Lock::unlock().

◆ read() [1/3]

int FileReader::read ( void *  p,
FILE_OFFSET  offset,
int  min_,
int  max_ 
)

Read directly from the file into some memory of your own. If less than length bytes are available the block is padded with zero. The number of bytes read (0 if there is an error) is returned. If less than min_length are available it produces an error.

References DD::Image::Lock::lock(), and DD::Image::Lock::unlock().

◆ read() [2/3]

int DD::Image::FileReader::read ( void *  p,
FILE_OFFSET  offset,
int  l 
)
inline

Same as read(p,offset,l,l), the minimum length needed to produce an error is equal to the maximum length.

References read().

Referenced by read().

◆ read() [3/3]

int DD::Image::FileReader::read ( void *  p,
FILE_OFFSET  offset,
unsigned  l 
)
inline

Same as read(p,offset,int(l)) to avoid type warnings for code that uses unsigned values as offsets into the file.

References read().

Referenced by read().

◆ readAllLinesRequested()

bool FileReader::readAllLinesRequested ( ) const

Whether reading all lines (as opposed to reading individual scanlines) has been requested. For performance reasons, it is sometimes preferable to read from the input file in larger chunks. When this function returns true, the user has indicated that they would prefer to read all of the requested lines from the file in one go. It's then up to the individual FileReader whether it chooses to obey this request or not.

References DD::Image::Op::eOpGraph, DD::Image::Op::nodeContext(), and DD::Image::Op::outputContext().

Friends And Related Function Documentation

◆ FILE_OFFSET

typedef unsigned long FILE_OFFSET
related

This type may need to be replaced on 64-bit file systems.



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