HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual bool isSlowOperation() const { 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);
45 
47  { return TIL_VIEW_GRAPH_CURVES; }
48 
49 protected:
50  virtual bool updateParmsFlags();
51 
52  virtual OP_ERROR doCookMyTile(COP2_Context &context,
53  TIL_TileList *tilelist);
54 
55  virtual COP2_ContextData *newContextData(const TIL_Plane *, int,
56  float t, int xres, int yres,
57  int thread,
58  int max_threads);
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  virtual 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);
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  virtual ~COP2_PixelOp();
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 
94  virtual void getMaxNumThreadsInCook(COP2_Context &,
95  int &plane,
96  int &node,
97  int &op) const;
98 
99  virtual bool isGPUAssisted(const TIL_Plane &plane,
100  int array_index, float t,
101  int xres, int yres,
102  int thread_index);
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  virtual ~cop2_PixelOpContext();
120 
121  virtual bool createPerPlane() const { return true; }
122  virtual bool createPerRes() const { return false; }
123  virtual bool createPerThread() const;
124 
128 };
129 
130 #endif
#define ARG_PIXELOP_CC_IN_UNPREMULT
Definition: COP2_PixelOp.h:23
virtual OP_ERROR doCookMyTile(COP2_Context &context, TIL_TileList *tiles)=0
virtual void getInputDependenciesForOutputArea(COP2_CookAreaInfo &output_area, const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas)
virtual bool createPerRes() const
Definition: COP2_PixelOp.h:122
virtual bool createPerThread() const
Definition: COP2_Context.h:41
COP2_PixelFunction * myFunction
Definition: COP2_PixelOp.h:127
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
virtual TIL_ViewerType getCurveEditorType()
Definition: COP2_PixelOp.h:46
friend class COP2_PixelOp
Definition: COP2_Node.h:1627
virtual bool isSlowOperation() const
Definition: COP2_PixelOp.h:29
#define ARG_PIXELOP_QUANTIZE_HERE
Definition: COP2_PixelOp.h:24
virtual void getMaxNumThreadsInCook(COP2_Context &, int &plane, int &node, int &op) const
Definition: COP2_Node.h:512
GLfloat GLfloat GLfloat alpha
Definition: glcorearb.h:111
virtual bool createPerPlane() const
Definition: COP2_PixelOp.h:121
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:785
TIL_ViewerType
Definition: TIL_Defines.h:128
static OP_TemplatePair myTemplatePair
Definition: COP2_PixelOp.h:35
virtual bool updateParmsFlags()
GLenum func
Definition: glcorearb.h:782
#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)
virtual bool isGPUAssisted(const TIL_Plane &, int, float, int, int, int)
Definition: COP2_Node.h:341
exint evalInt(int pi, int vi, fpreal t) const