45 using namespace HDK_Sample;
54 PRM_Name(
"bottom",
"Bottom Enhance"),
92 COP2_SampleFilter::COP2_SampleFilter(
OP_Network *parent,
111 float t,
int xres,
int yres,
126 effect *=
SYSmin(scx,scy);
128 data->
myLeft = LEFT(t) * effect;
129 data->
myRight = RIGHT(t) * effect;
130 data->
myTop = TOP(t) * effect;
131 data->
myBottom = BOTTOM(t) * effect;
203 return "This operation enhances individual edges.";
206 namespace HDK_Sample {
236 output, input, t, thread, data); }
242 template<
class Type,
int fast>
int
250 const float *kernel = parm->
myKernel;
252 const Type *source_data, *iscan1, *iscan2, *iscan3;
253 Type *dest_data, *scan;
260 w = output->
myX2 - output->
myX1 + 1;
261 h = output->
myY2 - output->
myY1 + 1;
271 iscan1 = source_data + 1;
272 iscan2 = iscan1 + istride;
273 iscan3 = iscan2 + istride;
281 pixel.
set(iscan1[x-1]);
282 sum = (
float)pixel * kernel[0];
284 pixel.
set(iscan1[x]);
285 sum += (
float)pixel * kernel[1];
287 pixel.
set(iscan1[x+1]);
288 sum += (
float)pixel * kernel[2];
290 pixel.
set(iscan2[x-1]);
291 sum += (
float)pixel * kernel[3];
293 pixel.
set(iscan2[x]);
294 sum += (
float)pixel * kernel[4];
296 pixel.
set(iscan2[x+1]);
297 sum += (
float)pixel * kernel[5];
299 pixel.
set(iscan3[x-1]);
300 sum += (
float)pixel * kernel[6];
302 pixel.
set(iscan3[x]);
303 sum += (
float)pixel * kernel[7];
305 pixel.
set(iscan3[x+1]);
306 sum += (
float)pixel * kernel[8];
Simple example of a kernel filter.
void getInputDependenciesForOutputArea(COP2_CookAreaInfo &output_area, const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas) override
Storage class for our parameters and the kernel.
float * myKernel
Kernel filter derived from parameters.
static OP_Node * myConstructor(OP_Network *, const char *, OP_Operator *)
All nodes are instantiated via a myConstructor method.
void computeImageBounds(COP2_Context &context) override
OP_ERROR doCookMyTile(COP2_Context &context, TIL_TileList *tilelist) override
OP_ERROR error() override
void computeImageBounds(COP2_Context &context) override
#define FOR_EACH_UNCOOKED_TILE(list, tile, i)
int filter(TIL_Region *output, const TIL_Region *input, float t, int thread, void *data) override
static OP_TemplatePair myTemplatePair
void setImageBounds(int x1, int y1, int x2, int y2)
bool addOperator(OP_Operator *op, std::ostream *err=nullptr)
static OP_VariablePair myVariablePair
void * getImageData(int index)
IMATH_NAMESPACE::V2f float
bool expandNeededArea(int pixels_left, int pixels_down, int pixels_right, int pixels_up)
int filter(TIL_TileList *output, const TIL_Region *input, float t, int thread=-1, void *data=0) override
GLint GLenum GLboolean GLsizei stride
COP2_ContextData * data()
void getScaleFactors(int xres, int yres, float &sx, float &sy) const
GLuint const GLchar * name
void getInputDependenciesForOutputArea(COP2_CookAreaInfo &output_area, const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas) override
PRM_API const PRM_Type PRM_FLT_J
GLenum GLenum GLsizei void * table
PRM_API const PRM_Type PRM_SWITCHER
COP2_CookAreaInfo * makeOutputAreaDependOnMyPlane(int input, COP2_CookAreaInfo &output_area, const COP2_CookAreaList &input_areas, COP2_CookAreaList &needed_areas)
void releaseRegion(TIL_Region *, int output=0)
cop2_EdgeEnhanceOp(RU_Algorithm *alg)
cop2_EdgeEnhance(const float *kernel)
PRM_API PRM_Name PRMswitcherName
GLfloat GLfloat GLfloat GLfloat h
**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
TIL_Region * inputRegion(int input_index, COP2_Context &context, const TIL_Plane *plane, int array_index, float t, int xstart, int ystart, int xend, int yend, TIL_RegionExtend hold=TIL_BLACK, int share=1, void *regionmem[PLANE_MAX_VECTOR_SIZE]=0, bool correct_aspect=true, bool correct_bounds=true, int scan_alignment=0)
float getFrameScopeEffect(int image_index) override
int filter(TIL_TileList *output, const TIL_Region *input, float t, OP_Node *ndata=0, int thread=-1, void *data=0)
void newCop2Operator(OP_OperatorTable *table)
static const char * myInputLabels[]
static OP_TemplatePair myTemplatePair
static OP_VariablePair myVariablePair
COP2_ContextData * newContextData(const TIL_Plane *p, int array_index, float t, int xres, int yres, int thread, int max_threads) override
COP2_MASK_SWITCHER(4,"HDK Sample Filter")
bool getImageBounds(int &x1, int &y1, int &x2, int &y2)
void getImageData(const unsigned char *&data) const
void clearToBlack(bool markconstant=true)
GLubyte GLubyte GLubyte GLubyte w
static PRM_Template myTemplateList[]
const char * getOperationInfo() override
Returns a description of the operation for the node info popup.
GLdouble GLdouble GLdouble y2
exint getImageIndex(double t, int clamp_range=1, int round_off=SEQUENCE_NEAREST) const
PRM_API PRM_Default PRMzeroDefaults[]
DECLARE_FILTER_OP(cop2_EdgeEnhanceOp, override)
virtual int filter(TIL_TileList *, const TIL_Region *, float, int, void *)
IMPLEMENT_FILTER_OP(cop2_EdgeEnhance, cop2_EdgeEnhanceOp)
~COP2_SampleFilter() override