HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
COP2_LumaKey.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_LumaKey.h
7  *
8  * COMMENTS:
9  * LumaKey Op.
10  */
11 #ifndef _COP2_LUMAKEY_H_
12 #define _COP2_LUMAKEY_H_
13 
14 #include "COP2_API.h"
15 #define ARG_LUMAKEY_MIN_LUM (myParmBase + 0)
16 #define ARG_LUMAKEY_MIN_VALUE (myParmBase + 1)
17 #define ARG_LUMAKEY_MAX_LUM (myParmBase + 2)
18 #define ARG_LUMAKEY_MAX_VALUE (myParmBase + 3)
19 #define ARG_LUMAKEY_DISCARD (myParmBase + 4)
20 #define ARG_LUMAKEY_ROLLOFF (myParmBase + 5)
21 #define ARG_LUMAKEY_ROLL_FUNC (myParmBase + 6)
22 #define ARG_LUMAKEY_FUNCTION (myParmBase + 7)
23 #define ARG_LUMAKEY_SUPER_SAMPLE (myParmBase +8)
24 #define ARG_LUMAKEY_KEY_PLANE (myParmBase + 9)
25 
26 #include "COP2_KeyBase.h"
27 
28 class cop2_LumaContext;
29 
31 {
32 public:
33  static OP_Node *myConstructor(OP_Network*, const char *,
34  OP_Operator *);
37  static PRM_Template myTemplateList[];
38  static CH_LocalVariable myVariableList[];
39  static const char *myInputLabels[];
40 
41  virtual void setColorParms(float hmin, float hmax,
42  float smin, float smax,
43  float lmin, float lmax,
44  bool add, float t);
45 protected:
46  virtual bool updateParmsFlags();
47 
48  virtual COP2_ContextData *newContextData(const TIL_Plane *, int,
49  float t, int xres, int yres,
50  int thread,
51  int max_threads);
52 
53  virtual const char *getKeyPlane(COP2_Context &context);
54 
55  virtual int getSuperSample(COP2_Context &context);
56 
57  virtual bool convertToColorSpace(COP2_Context &context,
58  const float *c1, const float *c2,
59  const float *c3, const float *c4,
60  float *&d1, float *&d2,
61  float *&d3, float *&d4,
62  int size);
63 
65  void *&data);
66 
67  virtual bool isFrameEffectHandled() { return false; }
68 private:
69  COP2_LumaKey(OP_Network *parent, const char *name,
70  OP_Operator *entry);
71  virtual ~COP2_LumaKey();
72 
73  virtual void getShaderAndConstants(COP2_Context &context,
74  UT_String &shader_funcs,
75  UT_ComputeGPU &engine);
76 
77  bool MIN_LUMINANCE()
78  { return (bool) evalInt(ARG_LUMAKEY_MIN_LUM, 0,0); }
79  float MIN_VALUE(float t)
80  { return evalFloat(ARG_LUMAKEY_MIN_VALUE, 0,t); }
81 
82  bool MAX_LUMINANCE()
83  { return (bool) evalInt(ARG_LUMAKEY_MAX_LUM, 0,0); }
84  float MAX_VALUE(float t)
85  { return evalFloat(ARG_LUMAKEY_MAX_VALUE, 0,t); }
86 
87  float ROLLOFF(float t)
88  { return evalFloat(ARG_LUMAKEY_ROLLOFF, 0,t); }
89 
90  int ROLLOFF_FUNCTION()
91  { return evalInt(ARG_LUMAKEY_ROLL_FUNC,0,0); }
92 
93  int DISCARD()
94  { return evalInt(ARG_LUMAKEY_DISCARD,0,0); }
95 
96  int FUNCTION()
97  { return evalInt(ARG_LUMAKEY_FUNCTION,0,0); }
98 
99  int SUPER_SAMPLE(float t)
100  { return evalInt(ARG_LUMAKEY_SUPER_SAMPLE,0,t); }
101 
102  void KEY_PLANE(UT_String &st)
103  { evalString(st, ARG_LUMAKEY_KEY_PLANE, 0, 0); }
104 
105  int myParmBase;
106 };
107 
109 {
110 public:
112  virtual ~cop2_LumaContext() {}
113 
114  virtual bool createPerRes() const { return false; }
115 
116  int myMinLum;
117  float myMinVal;
118  int myMaxLum;
119  float myMaxVal;
120 
121  float myRolloff;
127  float (*myInterpFunc)(float );
128  float myInvRoll;
129 };
130 #endif
static OP_TemplatePair myTemplatePair
Definition: COP2_LumaKey.h:35
static OP_VariablePair myVariablePair
Definition: COP2_LumaKey.h:36
virtual void getShaderAndConstants(COP2_Context &context, UT_String &shader_funcs, UT_ComputeGPU &engine)
virtual int getSuperSample(COP2_Context &)
Definition: COP2_KeyBase.h:71
fpreal evalFloat(int pi, int vi, fpreal t) const
#define ARG_LUMAKEY_DISCARD
Definition: COP2_LumaKey.h:19
UT_String myKeyPlane
Definition: COP2_LumaKey.h:126
#define ARG_LUMAKEY_ROLLOFF
Definition: COP2_LumaKey.h:20
GLsizeiptr size
Definition: glcorearb.h:663
virtual void setColorParms(float hmin, float hmax, float smin, float smax, float lmin, float lmax, bool add, float t)
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual COP2_KeyFunction getKeyFunction(COP2_Context &context, void *&data)
virtual const char * getKeyPlane(COP2_Context &context)
virtual COP2_ContextData * newContextData(const TIL_Plane *plane, int array_index, float t, int xres, int yres, int thread, int max_threads)
GLboolean * data
Definition: glcorearb.h:130
GLuint const GLchar * name
Definition: glcorearb.h:785
#define ARG_LUMAKEY_SUPER_SAMPLE
Definition: COP2_LumaKey.h:23
virtual bool convertToColorSpace(COP2_Context &context, const float *c1, const float *c2, const float *c3, const float *c4, float *&d1, float *&d2, float *&d3, float *&d4, int size)
virtual ~cop2_LumaContext()
Definition: COP2_LumaKey.h:112
virtual bool updateParmsFlags()
#define ARG_LUMAKEY_MAX_LUM
Definition: COP2_LumaKey.h:17
#define COP2_API
Definition: COP2_API.h:10
#define ARG_LUMAKEY_MAX_VALUE
Definition: COP2_LumaKey.h:18
#define ARG_LUMAKEY_ROLL_FUNC
Definition: COP2_LumaKey.h:21
#define ARG_LUMAKEY_MIN_LUM
Definition: COP2_LumaKey.h:15
exint evalInt(int pi, int vi, fpreal t) const
#define ARG_LUMAKEY_MIN_VALUE
Definition: COP2_LumaKey.h:16
virtual bool createPerRes() const
Definition: COP2_LumaKey.h:114
#define ARG_LUMAKEY_FUNCTION
Definition: COP2_LumaKey.h:22
float(* COP2_KeyFunction)(void *data, const float val[4])
Definition: COP2_KeyBase.h:33
virtual bool isFrameEffectHandled()
Definition: COP2_LumaKey.h:67
#define ARG_LUMAKEY_KEY_PLANE
Definition: COP2_LumaKey.h:24