#include <Writer.h>
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 | |
LUT * | lut () |
virtual LUT * | defaultLUT () const |
virtual bool | isDefaultLUTKnob (DD::Image::Knob *knob) const |
const Iop::Info & | info () 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 OutputContext & | inputContext (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 |
Iop & | input0 () |
const Iop & | input0 () 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 | |
Write * | iop |
Points at the Write that created this. | |
std::string | _hash |
Friends | |
class | Write |
class | WriterImpl |
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
|
override |
The destructor should close any open files (this may be used for movie formats that keep the file open between calls to execute().
|
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.
|
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().
|
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
|
inlineprotected |
The info() going into the Write
References DD::Image::IopInfoOwner::info().
|
inlineprotected |
The width of image to write.
|
inlineprotected |
The height of image to write.
|
inlineprotected |
The pixel aspect ratio of image to write.
Referenced by getPixelAspectAsResolution().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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.
|
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.
|
inlineprotected |
The premult() setting from the Write
Referenced by to_byte(), to_float(), and to_short().
|
inlineprotected |
The Iop whose output should be written.
References DD::Image::Iop::input0().
|
inlineprotected |
The Iop whose output should be written.
References DD::Image::Iop::input0().
|
inlineprotected |
Get a line from the input, and start parallel threads.
|
inlineprotected |
The filename to write.
Referenced by DD::Image::FileWriter::close(), DD::Image::FileWriter::getTempFileName(), and DD::Image::FileWriter::open().
|
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().
|
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().
|
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().
|
inlineprotected |
Call to display percentage of the current frame done.
References DD::Image::Op::progressFraction().
|
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().
|
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().
|
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().
|
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.
|
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().
|
inline |
Private implementation
Referenced by DD::Image::Write::_validate(), DD::Image::Write::set_file_type(), and DD::Image::Write::updateDefaultLUT().
|
inlinestatic |
Flips the array or does nothing, depending on your machine.
|
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. |