HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfCompositeDeepScanLine.h
Go to the documentation of this file.
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright (c) Weta Digital, Ltd and Contributors to the OpenEXR Project.
4 //
5 
6 #ifndef INCLUDED_IMF_COMPOSITEDEEPSCANLINE_H
7 #define INCLUDED_IMF_COMPOSITEDEEPSCANLINE_H
8 
9 //-----------------------------------------------------------------------------
10 //
11 // Class to composite deep samples into a frame buffer
12 // Initialise with a deep input part or deep inputfile
13 // (also supports multiple files and parts, and will
14 // composite them together, as long as their sizes and channelmaps agree)
15 //
16 // Then call setFrameBuffer, and readPixels, exactly as for reading
17 // regular scanline images.
18 //
19 // Restrictions - source file(s) must contain at least Z and alpha channels
20 // - if multiple files/parts are provided, sizes must match
21 // - all requested channels will be composited as premultiplied
22 // - only half and float channels can be requested
23 //
24 // This object should not be considered threadsafe
25 //
26 // The default compositing engine will give spurious results with overlapping
27 // volumetric samples - you may derive from DeepCompositing class, override the
28 // sort_pixel() and composite_pixel() functions, and pass an instance to
29 // setCompositing().
30 //
31 //-----------------------------------------------------------------------------
32 
33 #include "ImfForward.h"
34 
35 #include <ImathBox.h>
36 
38 
40 {
41 public:
45  virtual ~CompositeDeepScanLine ();
46 
47  /// set the source data as a part
48  ///@note all parts must remain valid until after last interaction with DeepComp
50  void addSource (DeepScanLineInputPart* part);
51 
52  /// set the source data as a file
53  ///@note all file must remain valid until after last interaction with DeepComp
55  void addSource (DeepScanLineInputFile* file);
56 
57  /////////////////////////////////////////
58  //
59  // set the frame buffer for output values
60  // the buffers specified must be large enough
61  // to handle the dataWindow()
62  //
63  /////////////////////////////////////////
65  void setFrameBuffer (const FrameBuffer& fr);
66 
67  /////////////////////////////////////////
68  //
69  // retrieve frameBuffer
70  //
71  ////////////////////////////////////////
73  const FrameBuffer& frameBuffer () const;
74 
75  //////////////////////////////////////////////////
76  //
77  // read scanlines start to end from the source(s)
78  // storing the result in the frame buffer provided
79  //
80  //////////////////////////////////////////////////
81 
83  void readPixels (int start, int end);
84 
86  int sources () const; // return number of sources
87 
88  /////////////////////////////////////////////////
89  //
90  // retrieve the datawindow
91  // If multiple parts are specified, this will
92  // be the union of the dataWindow of all parts
93  //
94  ////////////////////////////////////////////////
95 
97  const IMATH_NAMESPACE::Box2i& dataWindow () const;
98 
99  //
100  // override default sorting/compositing operation
101  // (otherwise an instance of the base class will be used)
102  //
103 
104  IMF_EXPORT
105  void setCompositing (DeepCompositing*);
106 
107  struct IMF_HIDDEN Data;
108 
109 
110  //
111  // set the maximum number of samples that will be composited.
112  // If a single scanline has more samples, readPixels will throw
113  // an exception. This mechanism prevents the library allocating
114  // excessive memory to composite deep scanline images.
115  // A value of 0 will cause deep compositing to be disabled entirely
116  // A negative value disables the limit, allowing images with
117  // arbitrarily large sample counts to be composited
118  //
119  IMF_EXPORT
120  static void setMaximumSampleCount(int64_t sampleCount);
121 
122  IMF_EXPORT
123  static int64_t getMaximumSampleCount();
124 
125 
126 private:
127  struct Data* _Data;
128 
129  CompositeDeepScanLine (const CompositeDeepScanLine&) = delete;
130  CompositeDeepScanLine& operator= (const CompositeDeepScanLine&) = delete;
131  CompositeDeepScanLine (CompositeDeepScanLine&&) = delete;
132  CompositeDeepScanLine& operator= (CompositeDeepScanLine&&) = delete;
133 };
134 
136 
137 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:83
GLuint start
Definition: glcorearb.h:475
#define IMF_HIDDEN
Definition: ImfExport.h:55
class IMF_EXPORT_TYPE CompositeDeepScanLine
Definition: ImfForward.h:79
GLsizei GLenum * sources
Definition: glcorearb.h:2542
Box< V2i > Box2i
2D box of base type int.
Definition: ImathBox.h:143
GLuint GLuint end
Definition: glcorearb.h:475
int & sampleCount(char *base, int xStride, int yStride, int x, int y)
Definition: ImfMisc.h:62
#define IMF_EXPORT
Definition: ImfExport.h:54
LeafData & operator=(const LeafData &)=delete
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:80
#define IMF_EXPORT_TYPE
Definition: ImfExport.h:57