00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _COP2_PIXELOP_H_
00021 #define _COP2_PIXELOP_H_
00022
00023 #include "COP2_API.h"
00024 #include <TIL/TIL_Defines.h>
00025 #include <RU/RU_PixelEngine.h>
00026
00027 class COP2_PixelFunction;
00028 class RU_GPUPixelEngine;
00029
00030 #include "COP2_MaskOp.h"
00031
00032 #define ARG_PIXELOP_CC_IN_UNPREMULT "dounpremult"
00033 #define ARG_PIXELOP_QUANTIZE_HERE "quantize"
00034
00035 class COP2_API COP2_PixelOp : public COP2_MaskOp
00036 {
00037 public:
00038 virtual unsigned disableParms();
00039 virtual bool isSlowOperation() const { return false; }
00040
00041
00042
00043 virtual COP2_Node * getPassThroughInput(COP2_Context &);
00044
00045 static OP_TemplatePair myTemplatePair;
00046 static PRM_Template myTemplateList[];
00047
00048
00049
00050
00051 virtual void getInputDependenciesForOutputArea(
00052 COP2_CookAreaInfo &output_area,
00053 const COP2_CookAreaList &input_areas,
00054 COP2_CookAreaList &needed_areas);
00055
00056 virtual TIL_ViewerType getCurveEditorType()
00057 { return TIL_VIEW_GRAPH_CURVES; }
00058
00059 protected:
00060 virtual OP_ERROR doCookMyTile(COP2_Context &context,
00061 TIL_TileList *tilelist);
00062
00063 virtual COP2_ContextData *newContextData(const TIL_Plane *, int,
00064 float t, int xres, int yres,
00065 int thread,
00066 int max_threads);
00067
00068
00069 virtual RU_PixelFunction *addPixelFunction(const TIL_Plane *plane,
00070 int array_index, float t,
00071 int xres, int yres,
00072 int thread)=0;
00073
00074
00075 virtual void getPixelFunction(const TIL_Plane *plane,
00076 int array_index, float t,
00077 int xres, int yres,
00078 int thread,
00079 COP2_PixelFunction *&func,
00080 bool concatenate,
00081 bool dependent_too);
00082
00083 virtual bool checkAlignment(int x1, int y1, int x2, int y2,
00084 int ix1, int iy1,
00085 int ix2, int iy2,
00086 int tilex, int tiley);
00087
00088 COP2_PixelOp(OP_Network *parent, const char *name,
00089 OP_Operator *entry);
00090 virtual ~COP2_PixelOp();
00091
00092 bool computeAlphaValues(COP2_Context &context, TIL_TileList *tiles,
00093 til_AlignedBlock *&before,
00094 til_AlignedBlock *&after,
00095 bool &isalphaconst);
00096 void multiplyAlpha(TIL_TileList *tiles, float *alpha,
00097 bool docooked, bool isalphaconst);
00098
00099 static int editCurves(void *, int, float,
00100 const PRM_Template *);
00101
00102 virtual void getMaxNumThreadsInCook(COP2_Context &,
00103 int &plane,
00104 int &node,
00105 int &op) const;
00106
00107 virtual bool isGPUAssisted(const TIL_Plane &plane,
00108 int array_index, float t,
00109 int xres, int yres,
00110 int thread_index);
00111 private:
00112 int QUANTIZE_HERE()
00113 { return evalInt(ARG_PIXELOP_QUANTIZE_HERE, 0, 0); }
00114
00115 int DO_UNPREMULT()
00116 { return evalInt(ARG_PIXELOP_CC_IN_UNPREMULT, 0, 0); }
00117
00118 int myPixelOpParmBase;
00119 };
00120
00121 class COP2_API cop2_PixelOpContext : public COP2_ContextData
00122 {
00123 public:
00124 cop2_PixelOpContext()
00125 : myEngine(0), myGPUEngine(0), myFunction(0) {}
00126
00127 virtual ~cop2_PixelOpContext();
00128
00129 virtual bool createPerPlane() const { return true; }
00130 virtual bool createPerRes() const { return false; }
00131 virtual bool createPerThread() const;
00132
00133 RU_PixelEngine *myEngine;
00134 RU_GPUPixelEngine *myGPUEngine;
00135 COP2_PixelFunction *myFunction;
00136 };
00137
00138 #endif