HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP2_ChromaKey.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_ChromaKey.h
7  *
8  * COMMENTS:
9  * ChromaKey Op.
10  */
11 #ifndef _COP2_CHROMAKEY_H_
12 #define _COP2_CHROMAKEY_H_
13 
14 #include "COP2_API.h"
15 #define ARG_CHROMAKEY_HUE (myParmBase + 0)
16 #define ARG_CHROMAKEY_LUM (myParmBase + 1)
17 #define ARG_CHROMAKEY_DISCARD (myParmBase + 2)
18 #define ARG_CHROMAKEY_HUE_ROLLOFF (myParmBase + 3)
19 #define ARG_CHROMAKEY_SAT_ROLLOFF (myParmBase + 4)
20 #define ARG_CHROMAKEY_LUM_ROLLOFF (myParmBase + 5)
21 #define ARG_CHROMAKEY_ROLL_FUNC (myParmBase + 6)
22 #define ARG_CHROMAKEY_SUPER_SAMPLE (myParmBase + 7)
23 #define ARG_CHROMAKEY_KEY_PLANE (myParmBase + 8)
24 
25 #include "COP2_KeyBase.h"
26 
27 class cop2_ChromaContext;
28 
30 {
31 public:
32  static OP_Node *myConstructor(OP_Network*, const char *,
33  OP_Operator *);
36  static PRM_Template myTemplateList[];
37  static CH_LocalVariable myVariableList[];
38  static const char *myInputLabels[];
39 
40 protected:
41  virtual COP2_ContextData *newContextData(const TIL_Plane *, int,
42  float t, int xres, int yres,
43  int thread,int max_threads);
44 
45  virtual bool isFrameEffectHandled() { return false; }
46 
47  virtual void setColorParms(float hmin, float hmax,
48  float smin, float smax,
49  float lmin, float lmax,
50  bool add, float t);
51 
52  virtual void setSpillParms(float hmin, float hmax,
53  float smin, float smax,
54  float lmin, float lmax,
55  bool add, float t);
56 
57 private:
58  COP2_ChromaKey(OP_Network *parent, const char *name,
59  OP_Operator *entry);
60  virtual ~COP2_ChromaKey();
61 
62  virtual const char *getKeyPlane(COP2_Context &context);
63  virtual int getSuperSample(COP2_Context &context);
64 
65  virtual bool convertToColorSpace(COP2_Context &context,
66  const float *c1,
67  const float *c2,
68  const float *c3,
69  const float *c4,
70  float *&d1,
71  float *&d2,
72  float *&d3,
73  float *&d4,
74  int size);
75 
77  void *&data);
78 
79  virtual void colorFunction(COP2_Context &context,
80  float val[4], float key);
81 
83  int component);
84 
85  virtual void getShaderAndConstants(COP2_Context &context,
86  UT_String &shader_funcs,
87  UT_ComputeGPU &engine);
88 
89  void HUE(float &h1, float &h2, float t)
90  { h1 = evalFloat(ARG_CHROMAKEY_HUE, 0, t);
91  h2 = evalFloat(ARG_CHROMAKEY_HUE, 1, t); }
92 
93  void SAT(float &s1, float &s2, float t)
94  { s1 = evalFloat(ARG_CHROMAKEY_HUE, 2, t);
95  s2 = evalFloat(ARG_CHROMAKEY_HUE, 3, t); }
96 
97  void LUM(float &l1, float &l2, float t)
98  { l1 = evalFloat(ARG_CHROMAKEY_LUM, 0, t);
99  l2 = evalFloat(ARG_CHROMAKEY_LUM, 1, t); }
100 
101  float HUE_ROLLOFF(float t)
102  { return evalFloat(ARG_CHROMAKEY_HUE_ROLLOFF, 0,t); }
103 
104  float SAT_ROLLOFF(float t)
105  { return evalFloat(ARG_CHROMAKEY_SAT_ROLLOFF, 0,t); }
106 
107  float LUM_ROLLOFF(float t)
108  { return evalFloat(ARG_CHROMAKEY_LUM_ROLLOFF, 0,t); }
109 
110  int ROLLOFF_FUNCTION()
111  { return evalInt(ARG_CHROMAKEY_ROLL_FUNC,0,0); }
112 
113  int DISCARD()
114  { return evalInt(ARG_CHROMAKEY_DISCARD,0,0); }
115 
116  int SUPER_SAMPLE(float t)
117  { return evalInt(ARG_CHROMAKEY_SUPER_SAMPLE,0,t); }
118 
119  void KEY_PLANE(UT_String &st)
120  { evalString(st, ARG_CHROMAKEY_KEY_PLANE, 0, 0.0f); }
121 
122  int myParmBase;
123 };
124 
126 {
127 public:
129  virtual ~cop2_ChromaContext() {}
130 
131  float myHueMin, myHueMax;
132  float mySatMin, mySatMax;
133  float myLumMin, myLumMax;
141  float (*myInterpFunc)(float);
142 };
143 
144 #endif
#define ARG_CHROMAKEY_DISCARD
png_voidp s1
Definition: png.h:2193
static OP_VariablePair myVariablePair
virtual void getShaderAndConstants(COP2_Context &context, UT_String &shader_funcs, UT_ComputeGPU &engine)
virtual bool isFrameEffectHandled()
virtual int getSuperSample(COP2_Context &)
Definition: COP2_KeyBase.h:71
fpreal evalFloat(int pi, int vi, fpreal t) const
virtual void setSpillParms(float hmin, float hmax, float smin, float smax, float lmin, float lmax, bool add, float t)
#define ARG_CHROMAKEY_SAT_ROLLOFF
#define ARG_CHROMAKEY_ROLL_FUNC
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)
#define ARG_CHROMAKEY_LUM
GLfloat f
Definition: glcorearb.h:1925
virtual ~cop2_ChromaContext()
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual COP2_KeyFunction getKeyFunction(COP2_Context &context, void *&data)
virtual cop2_Interpolate getInterpFunction(COP2_Context &context, int component)
#define ARG_CHROMAKEY_HUE_ROLLOFF
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_CHROMAKEY_SUPER_SAMPLE
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)
static OP_TemplatePair myTemplatePair
png_voidp png_voidp s2
Definition: png.h:2193
#define COP2_API
Definition: COP2_API.h:10
#define ARG_CHROMAKEY_KEY_PLANE
#define ARG_CHROMAKEY_LUM_ROLLOFF
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define ARG_CHROMAKEY_HUE
exint evalInt(int pi, int vi, fpreal t) const
virtual void colorFunction(COP2_Context &context, float val[4], float key)
float(* COP2_KeyFunction)(void *data, const float val[4])
Definition: COP2_KeyBase.h:33
float(* cop2_Interpolate)(float v1, float v2, float w)
Definition: COP2_KeyBase.h:32