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

#include <Writer.h>

Inheritance diagram for DD::Image::Writer:
DD::Image::FileWriter

Classes

class  Description
 Specialised Writer Description. More...
 

Public Types

typedef U64 FlagMask
 

Public Member Functions

void setFlags (FlagMask flags, bool newValue=true)
 
void clearFlags (FlagMask flags)
 
bool anyFlags (FlagMask newFlags) const
 test whether the Writer has any of the given flags
 
bool allFlags (FlagMask newFlags) const
 test whether the Writer has all of the given flags
 
 Writer (Write *i)
 
 ~Writer () override
 
virtual bool movie () const
 
virtual void execute ()
 
virtual void finish ()
 
void knobs (Knob_Callback cb) override
 
bool aborted () const
 Allows a writer to check directly if its op has been aborted.
 
virtual void setLUT (LUT *lut)
 
WriterImpl * getImpl ()
 
WriterImpl * getImpl () const
 

Static Public Member Functions

static void flip (U16 *p, int n)
 
static void flip (U32 *p, int n)
 
static void tolsb (U32 *p, int n)
 
static void tomsb (U32 *p, int n)
 
static void tolsb (U16 *p, int n)
 
static void tomsb (U16 *p, int n)
 

Static Public Attributes

static const FlagMask DONT_CHECK_INPUT0_CHANNELS
 

Protected Member Functions

LUTlut ()
 
virtual LUTdefaultLUT () const
 
virtual bool isDefaultLUTKnob (DD::Image::Knob *knob) const
 
const Iop::Infoinfo () const
 
int width () const
 
int height () const
 
double getPixelAspect () const
 
std::pair< int, int > getPixelAspectAsResolution () const
 
virtual bool clipToFormat () const
 
virtual int split_input (int i) const
 
virtual const OutputContextinputContext (int n, OutputContext &c) const
 
int depth () const
 
int num_channels () const
 
ChannelSet channel_mask (int num_channels) const
 
Channel channel (int index) const
 
bool premult () const
 
Iopinput0 ()
 
const Iopinput0 () const
 
void get (int y, int x, int r, ChannelMask channels, Row &row)
 
const char * filename () const
 
std::string createFileHash ()
 
std::string getHash () const
 
void renameFromHash ()
 
void to_byte (int z, uchar *, const float *, const float *, int W, int delta=1)
 
void to_short (int z, U16 *, const float *, const float *, int W, int bits=16, int delta=1)
 
void to_float (int z, float *, const float *, const float *, int W, int delta=1)
 
void progressFraction (double f)
 
void progressFraction (int a, int b)
 
std::set< int > executingViews () const
 

Protected Attributes

Writeiop
 Points at the Write that created this.
 
std::string _hash
 

Friends

class Write
 
class WriterImpl
 

Detailed Description

Writes data to an image file (or other image destination).

The Write creates one of these for every different filename it writes. Each different file type is a different subclass. Each subclass defines a Writer_Description object, all of these are searched to figure out what subclass to use.

For most image file formats you will want to use a subclass of the FileWriter subclass.

The implementation of the base class is in Write.C

Constructor & Destructor Documentation

◆ ~Writer()

Writer::~Writer ( )
override

