HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP2_PixelOp.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: COP2_PixelOp.h
7  *
8  * COMMENTS:
9  * Base class for all simple pixel operations
10  */
11 #ifndef _COP2_PIXELOP_H_
12 #define _COP2_PIXELOP_H_
13 
14 #include "COP2_API.h"
15 #include <TIL/TIL_Defines.h>
16 #include <RU/RU_PixelEngine.h>
17 
18 class COP2_PixelFunction;
19 class RU_GPUPixelEngine;
20 
21 #include "COP2_MaskOp.h"
22 
23 #define ARG_PIXELOP_CC_IN_UNPREMULT "dounpremult"
24 #define ARG_PIXELOP_QUANTIZE_HERE "quantize"
25 
27 {
28 public:
29  bool isSlowOperation() const override { return false; }
30 
31 
32  // override COP2_MaskOp version.
34 
36  static PRM_Template myTemplateList[];
37 
38  // For the output area (an area of a plane belonging to this node)
39  // and a set of input areas, determine which input areas and which
40  // parts of these areas are needed to cook the output area.
42  COP2_CookAreaInfo &output_area,
43  const COP2_CookAreaList &input_areas,
44  COP2_CookAreaList &needed_areas) override;
45 
47  { return TIL_VIEW_GRAPH_CURVES; }
48 
49 protected:
50  bool updateParmsFlags() override;
51 
53  TIL_TileList *tilelist) override;
54 
56  float t, int xres, int yres,
57  int thread,
58  int max_threads) override;
59 
60  // All pixel operations should override addPixelFunction.
61  virtual RU_PixelFunction *addPixelFunction(const TIL_Plane *plane,
62  int array_index, float t,
63  int xres, int yres,
64  int thread)=0;
65 
66  // Don't override this method!
67  void getPixelFunction(const TIL_Plane *plane,
68  int array_index, float t,
69  int xres, int yres,
70  int thread,
72  bool concatenate,
73  bool dependent_too) override;
74 
75  virtual bool checkAlignment(int x1, int y1, int x2, int y2,
76  int ix1, int iy1,
77  int ix2, int iy2,
78  int tilex, int tiley);
79 
80  COP2_PixelOp(OP_Network *parent, const char *name,
81  OP_Operator *entry);
82  ~COP2_PixelOp() override;
83 
84  bool computeAlphaValues(COP2_Context &context, TIL_TileList *tiles,
85  til_AlignedBlock *&before,
86  til_AlignedBlock *&after,
87  bool &isalphaconst);
88  void multiplyAlpha(TIL_TileList *tiles, float *alpha,
89  bool docooked, bool isalphaconst);
90 
91  static int editCurves(void *, int, float,
92  const PRM_Template *);
93 
95  int &plane,
96  int &node,
97  int &op) const override;
98 
99  bool isGPUAssisted(const TIL_Plane &plane,
100  int array_index, float t,
101  int xres, int yres,
102  int thread_index) override;
103 private:
104  int QUANTIZE_HERE()
105  { return evalInt(ARG_PIXELOP_QUANTIZE_HERE, 0, 0); }
106 
107  int DO_UNPREMULT()
108  { return evalInt(ARG_PIXELOP_CC_IN_UNPREMULT, 0, 0); }
109 
110  int myPixelOpParmBase;
111 };
112 
114 {
115 public:
117  : myEngine(0), myGPUEngine(0), myFunction(0) {}
118 
119  ~cop2_PixelOpContext() override;
120 
121  bool createPerPlane() const override { return true; }
122  bool createPerRes() const override { return false; }
123  bool createPerThread() const override;
124 
128 };
129 
130 #endif
#define ARG_PIXELOP_CC_IN_UNPREMULT
Definition: COP2_PixelOp.h:23
void getInputDependenciesForOutputArea(COP2_CookAreaInfo &output_area, const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas) override
virtual OP_ERROR doCookMyTile(COP2_Context &context, TIL_TileList *tiles)=0
virtual bool createPerThread() const
Definition: COP2_Context.h:41
COP2_PixelFunction * myFunction
Definition: COP2_PixelOp.h:127
bool createPerRes() const override
Definition: COP2_PixelOp.h:122
UT_ErrorSeverity
Definition: UT_Error.h:25
RU_PixelEngine * myEngine
Definition: COP2_PixelOp.h:125
virtual COP2_Node * getPassThroughInput(COP2_Context &)
Definition: COP2_MaskOp.h:44
RU_GPUPixelEngine * myGPUEngine
Definition: COP2_PixelOp.h:126
GLdouble GLdouble x2
Definition: glad.h:2349
virtual TIL_ViewerType getCurveEditorType()
Definition: COP2_PixelOp.h:46
friend class COP2_PixelOp
Definition: COP2_Node.h:1634
bool updateParmsFlags() override
bool isSlowOperation() const override
Definition: COP2_PixelOp.h:29
#define ARG_PIXELOP_QUANTIZE_HERE
Definition: COP2_PixelOp.h:24
GLdouble y1
Definition: glad.h:2349
virtual void getMaxNumThreadsInCook(COP2_Context &, int &plane, int &node, int &op) const
Definition: COP2_Node.h:513
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:112
virtual COP2_ContextData * newContextData(const TIL_Plane *plane, int array_index, float t, int xres, int yres, int thread, int max_threads)
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble t
Definition: glad.h:2397
TIL_ViewerType
Definition: TIL_Defines.h:139
static OP_TemplatePair myTemplatePair
Definition: COP2_PixelOp.h:35
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
GLenum func
Definition: glcorearb.h:783
#define COP2_API
Definition: COP2_API.h:10
virtual void getPixelFunction(const TIL_Plane *plane, int array_index, float t, int xres, int yres, int thread, COP2_PixelFunction *&function, bool concatenate, bool dependent_too)
bool createPerPlane() const override
Definition: COP2_PixelOp.h:121
virtual bool isGPUAssisted(const TIL_Plane &, int, float, int, int, int)
Definition: COP2_Node.h:347
exint evalInt(int pi, int vi, fpreal t) const
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349