The destructor should close any open files (this may be used for movie formats that keep the file open between calls to execute().

Member Function Documentation

◆ setFlags()

void DD::Image::Writer::setFlags ( FlagMask  flags,
bool  newValue = true 
)
inline

Turn the flags in /newFlags/ on or off, depending upon newValue. Leaves flags not in /newFlags/ unaltered. It is expected that the Writer's constructor should call this.

◆ defaultLUT()

LUT * Writer::defaultLUT ( ) const
protectedvirtual

Return the value that should be used in lut_ if the user picks default. The default version returns the LUT::INT8. This function is needed if the default changes in response to controls defined in knobs().

◆ isDefaultLUTKnob()

virtual bool DD::Image::Writer::isDefaultLUTKnob ( DD::Image::Knob knob) const
inlineprotectedvirtual

if the value of the knob passed in contributes to the value returned from defaultLUT you should return true from this function to ensure that the default LUT is correctly updated in the panel when you change that knob

◆ info()

const Iop::Info & DD::Image::Writer::info ( ) const
inlineprotected

The info() going into the Write

References DD::Image::IopInfoOwner::info().

◆ width()

int DD::Image::Writer::width ( ) const
inlineprotected

The width of image to write.

◆ height()

int DD::Image::Writer::height ( ) const
inlineprotected

The height of image to write.

◆ getPixelAspect()

double DD::Image::Writer::getPixelAspect ( ) const
inlineprotected

The pixel aspect ratio of image to write.

Referenced by getPixelAspectAsResolution().

◆ getPixelAspectAsResolution()

std::pair< int, int > Writer::getPixelAspectAsResolution ( ) const
protected

The pixel aspect ratio of image to write represented as X/Y resolution values

Guess the pixel width and height from the Pixel Aspect Ratio (PAR) using a known list

References getPixelAspect().

◆ clipToFormat()

virtual bool DD::Image::Writer::clipToFormat ( ) const
inlineprotectedvirtual

Does the format force a clip to the format, or can it write out the area outside the format (the overscan), too?

Also used to indicate whether the channels are represented incompletely in the file, so that if RB is written out then it will read back in as RG.

Referenced by DD::Image::Write::_request(), DD::Image::Write::_validate(), and DD::Image::Write::engine().

◆ split_input()

int Writer::split_input ( int  i) const
protectedvirtual

Lets a writer override the Op::split_input() method of the including Write op. This is used by Writers that can write more than one view.

Referenced by DD::Image::Write::execViewMode(), and DD::Image::Write::split_input().

◆ inputContext()

const OutputContext & Writer::inputContext ( int  n,
OutputContext c 
) const
protectedvirtual

Lets a writer override the Op::inputContext() method of the including Write op. This is used by Writers that can write more than one view. Note that c is scratch space, it is not a usable return value!

References iop, and DD::Image::Op::outputContext().

Referenced by DD::Image::Write::inputContext().

◆ depth()

int Writer::depth ( ) const
protected

Many file formats can write a certain number of channels, but cannot identify them in any useful way other than by index. This call will return a recommended number of channels to write, based on the set the user selected for the Write operator. You may want to clamp this to the legal range (such as 1-4) for your file format.

References iop.

Referenced by channel_mask().

◆ channel_mask()

ChannelSet Writer::channel_mask ( int  num_channels) const
protected

For simple file writers that use channel(int) to get their inputs, this returns a channel mask to use to call open() on the input.

References DD::Image::IopInfoOwner::channels(), depth(), DD::Image::Iop::input0(), and iop.

◆ channel()

Channel Writer::channel ( int  index) const
protected

For file formats that just write a number of channels (rather than any identifying information) you should use this to turn an index (starting at zero) into the channel to write. You can call this with any number, including numbers larger than depth() returns. This may return Chan_Black to indicate that no channel should be written.

References DD::Image::Write::channel_written_to(), and iop.

◆ premult()

bool DD::Image::Writer::premult ( ) const
inlineprotected

The premult() setting from the Write

Referenced by to_byte(), to_float(), and to_short().

◆ input0() [1/2]

Iop & DD::Image::Writer::input0 ( )
inlineprotected

The Iop whose output should be written.

References DD::Image::Iop::input0().

◆ input0() [2/2]

const Iop & DD::Image::Writer::input0 ( ) const
inlineprotected

The Iop whose output should be written.

References DD::Image::Iop::input0().

◆ get()

void DD::Image::Writer::get ( int  y,
int  x,
int  r,
ChannelMask  channels,
Row row 
)
inlineprotected

Get a line from the input, and start parallel threads.

◆ filename()

const char * DD::Image::Writer::filename ( ) const
inlineprotected

◆ to_byte()

void Writer::to_byte ( int  z,
uchar *  to,
const float *  from,
const float *  alpha,
int  W,
int  delta = 1 
)
protected

Convert to bytes from floating point.

from should point at an array of W floats, spaced 1 apart.

These are converted and placed into to[0], to[delta], to[2*delta],...

z is the channel index (warning this is one less than the channel number). If z >= 2 then linear (multiply by 255) conversion is done.

Otherwise the lut() is called to do a normal conversion.

If premult() is on and alpha is not null, it should point at an array of W bytes for an alpha channel, spaced delta apart. The lut() is then called to do an unpremult-convert of the values.

References premult(), and DD::Image::LUT::to_byte().

◆ to_short()

void Writer::to_short ( int  z,
U16 *  to,
const float *  from,
const float *  alpha,
int  W,
int  bits = 16,
int  delta = 1 
)
protected

Same as to_byte() except the destination is shorts in the range 0 through (2<<bits)-1.

References premult(), DD::Image::Linear::to_short(), and DD::Image::LUT::to_short().

◆ to_float()

void Writer::to_float ( int  z,
float *  to,
const float *  from,
const float *  alpha,
int  W,
int  delta = 1 
)
protected

Same as to_byte() except the destination is an array of floats. Linear conversion will leave the numbers unchanged.

References premult(), and DD::Image::LUT::to_float().

◆ progressFraction()

void DD::Image::Writer::progressFraction ( double  f)
inlineprotected

Call to display percentage of the current frame done.

References DD::Image::Op::progressFraction().

◆ movie()

bool Writer::movie ( ) const
virtual

Return true if the destination is a "movie". If this is true then the writer is capable of writing multiple frames, and frame() and execute() may be called multiple times to write different images. The default version returns false.

Referenced by DD::Image::Write::endExecuting(), DD::Image::Write::execFrameMode(), and DD::Image::Write::execute().

◆ execute()

void Writer::execute ( )
virtual

Write the data in iop->input0(). The frame number may be retrieved with frame() and the filename from filename(). This may call iop->error() with any error messages.

References DD::Image::Op::debug(), and iop.

Referenced by DD::Image::Write::execute().

◆ finish()

void Writer::finish ( )
virtual

Override if the writer needs to do something to finish a sequence. This is mostly of use to movie writers that don't close out the destination on a frame-by-frame basis.

Reimplemented in DD::Image::FileWriter.

Referenced by DD::Image::Write::endExecuting(), DD::Image::Write::execute(), and DD::Image::FileWriter::finish().

◆ knobs()

void Writer::knobs ( Knob_Callback  cb)
override

Like the Op::knobs() method, this allows the Writers to create format-specific knobs for format-specific parameters. At present, the Writers are tasked with adding the knobs themselves after the 'file_type' knob of the parent Write.

◆ setLUT()

virtual void DD::Image::Writer::setLUT ( LUT lut)
inlinevirtual

Set LUT. This is virtual to allow overrides in movWriter which performs additional processing

Referenced by DD::Image::Write::_validate(), and DD::Image::Write::execute().

◆ getImpl()

WriterImpl * DD::Image::Writer::getImpl ( )
inline

◆ tolsb()

static void DD::Image::Writer::tolsb ( U32 *  p,
int  n 
)
inlinestatic

Flips the array or does nothing, depending on your machine.

Member Data Documentation

◆ DONT_CHECK_INPUT0_CHANNELS

const FlagMask DD::Image::Writer::DONT_CHECK_INPUT0_CHANNELS
static

tell the Write to suppress the validation of input0() and checking that it has channels. Used for the exrWriter and other stereo-aware writers, which might not be using input0. If this is set then the writer needs to perform its own checking that channels exist.

Referenced by DD::Image::Write::execute().



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