HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
COP2_Node.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_Node.h
7  *
8  * COMMENTS:
9  * 2nd Generation Composite operator base class
10  */
11 
12 #ifndef __COP2_Node_h__
13 #define __COP2_Node_h__
14 
15 #include "COP2_API.h"
16 #include <UT/UT_ErrorManager.h>
17 #include <UT/UT_SymbolTable.h>
18 #include <UT/UT_FloatArray.h>
19 #include <UT/UT_IntArray.h>
20 #include <UT/UT_ValArray.h>
21 #include <UT/UT_Array.h>
22 #include <UT/UT_Lock.h>
23 #include <UT/UT_Rect.h>
24 #include <UT/UT_TokenString.h>
25 #include <UT/UT_Thread.h>
26 #include <UT/UT_UniquePtr.h>
27 #include <UT/UT_FilterType.h>
28 #include <UT/UT_VectorTypes.h>
29 
30 #include <OP/OP_Network.h>
31 #include <OP/OP_OperatorPair.h>
32 
33 #include <TIL/TIL_Defines.h>
34 #include <TIL/TIL_Sequence.h>
35 #include <TIL/TIL_Region.h>
36 #include <TIL/TIL_TileList.h>
37 
38 #include "COP2_Common.h"
39 #include "COP2_Context.h"
40 #include "COP2_BoundsCache.h"
41 
42 class UT_Color;
43 class UT_FileLUT;
44 class UT_Interrupt;
45 class UT_StringArray;
46 class UT_StringHolder;
47 class IMG_TileOptions;
48 class TIL_ImageSource;
49 class TIL_Raster;
50 class TIL_TileCache;
51 class TIL_Plane;
52 class TIL_ProxyManager;
53 class TIL_Region;
54 class TIL_Tile;
55 class TIL_TileList;
56 class TIL_TileManager;
57 class TIL_TileMPlay;
58 class PXL_Lookup;
59 class OP_OperatorTable;
60 class COP2_PixelFunction;
64 class COP2_CheckpointWrapper;
65 class COP2_CookAreaInfo;
66 class COP2_CookAreaList;
67 class COP2_VolatileParmManager;
69 
71  TIL_Region *, COP2_Node *);
72 
73 
75 {
76 public:
77 
78  // Lets the COP know that we are accessing, and again when we're done.
79  virtual OP_ERROR open(short &key, int clear_errors = 0);
80  bool isOpen() const { return myCop2OpenCount > 0; }
81  virtual void close(short key);
82 
83  // gets sequence information for this COP: start/end, res, rate.
84  TIL_Sequence * getSequenceInfo(OP_ERROR *error = 0);
85 
86  // gets the sequence info for an input to this COP.
87  const TIL_Sequence *inputInfo(int input);
88 
89  // gets the sequence time for the current time.
90  float getSequenceTime() const;
91 
92  // gets the image source for the viewer.
93  TIL_ImageSource *getImageSource() { return myImageSource; }
94 
95  void forceRecook(bool evensmartcache = false) override;
96 
97  // Used for collecting cook timing statistics all nodes in one cook.
98  // You maintain ownership of the table.
99  static void setNodeTimingTable(COP2_DebugTimingTable *table);
100 
101  // Sets the LUT (globally) that will be used for previewing nodes in
102  // the network editor
103  static void setPreviewLUT(
104  const UT_StringHolder &display,
105  const UT_StringHolder &view);
106  static void setPreviewLUT(
107  const UT_StringHolder &lut_name);
108 
109  static const PXL_Lookup *getPreviewLUT();
110  static const UT_StringHolder &getPreviewLUTName();
111 
112  // cooks this COP and produces an output raster, stored in 'raster'.
113  // the second method cooks a sub-region of the image; if subregion
114  // is 1, the raster contains the full image and only the sub-region
115  // is updated. If 0, the raster will only contain the sub-region.
116  // returns 1 on success or 0 if an error occurred.
117  int cookToRaster(TIL_Raster *raster, OP_Context &,
118  const TIL_Plane *plane,
119  int array_index = 0,
120  int subregion = 1, int clear = 1,
121  float black = 0.0F, float white = 1.0F,
122  int compindex = -1,
123  int ignore_bwpoints=0,
124  const int *comp_map=0,
125  float gamma = 1.0F,
126  bool interactive = false,
127  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
128  const UT_StringHolder &ocio_look = UT_StringHolder(),
129  const UT_StringHolder &ocio_display = UT_StringHolder(),
130  const UT_StringHolder &ocio_view = UT_StringHolder());
131 
132  int cookToRaster(TIL_Raster *raster, OP_Context &,
133  const TIL_Plane *plane,
134  int array_index,
135  int xstart,int ystart,int xend,int yend,
136  int subregion = 1, int clear = 1,
137  float black = 0.0F, float white = 1.0F,
138  int compindex = -1,
139  int ignore_bwpoints=0,
140  const int *comp_map=0,
141  float gamma = 1.0F,
142  bool interactive = false,
143  UT_ValArray<TIL_Raster *> *tiles = 0,
144  int tile_index = 0, TIL_TileMPlay * =0,
145  bool cleanup_after = true,
146  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
147  const UT_StringHolder &ocio_look = UT_StringHolder(),
148  const UT_StringHolder &ocio_display = UT_StringHolder(),
149  const UT_StringHolder &ocio_view = UT_StringHolder());
150 
151  // This method cooks multiple output rasters at a time. The arrays must all
152  // be the same size (except in the case of flipbooking to TIL_TileMplay,
153  // where rasters may be empty). Currently, rendering to different
154  // OP_Context resolutions is not supported; only to different
155  // context.myTime's.
156  int cookToRaster(UT_ValArray<TIL_Raster *> &rasters,
157  UT_ValArray<OP_Context *> &contexts,
159  UT_IntArray &array_index,
160  UT_ValArray<const int *> &comp_map,
162  int subregion = 1, int clear = 1,
163  float black = 0.0F, float white = 1.0F,
164  int compindex = -1,
165  int ignore_bwpoints=0,
166  float gamma = 1.0F,
167  bool interactive = false,
168  UT_ValArray<TIL_Raster *> *tiles = 0,
169  int tile_index = 0, TIL_TileMPlay * =0,
170  bool cleanup_after = true,
171  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
172  const UT_StringHolder &ocio_look = UT_StringHolder(),
173  const UT_StringHolder &ocio_display = UT_StringHolder(),
174  const UT_StringHolder &ocio_view = UT_StringHolder());
175 
176  // This method sets data in "plane_parms" corresponding to the other
177  // parameters that are passed in. The plane cooking parms are passed
178  // to the different threads that perform the cooking.
179  void computePlaneCookParms(COP2_PlaneCookParms &plane_parms,
180  OP_Context &context,
181  const TIL_Plane *rplane,
182  int array_index,
183  TIL_Raster *raster,
184  int thread_index,
185  const int *compmap,
186  int xstart, int ystart,
187  int xend, int yend,
188  bool flipbook,
189  UT_ValArray<TIL_Tile *> *tile_list);
190 
191  // Is the specified plane in the tile cache?
192  bool isPlaneCached(const TIL_Plane &refplane,
193  int array_index, float time,
194  int xres, int yres,
195  int xstart, int ystart, int xend, int yend,
196  bool flipbook);
197  bool isPlaneCached(COP2_Context &context,
198  const TIL_Plane &refplane,
199  int xstart, int ystart, int xend, int yend,
200  bool flipbook);
201 
202  // Move tiles for a particular plane from the regular cache into the
203  // list of checkpointed tiles. This method is called from the cook
204  // scheduler.
205  void checkpointCachedTilesForPlane(
206  const TIL_Plane &refplane,
207  int array_index, float time,
208  int xres, int yres,
209  int xstart, int ystart, int xend, int yend,
210  bool flipbook,
211  UT_ValArray<TIL_Tile *> &tile_list);
212  void checkpointCachedTilesForPlane(COP2_Context &context,
213  const TIL_Plane &refplane,
214  int xstart, int ystart, int xend, int yend,
215  bool flipbook,
216  UT_ValArray<TIL_Tile *> &tile_list);
217 
218  // This method maps from playbar time to the time in the sequence when the
219  // node will actually be cooked. File COPs, for example, always cook at
220  // time 0 if their sequence is a single image.
221  double mapTimeIntoSequence(double time);
222 
223 
224  // cooks this OP into a file (which should not be open yet). If scope isn't
225  // null, only the scoped planes in that sequence will be writen to the file.
226  int cookToFile(const UT_StringArray &filenames,
227  const IMG_TileOptions *,
228  const TIL_Sequence *scope,
229  const UT_IntArray &image_index,
230  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
231  const UT_StringHolder &ocio_look = UT_StringHolder(),
232  const UT_StringHolder &ocio_display = UT_StringHolder(),
233  const UT_StringHolder &ocio_view = UT_StringHolder(),
234  const char *uselut = 0,
235  float gamma = 1.0F,
236  UT_InclusiveRect *bounds = 0,
237  bool single_frame = false,
238  bool thread_io = false,
239  bool env_map = false,
240  bool use_progress_dialog=true);
241 
242  int cookToFile(const UT_StringArray &filenames,
243  const IMG_TileOptions *,
244  OP_Context &context,
245  const UT_IntArray &image_index,
246  const char *cplane, const char *aplane = 0,
247  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
248  const UT_StringHolder &ocio_look = UT_StringHolder(),
249  const UT_StringHolder &ocio_display = UT_StringHolder(),
250  const UT_StringHolder &ocio_view = UT_StringHolder(),
251  const char *uselut = 0,
252  float gamma = 1.0F,
253  UT_InclusiveRect *bounds = 0,
254  bool single_frame = false,
255  bool thread_io = false,
256  bool env_map = false,
257  bool use_progress_dialog=true);
258 
259  void waitForLastFile();
260 
261  // Does a flipbook render. 'info' should contain the planes to render,
262  // the frame range and image size.
263  int cookFlipbook(const TIL_Sequence &info,
264  int step = 1,
265  float gamma = 1.0f,
266  const char *lut = 0,
267  bool startnew=true,
268  bool (*updateCallback)(void *) = 0,
269  void *updateEntity = 0,
270  bool write_houdini_frame = true,
271  const char *session_label = NULL,
272  const UT_StringHolder &ocio_ospace = UT_StringHolder(),
273  const UT_StringHolder &ocio_look = UT_StringHolder(),
274  const UT_StringHolder &ocio_display = UT_StringHolder(),
275  const UT_StringHolder &ocio_view = UT_StringHolder());
276 
277  // returns the identifier for a specific image at this node, described by
278  // context.xres/yres/time, plane and array_index. You must free
279  // the token string when you're done with it.
280  virtual UT_TokenString *getImageIdentifier(const TIL_Plane *plane,
281  int array_index, float t,
282  int xres, int yres,
283  int thread);
284 
285  // getContextData returns an existing context data or allocates a new
286  // context if it's not found. Contexts only exist for a single cook, and
287  // are deleted once close() is called.
288  COP2_Context *getContextData(const TIL_Plane *plane,
289  int array_index,
290  float t,
291  int xres,
292  int yres,
293  int thread,
294  bool force_bounds = true);
295 
296  // Determines the bounds of the operation. Normally (0,0) - (xres-1,yres-1)
297  void getImageBounds(const TIL_Plane *plane, int array,
298  float t, int xres, int yres, int thread,
299  int &x1, int &y1,int &x2, int &y2);
300  inline void getImageBounds(COP2_Context &context,
301  int &x1, int &y1,int &x2, int &y2);
302 
303  // Gets the bounds of input 'input'. Returns false if the input does not
304  // exist.
305  inline bool getInputBounds(int input, COP2_Context &context,
306  int &x1, int &y1, int &x2, int &y2);
307 
308  // General version of above.
309  bool getInputBounds(int input,
310  const TIL_Plane *plane, int array,
311  float t, int xres, int yres,
312  int thread,
313  int &x1, int &y1, int &x2, int &y2);
314 
315  // returns true if the tile at (tilex,tiley) pixel coords is aligned &
316  // the same size as the corresponding tile in the input. This can only
317  // be called once this nodes bounds have been determined (ie, don't call
318  // from computeImageBounds). with_node is optional; it uses a different
319  // node instead of 'this' ('with_node' and its input 'input').
320  bool isTileAlignedWithInput(int input,
321  COP2_Context &context,
322  int tilex, int tiley,
323  COP2_Node *with_node = 0);
324  bool isTileAlignedWithInput(int input,
325  const TIL_Plane *plane,
326  int array_index,
327  float t, int xres, int yres,
328  int thread,
329  int tilex, int tiley,
330  COP2_Node *with_node=0);
331 
332  // The following method is called when you wish to compare the alignment
333  // with the input at a different time.
334  bool isTileAlignedWithInputAtTime(int input,
335  COP2_Context &context,
336  int tilex, int tiley,
337  float input_time,
338  COP2_Node *with_node=0);
339 
340  // The following function is very similar to isTileAlignedWithInput,
341  // except it compares the tile in the specified input plane with that
342  // specified in this node's context. In particular, this is used when
343  // we cannot assume that this node actually contains the input plane.
344  bool isInputTileAlignedWithContext(int input,
345  const TIL_Plane *plane,
346  int tilex, int tiley,
347  COP2_Context &context,
348  COP2_Node *with_node=0);
349 
350  bool arePlanesAligned(COP2_Context &context,
351  const TIL_Plane *plane1, int aindex1,
352  const TIL_Plane *plane2, int aindex2,
353  int tilex, int tiley);
354 
355 
356  bool isInputPlaneCompatible(COP2_Context &context,
357  int input_num);
358 
359  // Returns the difference in origin of the this bound with its input.
360  bool getInputBoundsDiff(int input, COP2_Context &context,
361  int &dx, int &dy);
362 
363 
364  // Allows input COPs to remap the time into their time space.
365  fpreal getTimeTransform(int input, fpreal t) override;
366 
367  // Set the resolution in the input context to the input's resolution.
368  void getInputRes(int input, fpreal t,
369  const OP_Context &context,
370  OP_Context &icontext) override;
371 
372  // allows generators to remap their cook time.
373  virtual double remapTime(double t);
374  virtual bool isTimeModifier() const { return false; }
375 
376  // return true if this is a slow operation that may need interactive
377  // quality reduction help.
378  virtual bool isSlowOperation() const { return true; }
379  virtual bool isTimeDepOperation() { return false; }
380  virtual bool isGPUAssisted(const TIL_Plane & /*plane*/,
381  int /*array_index*/, float /*t*/,
382  int /*xres*/, int /*yres*/,
383  int /*thread_index*/)
384  { return false; }
385 
386  virtual bool isGenerator() const { return false; }
387  virtual bool isPixelBased() const { return false; }
388 
389  virtual int getMaskInput() const { return -1; }
390 
391  // these functions return a scale factor for biasing U and V lengths for
392  // things like blur kernels and transforms based on the proxy level,
393  // pixel aspect ratio and interlacing.
394  void getScaleFactors(int xres, int yres,
395  float &sx, float &sy) const;
396  float getXScaleFactor(int xres) const;
397  float getYScaleFactor(int yres) const;
398 
399  // returns a plane which determines what should be displayed in the icon
400  // preview (RGB, alpha, depth, etc).
401  TIL_Plane *getPreviewPlane(int &index);
402  int getPreviewPlane(int &pindex, int &aindex);
403  int isFollowingParent(const COP2_Node *parent);
404  void setPreviewPlane(int pindex, int aindex =0);
405  void parentPreviewChanged();
406 
407  // return one of the follwing if your COP cannot be cooked multithreaded.
408  // COP2_MULTITHREADED allows multiple threads in the COP at once.
409  // COP2_SINGLE_THREAD allows only one thread in the COP at once, but
410  // releases the lock when the COP cooks its inputs.
411  // COP2_EXCLUSIVE_THREAD locks the COP until its cleanup function is called.
412  // This mode pretty much kills multithreaded performance. Use with
413  // care! (useful for debugging code).
414  virtual int isSingleThreadedCop() const {return COP2_MULTITHREADED;}
415 
416  // clears out the cache for this node.
417  void clearTilesInCache();
418 
419  // returns true if the frame in question exists. Only really overridden
420  // by the file COP. Set adjust to be true if you can use another frame
421  // in its place (like using the closest frame instead)
422  virtual bool doesFrameExist(int /*frame*/,
423  bool /*adjust*/ =true) { return true; }
424 
425  // frame locking
426 
427  // returns 1 if any plane at any time is locked.
428  int isAnythingLocked() const;
429 
430  // returns 1 if the plane is ever locked.
431  int isPlaneLocked(const TIL_Plane *p) const;
432 
433  // returns 1 if the COP is locked at time t
434  int isSequenceLocked(float t);
435 
436  // returns 1 if the plane is locked at time t
437  int isPlaneLocked(const TIL_Plane *p, float t);
438 
439  // both methods return 1 if the op was successful.
440  int lockPlane(const TIL_Plane *p, float t);
441  int lockPlanes(float t);
442  int unlockPlane(const TIL_Plane *p, float t);
443  int unlockPlanes(float t);
444  int unlockAll();
445 
446  // Disk Caching for this node
447  void enableDiskCache(bool enable);
448  bool isDiskCacheEnabled() const { return myProxyEnable; }
449 
450  // Color selections.
451  virtual void setColorSelection(float *col, int size, bool accum);
452 
453  // Callback from the cache manager to remove tiles from a COP's list
454  // when the tile is thrown out of the cache.
455  static void tileRemovalCallback(void *parent, TIL_Tile *removed);
456  void tileRemoved(TIL_Tile *removed);
457 
458  static void setUpdateCallback(void (*callback)(float, bool, bool));
459  static void setViewerCallback(void (*viewer)(COP2_Node *, void *,
460  TIL_ViewerType ),
461  void *data);
462 
463  // interactive render commands.
464  static void setCookPosition(float u, float v);
465  static void abortCook();
466  static bool isCookAborted();
467  static void resetAbortFlag();
468  static bool isCooking();
469 
470  bool isCookAborted(int thread_index);
471 
472  bool isInterrupted(int threadidx);
473  void setInterrupted(int threadidx);
474 
475  static TIL_TileCache *getCache();
476  static TIL_ProxyManager *getProxyManager();
477  static TIL_TileManager *getTileManager();
478  static bool isInitialized();
479 
481  { return error(); }
482 
483  OP_ERROR error() override
484  {
485  // Call OP_Network::getErrorSeverity() directly
486  // here to avoid locking.
488  OP_ERROR csev = myCookErrorManager.getSeverity();
489 
490  return sev > csev ? sev : csev;
491  }
492  OP_ERROR error(OP_Context &context) override
493  {
494  // Call OP_Network::getErrorSeverity() directly
495  // here to avoid locking.
497  OP_ERROR csev = myCookErrorManager.getSeverity();
498 
499  return sev > csev ? sev : csev;
500  }
501 
502  // need to add a few things to the parm hash code.
504  int group_mask = 1) override;
505 
506 
507  // Collapsable Color & transform functions.
508  virtual void getPixelFunction(const TIL_Plane *plane,
509  int array_index, float t,
510  int xres, int yres,
511  int thread,
512  COP2_PixelFunction *&function,
513  bool concatenate,
514  bool dependent_too);
515 
516  virtual void getImageTransform(COP2_Context &context,
517  COP2_TransformParms &parms,
518  COP2_Node *& source,
519  int &input_index);
520 
521  // returns the color of pixel (x,y) for the given plane in color.
522  // 'color' should be big enough to hold the single pixels' values (use
523  // 4 floats if in doubt). If it could not be evaluated, false is returned.
524  // NB: This cooks the COP for the given pixel.
525  //
526  bool getPixelValue(const TIL_Plane *plane,
527  int array_index, float t,
528  int xres, int yres,
529  int x, int y,
530  float *color);
531 
532  bool getPixelValueByUV(const char *plane_name,
533  double u, double v,
534  bool interpolate,
535  UT_FloatArray &vals);
536 
537  bool getPixelColorValueByUV(COP2_ColorComponent comp,
538  double u, double v,
539  bool interpolate,
540  float &val);
541 
542  COP2_ThreadPref getThreadPref() const { return myThreadPreference; }
543 
544  // by default, most nodes can have as many threads as possible in their
545  // cook method. But some COPs can block with more than 1 thread, so this
546  // method gives a hint to the engine as to how many threads to allow at
547  // once in the cook - set 'plane' to the # of threads that can be cooking
548  // a given plane/time in a node; set 'node' to the # of threads that can be
549  // cooking in the node, regardless of plane/time; set 'op' to the # of
550  // threads that can be in a single Operator type at a time.
552  int &plane,
553  int &node,
554  int &op) const
555  { plane = node = op = TIL_MAX_THREADS; }
556 
557  // if true, only thread 0 can cook this operator.
558  virtual bool onlyCookInMainThread() const { return false; }
559 
560  // These functions setup and reset the table which translates thread
561  // process id's into our thread indices (0-TIL_MAX_THREADS).
562  static void setWorkingThreadId(int thread_index);
563  static void clearWorkingThreadId(int thread_index);
564 
565  // Returns the thread index based on the calling thread id
566  // (setWorkingThreadId must have been called first).
567  int getThreadIndex();
568 
569  // Menu building methods.
570  static void buildPlanePreviewMenu(
571  void *, PRM_Name *, int,
572  const PRM_SpareData *, const PRM_Parm *);
573  static void buildScopeMenu(
574  void *, PRM_Name *, int,
575  const PRM_SpareData *, const PRM_Parm *);
576  static void buildPlaneScopeMenu(
577  void *, PRM_Name *, int,
578  const PRM_SpareData *, const PRM_Parm *);
579  static void buildScopeMenuNoColAlpha(
580  void *, PRM_Name *, int,
581  const PRM_SpareData *, const PRM_Parm *);
582  static void buildPlaneMenu(
583  void *, PRM_Name *, int,
584  const PRM_SpareData *, const PRM_Parm *);
585  static void buildCompMenu(
586  void *, PRM_Name *, int,
587  const PRM_SpareData *, const PRM_Parm *);
588  static void buildInputScopeMenu(
589  void *, PRM_Name *, int,
590  const PRM_SpareData *, const PRM_Parm *);
591  static void buildInputPlaneMenu(
592  void *, PRM_Name *, int,
593  const PRM_SpareData *, const PRM_Parm *);
594  static void buildInputCompMenu(
595  void *, PRM_Name *, int,
596  const PRM_SpareData *, const PRM_Parm *);
597 
598  void buildPlaneMenu(PRM_Name *items, int maxsize,
599  bool useinput = false,
600  bool planes_only = false,
601  bool comps_only = false,
602  bool wild = true,
603  int input = 0,
604  bool nocoloralpha = false);
605 
606  static const char *getColorPlaneName();
607  static const char *getAlphaPlaneName();
608  static const char *getMaskPlaneName();
609  static const char *getDepthPlaneName();
610  static const char *getLumPlaneName();
611  static const char *getBumpPlaneName();
612  static const char *getPointPlaneName();
613  static const char *getNormalPlaneName();
614  static const char *getVelocityPlaneName();
615  static const char *getThumbnailPlaneKey();
616 
617  // Override to specify a plane to view in the COP viewer. No preference
618  // by default.
619  virtual bool preferredViewPlane(UT_WorkBuffer &) { return false; }
620 
621  // DEBUG stuff:
622  static int dumpCache(void *me, int i, float t,
623  const PRM_Template *);
624  static void printMe(void *me, std::ostream &os);
625 
626  static void addToFileLoadTime(float t);
627 
628  // Normal Public OP Stuff ************************************************
629  static const char *theChildTableName;
630  const char *getChildType() const override
631  { return COP2_OPTYPE_NAME; }
632  const char *getOpType() const override
633  { return COP2_OPTYPE_NAME; }
634 
635  OP_OpTypeId getChildTypeID() const override
636  { return COP2_OPTYPE_ID; }
637  OP_OpTypeId getOpTypeID() const override
638  { return COP2_OPTYPE_ID; }
639 
640  int64 getMemoryUsage(bool inclusive) const override
641  {
642  int64 mem = inclusive ? sizeof(*this) : 0;
643  mem += OP_Network::getMemoryUsage(false);
644  // FIXME: Count the actual memory here!!!
645  return mem;
646  }
647 
649  { return OP_RASTER_DATA; }
650  void *getCookedData(OP_Context &) override { return 0; }
651 
652  // Query color for Net Overview rendering
653  int getNetOverviewColor( UT_Color &color ) override;
654  void opChanged(OP_EventType type, void *data) override;
655  void userDataChanged(const UT_StringHolder &key) override;
656 
657  static void initializeExpressions();
658  static void initializeCache();
659  static void buildOperatorTable(OP_OperatorTable &table);
660  static void installCommands();
661 
664  static PRM_Template myTemplateList[];
665  static CH_LocalVariable myVariableList[];
666 
667  void getNodeSpecificInfoText(OP_Context &context,
668  OP_NodeInfoParms &iparms) override;
670  const OP_NodeInfoTreeParms &parms) override;
671 
672  void inputRes(int input, float t, int xres, int yres,
673  int &i_xres, int &i_yres);
674 
675  // This is the function called by multiple threads to cook the tiles
676  // of a node.
677  void processTile(COP2_ThreadCookParms *p);
678 
679  void setInputBlocked(bool blocked, int thread);
680 
681  // Remove all the regions for this node. This method is called when
682  // a node is uncheckpointed.
683  void removeRegions();
684 
685  // Allows you to define which inputs (or nodes) are opened and closed
686  // by this node.
687  virtual int getNumInputsToOpen() const { return nInputs(); }
688  virtual COP2_Node *getInputToOpen(int i)
689  { return CAST_COP2NODE(getInput(i, true)); }
690 
691  // For the output area (an area of a plane belonging to this node)
692  // and a set of input areas, determine which input areas and which
693  // parts of these areas are needed to cook the output area.
694  virtual void getInputDependenciesForOutputArea(
695  COP2_CookAreaInfo &output_area,
696  const COP2_CookAreaList &input_areas,
697  COP2_CookAreaList &needed_areas);
698 
699  // A checkpoint wrapper is a data structure that's internal to the
700  // cook scheduler. However, it's convenient to have a fast mapping
701  // from a node to a wrapper, the the node stores a pointer to the wrapper.
702  COP2_CheckpointWrapper *getCheckpointWrapper(int array_index);
703  void setCheckpointWrapper(int array_index,
704  COP2_CheckpointWrapper *wrap);
705 
706  // these are basically private for the cook scheduler ----- vvvvvv
707  // COP2_CheckpointWrapper is not a public class.
708  int getNumCheckpointWrappers() const;
709  COP2_CheckpointWrapper *getWrapper(int i) const;
710  void resetCheckpointWrappers();
711  // --------------------------------------------------------- ^^^^^^
712 
713  virtual void modifyViewMatrix(int input,
714  COP2_Context &context,
715  UT_Matrix4 &matrix,
716  float zoom);
717 
718  virtual COP2_Node *selectInput(int px, int py, const char *plane_name,
719  int array_index);
720  /// @{
721  /// Methods defined on OP_Node
722  //Absolute Width
723  fpreal getW() const override;
724  //Absolute Height
725  fpreal getH() const override;
726  /// @}
727 
728  // call to reset any missing or bad frames.
729  static void resetBadMissingFrames();
730 
731  // Global preferences controlled by the pref dialog.
732  static bool getShowPreviewPref();
733  static void setShowPreviewPref(bool show);
734 
735  unsigned referenceAllParameters(OP_Parameters *from,
736  bool relative_references = true) override;
737 
738 protected:
739  COP2_Node(OP_Network *net, const char *name, OP_Operator *entry);
740  ~COP2_Node() override;
741 
742  OP_ERROR cookMe(OP_Context &) override { return UT_ERROR_NONE; }
743  bool cook(OP_Context &) override;
744  OP_ERROR bypassMe(OP_Context &, int &) override
745  { return UT_ERROR_NONE; }
746 
747  static unsigned int getCookScore(float cooktime);
748 
749  // Set this appropriately if $W, $H should use the full resolution,
750  // and not the proxy resolution. By default, we use the proxy
751  // resolution, but if the node itself performs the correction, we
752  // want to use the full resolution.
753  void setVariableUseFullRes(bool onoff);
754 
755  bool evalVariableValue(fpreal &val, int index,
756  int thread) override;
758  int thr) override
759  { return OP_Network::evalVariableValue(v, i, thr); }
760 
762  UT_StringArray &reflist,
763  UT_StringArray *nodelist =0,
764  bool collapse = false,
765  bool check_missing = false,
766  bool show_missing_only=false) override;
767 
768  void launchViewer(TIL_ViewerType view);
769 
770  // call these methods when an error occurs during cookSequenceInfo().
771  void addError(int code, const char *msg = 0);
772  void addSystemError(const char *msg = 0);
773  void addWarning(int code, const char *msg = 0);
774  void addSystemWarning(const char *msg = 0);
775  void addMessage(int code, const char *msg = 0);
776 
777  // Call these methods when an error occurs during cooking.
778  void addCookError(int code, const char *msg = 0);
779  void addCookSystemError(const char *msg = 0);
780  void addCookWarning(int code, const char *msg = 0);
781  void addCookSystemWarning(int code, const char *msg = 0);
782  void addCookMessage(int code, const char *msg = 0);
783 
785 
786  // normally, an image cooked at 100x100 will look similar to the same image
787  // cooked at 200x200. If your node does NOT scale with resolution, return 1
788  virtual int isScaledImageDifferent() const { return 0; }
789 
790  // inputOpenFailed is called if the node fails to open.
791  virtual void inputOpenFailed(int ) { }
792 
793 
795  { return COP2_THREAD_NO_PREF; }
796 
797  // returns a short phrase describing the operation.
798  virtual const char *getOperationInfo();
799 
800  // cooks the information for the sequence.
801  virtual TIL_Sequence * cookSequenceInfo(OP_ERROR &error) = 0;
802 
803  bool isInputBlocked(int thread);
804 
805  // gets a specific tile of an input.
806  TIL_TileList *inputTile(int input_index,
807  COP2_Context &context,
808  const TIL_Plane *plane,
809  int array_index,
810  float t,
811  int xstart,
812  int ystart,
813  OP_ERROR *err = 0,
814  int block = 1,
815  bool *mask = 0,
816  COP2_Node *fromtile = 0,
817  bool correctorig = true,
818  bool *blocked = 0,
819  bool *was_corrected = 0);
820 
821  // gets a tile out of the plane specified by the context.
822  inline TIL_TileList *inputTile(int input_index,
823  COP2_Context &context,
824  int xstart,
825  int ystart,
826  OP_ERROR *err = 0,
827  int block = 1,
828  bool *mask = 0,
829  bool *blocked = 0,
830  bool *was_corrected = 0);
831 
832  // gets a specific tile of an input that corresponds to this tile.
833  inline TIL_TileList *inputTile(int input,
834  COP2_Context &context,
835  TIL_TileList *mytile,
836  float t,
837  OP_ERROR *err = 0,
838  int block = 1,
839  bool *mask = 0,
840  bool *blocked = 0,
841  bool *was_corrected = 0);
842 
843  // gets a specific tile specified by the tilelist and the context.
844  inline TIL_TileList *inputTile(int input,
845  COP2_Context &context,
846  TIL_TileList *mytile,
847  OP_ERROR *err = 0,
848  int block = 1,
849  bool *mask = 0,
850  bool *blocked = 0,
851  bool *was_corrected = 0);
852 
853  // copies the input tile specified in tilelist.
854  bool copyInput(int input,
855  COP2_Context &context,
856  TIL_TileList *tilelist,
857  float t,
858  OP_ERROR *err = 0,
859  int block = 1,
860  bool *mask = 0);
861 
862  bool copyInput(int input,
863  COP2_Context &context,
864  TIL_TileList *mytile,
865  OP_ERROR *err = 0,
866  int block = 1,
867  bool *mask = 0);
868 
869  // this is a modified version of inputTile() which should be called from
870  // passThroughTiles() only, instead of inputTile().
871  TIL_TileList *passInputTile(int input_index,
872  COP2_Context &context,
873  const TIL_Plane *plane,
874  int array_index,
875  float t,
876  int xstart,
877  int ystart,
878  int block,
879  bool *blocked,
880  bool *mask,
881  COP2_Node *fromTile = 0);
882 
883  // must be used to release a tile returned by inputTile when you are
884  // finished working with it. 'reset' removes the tiles from the cache.
885  void releaseTile(TIL_TileList *&, bool reset = false);
886 
887  // gets a region of an input channel, cooking tiles where necessary.
888  // region_data holds a list of num_region regions, which are allocated
889  // by the caller. returns 0 if errors were encountered.
890  TIL_Region * inputRegion(int input_index,
891  COP2_Context &context,
892  const TIL_Plane *plane,
893  int array_index,
894  float t,
895  int xstart,
896  int ystart,
897  int xend,
898  int yend,
900  int share = 1,
901  void *regionmem[PLANE_MAX_VECTOR_SIZE]=0,
902  bool correct_aspect = true,
903  bool correct_bounds = true,
904  int scan_alignment = 0);
905 
906  // gets a region out of an input. Plane & array index are specified in the
907  // context.
908  inline TIL_Region * inputRegion(int input_index,
909  COP2_Context &context,
910  int xstart,
911  int ystart,
912  int xend,
913  int yend,
915  int share = 1,
916  void *regionmem[PLANE_MAX_VECTOR_SIZE]=0,
917  bool correct_aspect = true,
918  bool correct_bounds = true,
919  int scan_alignment = 0);
920 
921  // gets an input region corresponding to a tilelist, an optional shift and
922  // an option to write the region data directly into the tilelist data.
923  TIL_Region * inputRegion(int input_index,
924  COP2_Context &context,
925  const TIL_Plane *plane,
926  int array_index,
927  float t,
928  TIL_TileList *tilelist,
929  int xshift=0,
930  int yshift=0,
931  int copy = 0,
932  TIL_RegionExtend hold = TIL_BLACK);
933 
934 
935  // gets a region out of an input. Plane & array index are specified in the
936  // context, while the region is determined by the tile dimensions.
937  inline TIL_Region * inputRegion(int input_index,
938  COP2_Context &context,
939  TIL_TileList *tilelist,
940  int xshift=0,
941  int yshift=0,
942  int copy = 0,
943  TIL_RegionExtend hold = TIL_BLACK);
944 
945  // allocates a region for output (ie, files read in scanline by scanline
946  // require temporary storage before being divided into tiles for
947  // efficiency.
948  inline TIL_Region * outputRegion(const TIL_Plane *plane, int array_index,
949  float t, int xres, int yres, int thread,
950  int xstart, int ystart,
951  int xend, int yend,
952  int share = 1,
953  int rindex = 0,
954  int alignment = 0);
955 
956  TIL_Region * outputRegion(COP2_Context &context,
957  int xstart, int ystart,
958  int xend, int yend,
959  int share = 1,
960  int rindex = 0,
961  int alignment = 0);
962 
963  // The following version of outputRegion takes a reference plane to use
964  // to compute the bounds. This is useful, for example, when the region
965  // we wish to store only has one channel, but we wish the plane to have
966  // 3 channels in our sequence info.
967  TIL_Region * outputRegion(const TIL_Plane *plane,
968  const TIL_Plane *ref_plane,
969  int array_index, float t,
970  int xres, int yres, int thread,
971  int xstart, int ystart,
972  int xend, int yend,
973  int share = 1,
974  int rindex = 0,
975  int alignment = 0);
976 
977  ////////////////////////////////////////////////////////////////////////
978  // Simple Scale related functions
979  // Implemented in COP2_NodeScale.C
980 
981  // This method simply scales the input to the current resolution and
982  // copies it into the given tilelist.
983  void scaleInput(int input, COP2_Context &context,
984  const TIL_Plane *plane, int array_index,
985  float t, UT_FilterType xfilter,
986  UT_FilterType yfilter,
987  TIL_TileList *tilelist);
988 
989  // This utility method is used to scale the supplied image bounds by
990  // the specified factors.
991  static void scaleImageArea(float sx, float sy,
992  int ix1, int iy1, int ix2, int iy2,
993  int &x1, int &y1, int &x2, int &y2);
994 
995  ////////////////////////////////////////////////////////////////////////
996  // Transform Related Fucntions
997  // Implemented in COP2_NodeTransform.C
998 
999  // given an area, this grabs the transformed image data from the input.
1000  TIL_Region * transformRegion(int input,
1001  COP2_Context &context,
1002  const TIL_Plane *plane,
1003  int aindex,
1004  float t,
1005  int xres,
1006  int yres,
1007  int xstart,
1008  int ystart,
1009  int xend,
1010  int yend,
1011  const COP2_TransformParms &parms,
1012  bool input_aspect_adjust = true,
1013  bool streak_off_frame = false);
1014 
1015  // transforms the input area/plane given by the region.
1016  // The region bounds should be in the input's canvas space, if they aren't,
1017  // set bounds_in_canvas_space to false;
1018  bool transformRegion(int input,
1019  COP2_Context &context,
1020  TIL_Region *region,
1021  const COP2_TransformParms &parms,
1022  bool input_aspect_adjust = true,
1023  bool bounds_in_canvas_space = true,
1024  bool streak_off_frame = false);
1025 
1026  bool isFullTransform(int input,
1027  COP2_Context &context,
1028  const COP2_TransformParms &cparms,
1029  bool input_aspect_adjust=true,
1030  COP2_Node **source_node=0,
1031  int *source_index=0,
1032  float *aspectx1=0,
1033  float *aspectx2=0,
1034  float *aspecty1=0,
1035  float *aspecty2=0,
1036  COP2_TransformParms *prepped_parms=0);
1037 
1038  TIL_Region * transformBlurRegion(int input,
1039  COP2_Context &context,
1040  const TIL_Plane *plane,
1041  int aindex,
1042  float t,
1043  int xres,
1044  int yres,
1045  int xstart,
1046  int ystart,
1047  int xend,
1048  int yend,
1049  float amount,
1050  float bias,
1052  bool deformation = false);
1053 
1054  bool transformBlurRegion(int input,
1055  COP2_Context &context,
1056  TIL_Region *region,
1057  float amount,
1058  float bias,
1060  bool deformation = false,
1061  bool bounds_in_canvas_space = true);
1062 
1063  // Helper function for transformRegion. It is called when all the
1064  // transform has to do is translate the region.
1065  bool translateRegion(COP2_Context &context,
1066  COP2_Node &source_node,
1067  int source_input,
1068  TIL_Region *region, float tx, float ty,
1069  TIL_RegionExtend hold,
1070  bool bounds_in_canvas_space,
1071  bool streak_off_frame);
1072 
1073  // Helper function for transformRegion. It is called on to do a full
1074  // transform.
1075  bool fullTransformRegion(COP2_Context &context,
1076  COP2_Node &source_node,
1077  int source_input,
1078  TIL_Region *region,
1079  COP2_TransformParms &parms,
1080  float haspect, float input_haspect,
1081  float vaspect, float input_vaspect,
1082  bool bounds_in_canvas_space);
1083 
1084  UT_Matrix4 getShiftedInverseTransformMatrix(COP2_Context &context,
1085  COP2_Node &source_node,
1086  int source_input,
1087  const TIL_Plane *iplane,
1088  int array_index,
1089  const COP2_TransformParms &parms,
1090  int &dx, int &dy);
1091 
1092  // Helper function for transformRegion and computeImageBounds. It is called
1093  // to prepare the transform parms for extraction. This method will do all
1094  // the collapsing of transforms as well. "source_node" will contain the
1095  // node whose input at "source_index" should be read for the data.
1096  // "source_node" will be initialized, but "source_index" needs to be the
1097  // index of the input for which we wish to prepare the parms (it may be
1098  // modified if transforms have collapsed).
1099  void prepareTransformParms(COP2_Context &context,
1100  COP2_TransformParms &parms,
1101  COP2_Node *& source_node,
1102  int &source_index,
1103  bool input_aspect_adjust);
1104 
1105  // adjustPivotParms adjusts the pivot and translate parms in order to
1106  // account for aspect ratios (it is a helper function to
1107  // prepareTransformParms).
1108  void adjustPivotParms(int input_index,
1109  COP2_TransformParms &parms,
1110  bool input_aspect_adjust);
1111 
1112  // Helper function for transformBlurRegion and computeImageBounds. It is
1113  // called to copy the set of transform parms and it prepares the new copies
1114  // for use.
1115  void copyAndPrepareTransformParms(
1117  &source_parms,
1119 
1120  //
1121  ////////////////////////////////////////////////////////////////////////
1122 
1123 
1124  void extractFromOutputRegion(TIL_TileList *tiles,
1125  TIL_Region *output);
1126 
1127  // like releaseTile for regions... call when you're finished with the
1128  // region.
1129  void releaseRegion(TIL_Region *, int output = 0);
1130 
1131  // gets tiles to process for this node. Normally, you just process the
1132  // nodes passed into cookMyTile(); however, if you need more to complete
1133  // the cook efficiently, request more using this function.
1134  // If block is 0, this function may return null. Only COP2_Node should
1135  // ever call this method with block set to 1.
1136  TIL_TileList *requestWorkingTiles(COP2_Context &context,
1137  const TIL_Plane *plane,
1138  int array_index,
1139  float t,
1140  int xstart, int ystart,
1141  int *cache_flag = 0,
1142  int ignore_bypass = 0,
1143  int block = 0);
1144 
1145  // once you're done processing the tiles requested with requestWorkingTiles
1146  // you must call this function. Do not call this function on the tilelist
1147  // passed in to cookMyTile().
1148  void releaseWorkingTiles(TIL_TileList *list);
1149 
1150  // Passes tiles from the input to the output.
1151  virtual void passThroughTiles(COP2_Context &context,
1152  const TIL_Plane *plane,
1153  int array_index,
1154  float t,
1155  int xstart, int ystart,
1156  TIL_TileList *&tile,
1157  int block = 1,
1158  bool *mask = 0,
1159  bool *blocked = 0);
1160 
1161  // return 1 if you want to pass a specific tile through; allows you to
1162  // scope regions of the data.
1163  virtual int passThrough(COP2_Context &context,
1164  const TIL_Plane *plane, int comp_index,
1165  int array_index, float t,
1166  int xstart, int ystart);
1167 
1168  TIL_TileList *getBlackTile(const TIL_Plane *plane, int aindex,
1169  float t, int xres, int yres, int thread,
1170  int xstart, int ystart, bool *mask =0);
1171 
1172  // Called to cook a single tile. Called for each tile in the image.
1173  virtual OP_ERROR cookMyTile(COP2_Context &context,
1174  TIL_TileList *tiles);
1175 
1176 
1177  OP_ERROR cookFullImage(COP2_Context &context,
1178  TIL_TileList *tiles,
1179  COP2_FullImageCB callback,
1180  UT_Lock &fullimagelock,
1181  bool use_float);
1182 
1183  inline void lockParms(bool lock);
1184 
1185  // Returns a new context. Overide to return your context derived from
1186  // COP2_ContextData and initialize it. This should only ever be called from
1187  // getContextData().
1188  virtual COP2_ContextData *newContextData(const TIL_Plane *plane,
1189  int array_index,
1190  float t,
1191  int xres,
1192  int yres,
1193  int thread,
1194  int max_threads);
1195 
1196  // retrieves only the context, without creating a context data.
1197  COP2_Context *getContext(const TIL_Plane *plane,
1198  int array_index,
1199  float t,
1200  int xres,
1201  int yres,
1202  int thread);
1203 
1204  // Copies the bounds of the input specified into the context. The pointers
1205  // are optional; they are assigned to the new bounds if non-null.
1206  bool copyInputBounds(int input, COP2_Context &context,
1207  int *x1 = 0, int *y1 = 0,
1208  int *x2 = 0, int *y2 = 0);
1209 
1210  // Override if your operation expands the op bounds. This method should set
1211  // the bounds in the context using setBounds()
1212  virtual void computeImageBounds(COP2_Context &context);
1213 
1214  // Scoping
1215  virtual bool isFrameScoped(int /*image_index*/) { return true; }
1216  // Override to return a scope string if the COP has a scope field. If there
1217  // is a valid scope, return 1, otherwise 0.
1218  virtual int scope(UT_String & /*scope*/) { return 0; }
1219  virtual int frameScope(UT_String & /*scope*/) { return 0; }
1220 
1221  OP_ERROR save(std::ostream &os, const OP_SaveFlags &flags,
1222  const char *pathPrefix,
1223  const UT_String &name_override = UT_String()
1224  ) override;
1225  OP_ERROR saveIntrinsic(std::ostream &os,
1226  const OP_SaveFlags &flags) override;
1227  bool load(UT_IStream &is, const char *extension,
1228  const char *path=0) override;
1229 
1230  // This function will convert a tile at index in the tilelist
1231  // to floating point or return the image data pointer if the tile
1232  // is already FP. This function returns true if it allocated memory that
1233  // you need to free (with delete [])
1234  bool getTileInFP(TIL_TileList *tilelist, float *&dest,
1235  int index, void *dtile =0);
1236 
1237  // This function will write a block of floating point data back to the
1238  // tile at index in the tilelist, converting it if necessary. It's
1239  // assumed that the FP source data is the proper size (tilelist->mySize).
1240  void writeFPtoTile(TIL_TileList *tilelist, float *&src,
1241  int index);
1242 
1243  UT_Interrupt *getInterrupt();
1244 
1245  void setCOPColoring(COP2_OpColorType type, bool enable);
1246 
1247  void getOvercookStats(int &redone, int &total);
1248  void clearOvercookStats();
1249 
1250  void ensureSequenceContainsColorAndAlpha();
1251 
1252  // This method is overridden by COP2_SubNet because its "input" is
1253  // special.
1254  virtual void cleanUpInputsRecursively();
1255 
1256 
1257  // This method returns the cook area info for a given context. Can
1258  // only be called during cookMyTile().
1259  const COP2_CookAreaInfo *getAreaInfo(COP2_Context &context) const;
1260 
1261  // This method makes the output area of the plane depend on all parts of
1262  // all input planes, regardless of the size of the output area.
1263  void makeOutputAreaDependOnAllInputAreas(
1264  COP2_CookAreaInfo &output_area,
1265  const COP2_CookAreaList &input_areas,
1266  COP2_CookAreaList &needed_areas);
1267 
1268  // This method makes the output area depended on all planes for a given
1269  // input.
1270  void makeOutputAreaDependOnInputAreas(int input,
1271  COP2_CookAreaInfo &output_area,
1272  const COP2_CookAreaList &input_areas,
1273  COP2_CookAreaList &needed_areas);
1274 
1275  // Selects a plane from the input to be dependent on. Returns the plane
1276  // added to the needed_areas list.
1277  COP2_CookAreaInfo *makeOutputAreaDependOnInputPlane(int input,
1278  const char *planename, int array_index, float t,
1279  const COP2_CookAreaList &input_areas,
1280  COP2_CookAreaList &needed_areas);
1281 
1282  // selects the corresponding plane from an input to be dependent on.
1283  // Returns the plane added to the needed_areas list.
1284  COP2_CookAreaInfo *makeOutputAreaDependOnMyPlane(int input,
1285  COP2_CookAreaInfo &output_area,
1286  const COP2_CookAreaList &input_areas,
1287  COP2_CookAreaList &needed_areas);
1288 
1289  // This method will try to collapse the transforms in the input areas,
1290  // setting the real input node in the needed areas. It will delete
1291  // the contents of uncollapsed_input_areas.
1292  void getInputAreasForCollapsedTransformInputs(
1293  COP2_Context &context,
1294  const COP2_TransformParms &transform_parms,
1295  COP2_CookAreaInfo &output_area,
1296  COP2_CookAreaList &uncollapsed_input_areas,
1297  COP2_CookAreaList &needed_areas,
1298  bool input_aspect_adjust,
1299  bool clear_uncollapse_list);
1300 
1301  // Override this method if the derived COP does not support partially
1302  // scoped planes and uses the default scope mechanism inside
1303  // COP2_PixelBase.
1304  virtual bool allowPartiallyScopedPlanes() const {return true;}
1305 
1306 
1307  void registerVolatileParm(const char *name,PRM_Callback c,
1308  bool ignore_missing = false);
1309 
1310  // the following set methods will follow channel references, if any
1311  // are present on the parm.
1312  void deAnimateFollowChanRef(const char *parmname,
1313  int vecidx );
1314 
1315  void getDependencyInfo(fpreal t, UT_WorkBuffer &text);
1316  void getDependencyInfoTree(fpreal t, UT_InfoTree &tree);
1317 
1318  void swapParm(const char *name1,const char *name2,
1319  int vsize);
1320  void swapStringParm(const char *name1,const char *name2,
1321  int vsize);
1322 public:
1323  // these are the 'manager' methods for setting up, cooking tiles and
1324  // cleaning up. The functions 'setupCook' and 'cookMyTile' are the ones
1325  // that should be overridden for normal operations. These methods do things
1326  // like lock inputs, make sure the cook is setup, etc.
1327  virtual OP_ERROR setup(float t, int xres, int yres, int max_threads,
1328  bool doinput = true);
1329  OP_ERROR cookTile(TIL_TileList *&, float t,
1330  int xres, int yres, int thread_index,
1331  int max_threads);
1332 
1333  // Clean up this node and its inputs. Cleaning up involves cleaning up
1334  // cook contexts and updating the performance monitor.
1335  void recursivelyCleanUp();
1336  void cleanUpCookContexts();
1337 
1338  // Clean up all the regions. This method is not called as part of the
1339  // normal cleanup.
1340  void cleanUpAllRegions();
1341 
1342  void bumpCookSerial() { myCookSerial++; }
1343  int getCookSerial() { return myCookSerial; }
1344 protected:
1347  unsigned char myCop2RecurseFlag :1,
1348  myFramesAllScopedFlag:1;
1352 
1353 private:
1354  UT_ValArray<COP2_Context *> myCookContexts;
1355  UT_ValArray<TIL_Region *> myNonSharedRegions;
1356 
1357  int myInitCook;
1358  int64 myTotalCookTime[TIL_MAX_THREADS];
1359  int64 myInputTileCookTime[TIL_MAX_THREADS];
1360  int64 myTotalTileCookTime[TIL_MAX_THREADS];
1361  unsigned char myCookStateFlags[TIL_MAX_THREADS];
1362  UT_IntArray myInputOpenKeys;
1363  int myCookDepth;
1364  int myCacheHits;
1365  int myCacheMisses;
1366  UT_ValArray<cop2LockInfo *> myLockedPlanes;
1367  int myPreviewPlaneIndex;
1368  int myPreviewPlaneArrayIndex;
1369  OP_ERROR myCookError;
1370  OP_ERROR myLastCop2CookError;
1371  OP_VERSION myCookSequenceVersion;
1372  float myLastErrorTime;
1373  bool myProxyEnable;
1374  bool myCop2DirtyFlag;
1375 
1376  // The following serial counter is included in the image identifier
1377  // string for this node. Forcing a recook will increment this counter,
1378  // thus preventing use of any cached tiles or images.
1379  int myCookSerial;
1380 
1381  // locks
1382  static TIL_FastLock theParmEvalLock;
1383  static TIL_FastLock theParmHashCodeLock;
1384  TIL_FastLock mySingleThreadedLock;
1385  TIL_FastLock mySetupFuncLock;
1386  TIL_FastLock myCookVarLock;
1387  TIL_FastLock myRegionLock;
1388  TIL_FastLock myErrorLock;
1389  TIL_FastLock myIntrLock;
1390  TIL_FastLock myInputBlockLock;
1391  TIL_FastLock myContextDataLock;
1392 
1393  // Viewer image source
1394  TIL_ImageSource *myImageSource;
1395 
1396  // Local variables
1397  int myVarResX[TIL_MAX_THREADS];
1398  int myVarResY[TIL_MAX_THREADS];
1399  int myVarImageIndex[TIL_MAX_THREADS];
1400  float myVarImageTime[TIL_MAX_THREADS];
1401  int myVarImageArray[TIL_MAX_THREADS];
1402  int myVarPlaneIndex[TIL_MAX_THREADS];
1403  int myVarPlaneChannels[TIL_MAX_THREADS];
1404 
1405  unsigned char myVarResUsed :1,
1406  myVarImageArrayUsed :1,
1407  myVarImagePlaneUsed :1,
1408  myVarUseFullRes :1,
1409  myCookOccurred :1;
1410  // Overcooking detection
1411  int myNumCookedTiles;
1412  int myDupCookedTiles;
1413 
1414  UT_Array<COP2_CheckpointWrapper *> myCheckpointWrapper;
1415 
1416  COP2_VolatileParmManager *myVolatileParms;
1417 
1418  // stuff for caching the image bounds.
1419  COP2_BoundsCache myBoundsCache;
1420  TIL_FastLock myBoundsLock;
1421 
1422  // This variable keeps track of the thread that opened the node.
1423  // If the node is not open, then it is set to UT_INVALID_THREAD_ID.
1424  ut_thread_id_t myOpenThreadId;
1425 
1426  // This variable locks the sections in the open() and close()
1427  // functions.
1428  UT_Lock myOpenLock;
1429 
1430  static bool theShowPreviewPref;
1431 
1432 private:
1433  // Sets node's opener thread id. Pass in UT_INVALID_THREAD_ID
1434  // to signal that the node is closed.
1435  void setOpenerThread(ut_thread_id_t thread_id)
1436  { myOpenThreadId = thread_id; }
1437 
1438  // Returns true if the current thread is the same thread that
1439  // opened the node. Returns false if the threads do not match or
1440  // if the node is closed.
1441  bool isOpenerThread() const
1442  { return myOpenThreadId
1443  == UT_Thread::getMyThreadId(); }
1444 
1445  virtual float copTimeTransform(int input, COP2_Context &context,
1446  float t);
1447 
1448  void setupVariables(const TIL_Plane *plane,
1449  int array,
1450  int xres,
1451  int yres,
1452  float t,
1453  int thread);
1454 
1455  // checks for parameter time dependency, and out-of-range keyframes.
1456  void checkTimeDepAndRange();
1457 
1458  // mostly used for debugging & correcting cache problems.
1459  void verifyCacheIntegrity() { }
1460 
1461  // Methods to fetch tiles from the cache or from an input.
1462  int getWorkingTiles(COP2_Context &context,
1463  const TIL_Plane *plane,
1464  int array_index,
1465  float t,
1466  int xstart,int ystart,
1467  TIL_TileList *tilelist,
1468  int ignore_bypass = 0,
1469  int block = 1,
1470  bool *mask = 0,
1471  double *passtime = 0);
1472 
1473  bool fillInteractiveTile(COP2_Context &context,
1474  const TIL_Plane *plane,
1475  int array_index, float t,
1476  int xstart,int ystart,
1477  TIL_Tile *tile, int cindex,
1478  int findex);
1479 
1480  // used only by inputTile, to resolve tile size/offset problems introduced
1481  // by the workspace & scoping channels.
1482  TIL_TileList * correctInputTile(int input_index,
1483  COP2_Context &context,
1484  const TIL_Plane *plane,
1485  int array_index,
1486  int xstart, int ystart,
1487  TIL_TileList *tilelist,
1488  int block, bool *blocked, bool *mask);
1489 
1490  void doneCookOnTiles(TIL_TileList *tiles, OP_ERROR errstate,
1491  int thread_index);
1492 
1493  // This function is used by processTile to send data to a tile devide.
1494  // This is nontrivial because the tile may extend outside the bounds
1495  // of the region of interest for the tile device.
1496  bool writeSafeDeepTile(COP2_ThreadCookParms *p,
1497  TIL_TileList *tilelist) const;
1498 
1499  // performance related functions
1500  void markTimerStart(int64 *now) const;
1501  void getElapsedTime(int64 *now) const;
1502  void appendCookTimesToPerformanceMonitor();
1503  void setCookDepth(int d);
1504 
1505  // Allocates or returns a pointer to a previously allocated region.
1506  TIL_Region * allocateRegion(const TIL_Plane *plane, int input_index,
1507  int array_index, float t,
1508  int xres, int yres,
1509  int x1, int y1, int x2, int y2,
1510  int bx1, int by1, int bx2, int by2,
1511  TIL_RegionExtend hold,
1512  int output, int share,
1513  int scan_alignment);
1514 
1515  // Preps a region for use; only called by allocateRegion & inputRegion.
1516  void openRegion(TIL_Region *region, void *regionmem[4],
1517  bool output);
1518 
1519  // called by the multiprocessor cooks as the 'thread method'.
1520  static void * threadCookTile(void *data);
1521 
1522  // These methods do the actual work of manipulating the rasters.
1523 
1524  // insert into full raster, possibly with a colour subrange.
1525  void insertIntoRaster(TIL_Raster *r, TIL_Tile *t,int tindex,
1526  float low=0.0F,float high=1.0F) const;
1527 
1528  // insert into subregion of a raster, possibly with a colour subrange.
1529  // (x1,y1) -> (x2,y2) defines the rectangular region to be updated.
1530  // (x,y)shift defines how the tile origins are translated to fit into the
1531  // region.
1532  void insertIntoRaster(TIL_Raster *r, TIL_Tile *t,int tindex,
1533  int x1, int y1, int x2, int y2,
1534  int xshift=0, int yshift=0,
1535  float low=0.0F,float high=1.0F,
1536  int greyscale = 0,
1537  int ignore_points =0,
1538  float gamma = 1.0F) const;
1539 
1540  void highlightTile(int thread, int onoff);
1541  void resetHighlight();
1542 
1543  // These methods compute a number of bounds related variables.
1544  void computeBoundsVariables(const OP_Context &context,
1545  const TIL_Plane *rplane,
1546  int array_index, TIL_Raster *raster,
1547  int thread_index,
1548  int orig_xstart, int orig_ystart,
1549  int orig_xend, int orig_yend,
1550  int &xstart, int &ystart, int &xend, int &yend,
1551  int &xtile1, int &ytile1,
1552  int &xtile2, int &ytile2,
1553  int &x1, int &y1, int &x2, int &y2,
1554  int &xshift, int &yshift,
1555  int &bounds_xstart, int &bounds_ystart,
1556  int &bounds_xend, int &bounds_yend,
1557  bool flipbook);
1558 
1559  void computeBoundsVariables(const TIL_Plane *rplane,
1560  float time, int xres, int yres,
1561  int array_index, TIL_Raster *raster,
1562  int thread_index,
1563  int orig_xstart, int orig_ystart,
1564  int orig_xend, int orig_yend,
1565  int &xstart, int &ystart, int &xend, int &yend,
1566  int &xtile1, int &ytile1, int &xtile2, int &ytile2,
1567  int &x1, int &y1, int &x2, int &y2,
1568  int &xshift, int &yshift,
1569  int &bounds_xstart, int &bounds_ystart,
1570  int &bounds_xend, int &bounds_yend,
1571  bool flipbook);
1572 
1573  // This convenience method returns the token string for the plane and
1574  // the tile indices for the area of interest. The area of interest
1575  // (xstart,ystart)-(xend,yend) is in frame space.
1576  UT_TokenString *getPlaneIdentifierAndTileBoundaries(
1577  COP2_Context &context,
1578  const TIL_Plane &refplane,
1579  int xstart, int ystart, int xend, int yend,
1580  int &xtile1, int &ytile1, int &xtile2, int &ytile2,
1581  bool flipbook);
1582 
1583  TIL_Region * getTransformRegionGPU(
1584  COP2_Node &source_node, int source_input,
1585  COP2_Context &context,
1586  const TIL_Plane *plane, int array_index,
1587  int x1, int y1, int x2, int y2,
1588  int input_origx, int input_origy,
1589  int input_xres, int input_yres,
1590  int filt_xoffset, int filt_yoffset,
1591  const COP2_TransformParms &parms,
1592  bool bounds_in_canvas_space,
1593  int &tx1, int &ty1, int &tx2, int &ty2,
1594  int preoffset[2], int postoffset[2]);
1595 
1596  bool fullTransformRegionCPU(COP2_Context &context,
1597  COP2_Node &source_node,
1598  int source_input,
1599  TIL_Region *region,
1600  const COP2_TransformParms &parms,
1601  int x1, int y1, int x2, int y2,
1602  int input_x1, int input_y1,
1603  int input_x2, int input_y2,
1604  int input_xres, int input_yres,
1605  int full_input_xres, int full_input_yres,
1606  int filt_xoffset, int filt_yoffset,
1607  float haspect, float input_haspect,
1608  float vaspect, float input_vaspect,
1609  bool bounds_in_canvas_space,
1610  const UT_Matrix4 &xform);
1611 
1612  bool fullTransformRegionGPU(COP2_Context &context,
1613  COP2_Node &source_node,
1614  int source_input,
1615  TIL_Region *region,
1616  const COP2_TransformParms &parms,
1617  int x1, int y1, int x2, int y2,
1618  int input_x1, int input_y1,
1619  int node_x1, int node_y1,
1620  int node_x2, int node_y2,
1621  int input_xres, int input_yres,
1622  int full_input_xres, int full_input_yres,
1623  int filt_xoffset, int filt_yoffset,
1624  float haspect, float input_haspect,
1625  float vaspect, float input_vaspect,
1626  bool bounds_in_canvas_space,
1627  const UT_Matrix4 &xform);
1628 
1629  bool transformBlurRegionCPU(int input,
1630  COP2_Context &context,
1631  TIL_Region *region,
1633  bool deformation,
1634  float prev, float next, int numtimes,
1635  float itime[3], float ifact[3],
1636  bool bounds_in_canvas_space,
1637  int filt_xoffset, int filt_yoffset,
1638  int input_origx, int input_origy,
1639  int ixres, int iyres,
1640  int x1, int y1, int x2, int y2,
1641  float startt, float endt, float incr,
1642  float bfact);
1643 
1644  bool transformBlurRegionGPU(int input,
1645  COP2_Context &context,
1646  TIL_Region *region,
1648  int deformation,
1649  float prev, float next, int numtimes,
1650  float itime[3], float ifact[3],
1651  bool bounds_in_canvas_space,
1652  int filt_xoffset, int filt_yoffset,
1653  int input_origx, int input_origy,
1654  int ixres, int iyres,
1655  int x1, int y1, int x2, int y2,
1656  float startt, float endt, float incr,
1657  float bfact);
1658 
1659  // These virtuals are methods that nobody should override...
1660  //
1661  // I/O methods
1662  //
1663  bool loadPacket(UT_IStream &is, short class_id, short sig,
1664  const char *path=0) override;
1665  bool loadPacket(UT_IStream &is, const char *token,
1666  const char *path=0) override;
1667 
1668  void deleteCookedData() override {}
1669  int saveCookedData(const char *, OP_Context &) override;
1670  int saveCookedData(std::ostream &, OP_Context &,
1671  int = 0) override
1672  { return 0; }
1673  const char *getFileExtension(int binary) const override
1674  { return binary ? "bcop2" : "cop2"; }
1675 
1676  static void installExpressions();
1677 
1678  friend class COP2_CookScheduler;
1679  friend class COP2_VexVariableMap;
1680  friend class COP2_PixelOp;
1681  friend class COP2_VexOp;
1682  friend class COP2_MaskOp;
1683 };
1684 
1685 inline TIL_TileList *
1686 COP2_Node::inputTile(int input_index, COP2_Context &context,
1687  int xstart, int ystart, OP_ERROR *err, int block,
1688  bool *mask, bool *blocked, bool *was_corrected)
1689 {
1690  return inputTile(input_index, context,
1691  context.myPlane, context.myArrayIndex,
1692  context.myTime, xstart, ystart, err, block, mask, 0,
1693  true, blocked, was_corrected);
1694 }
1695 
1696 
1697 inline TIL_TileList *
1698 COP2_Node::inputTile(int input_index, COP2_Context &context,
1699  TIL_TileList *tiles, OP_ERROR *err, int block,
1700  bool *mask, bool *blocked, bool *was_corrected)
1701 {
1702  return inputTile(input_index, context,
1703  context.myPlane, context.myArrayIndex,
1704  context.myTime,
1705  tiles->myX1,
1706  tiles->myY1,
1707  err, block, mask, 0, true, blocked, was_corrected);
1708 }
1709 
1710 inline TIL_TileList *
1712  TIL_TileList *tilelist, float t,
1713  OP_ERROR *err,int block, bool *mask, bool *blocked,
1714  bool *was_corrected)
1715 {
1716  return inputTile(index, context, tilelist->myPlane, tilelist->myArrayIndex,
1717  t, tilelist->myX1, tilelist->myY1, err, block, mask,
1718  0, true, blocked, was_corrected);
1719 }
1720 
1721 inline TIL_Region *
1722 COP2_Node::inputRegion(int input_index,
1723  COP2_Context &context,
1724  TIL_TileList *tilelist,
1725  int xshift,int yshift, int copy, TIL_RegionExtend hold)
1726 {
1727  return inputRegion(input_index, context,
1728  context.myPlane, context.myArrayIndex,
1729  context.myTime, tilelist, xshift, yshift, copy, hold);
1730 }
1731 
1732 inline TIL_Region *
1733 COP2_Node::inputRegion(int input_index, COP2_Context &context,
1734  int xstart, int ystart, int xend, int yend,
1735  TIL_RegionExtend hold, int share,
1736  void *regionmem[PLANE_MAX_VECTOR_SIZE],
1737  bool correct_aspect, bool correct_bounds,
1738  int scan_alignment)
1739 {
1740  return inputRegion(input_index, context,
1741  context.myPlane, context.myArrayIndex,
1742  context.myTime, xstart, ystart, xend, yend,
1743  hold, share, regionmem, correct_aspect,
1744  correct_bounds, scan_alignment);
1745 }
1746 
1747 inline TIL_Region *
1748 COP2_Node::outputRegion(const TIL_Plane *plane, int array_index, float seqt,
1749  int xres, int yres, int thread,
1750  int xstart, int ystart, int xend, int yend, int share,
1751  int rindex, int alignment)
1752 {
1753  return outputRegion(plane, plane, array_index, seqt, xres, yres, thread,
1754  xstart, ystart, xend, yend, share, rindex,alignment);
1755 }
1756 
1757 inline void
1759 {
1760  if(lock)
1761  TIL_LOCK(theParmEvalLock);
1762  else
1763  TIL_UNLOCK(theParmEvalLock);
1764 }
1765 
1766 inline bool
1768  int &x1, int &y1, int &x2, int &y2)
1769 {
1770  return getInputBounds(input, context.myPlane, context.myArrayIndex,
1771  context.myTime, context.myXres, context.myYres,
1772  context.myThreadIndex, x1,y1, x2,y2);
1773 }
1774 
1775 inline void
1777  int &x1,int &y1, int &x2,int &y2)
1778 {
1779  getImageBounds(context.myPlane, context.myArrayIndex, context.myTime,
1780  context.myXres, context.myYres, context.myThreadIndex,
1781  x1,y1, x2,y2);
1782 }
1783 
1784 // Some common defines.
1785 extern "C" {
1787 };
1788 
1789 #endif
virtual int saveCookedData(std::ostream &os, OP_Context &, int binary=0)=0
SYS_VISIBILITY_EXPORT void newCop2Operator(OP_OperatorTable *table)
UT_ErrorSeverity OP_ERROR
Definition: OP_Error.h:6
#define COP2_OPTYPE_NAME
Definition: OP_Node.h:294
GLbitfield flags
Definition: glcorearb.h:1596
fpreal getH() const override
Node position/scale is used by the UI.
#define TIL_UNLOCK(loc)
Definition: TIL_Defines.h:265
virtual bool isSlowOperation() const
Definition: COP2_Node.h:378
fpreal getW() const override
Node position/scale is used by the UI.
virtual OP_ERROR error()
uint64 OP_VERSION
Definition: OP_Version.h:6
#define COP2_MULTITHREADED
Definition: COP2_Common.h:214
virtual int getNetOverviewColor(UT_Color &color)
unsigned referenceAllParameters(OP_Parameters *from, bool relative_references=true) override
TIL_ImageSource * getImageSource()
Definition: COP2_Node.h:93
TIL_Sequence mySequence
Definition: COP2_Node.h:1345
#define SYS_VISIBILITY_EXPORT
virtual bool isPixelBased() const
Definition: COP2_Node.h:387
GT_API const UT_StringHolder time
OP_ERROR error() override
Definition: COP2_Node.h:483
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
virtual int isScaledImageDifferent() const
Definition: COP2_Node.h:788
const GLdouble * v
Definition: glcorearb.h:837
OP_OpTypeId getChildTypeID() const override
Definition: COP2_Node.h:635
void bumpCookSerial()
Definition: COP2_Node.h:1342
virtual bool doesFrameExist(int, bool=true)
Definition: COP2_Node.h:422
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
#define TIL_LOCK(loc)
Definition: TIL_Defines.h:264
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
void lockParms(bool lock)
Definition: COP2_Node.h:1758
int myInterruptFlags
Definition: COP2_Node.h:1349
virtual bool preferredViewPlane(UT_WorkBuffer &)
Definition: COP2_Node.h:619
TIL_RegionExtend
Definition: TIL_Region.h:24
virtual void forceRecook(bool evensmartcache=true)
int myCop2OpenCount
Definition: COP2_Node.h:1346
COP2_ThreadPref getThreadPref() const
Definition: COP2_Node.h:542
UT_ErrorSeverity
Definition: UT_Error.h:25
OP_ERROR getErrorSeverity() override
Definition: COP2_Node.h:480
Parameters for OP_Node::getInfoText()/OP_Node::getNodeSpecificInfoText()
TIL_Region * outputRegion(const TIL_Plane *plane, int array_index, float t, int xres, int yres, int thread, int xstart, int ystart, int xend, int yend, int share=1, int rindex=0, int alignment=0)
Definition: COP2_Node.h:1748
GLint y
Definition: glcorearb.h:103
const char * getOpType() const override
Definition: COP2_Node.h:632
void close() override
int64 getMemoryUsage(bool inclusive) const override
Definition: COP2_Node.h:640
UT_ErrorManager myCookErrorManager
Definition: COP2_Node.h:784
virtual void getNodeSpecificInfoText(OP_Context &context, OP_NodeInfoParms &parms)
OP_ERROR bypassMe(OP_Context &, int &) override
Definition: COP2_Node.h:744
UT_FilterType
Definition: UT_FilterType.h:16
static OP_VariablePair myVariablePair
Definition: COP2_Node.h:663
static const char * theChildTableName
Definition: COP2_Node.h:629
virtual int getNumInputsToOpen() const
Definition: COP2_Node.h:687
GLdouble GLdouble x2
Definition: glad.h:2349
const TIL_Plane * myPlane
Definition: TIL_TileList.h:61
COP2_ThreadPref
Definition: COP2_Common.h:249
bool evalVariableValue(UT_String &v, int i, int thr) override
Definition: COP2_Node.h:757
< returns > If no error
Definition: snippets.dox:2
virtual unsigned nInputs() const
virtual bool isTimeDepOperation()
Definition: COP2_Node.h:379
virtual bool allowPartiallyScopedPlanes() const
Definition: COP2_Node.h:1304
short myArrayIndex
Definition: TIL_TileList.h:64
OP_ERROR cookMe(OP_Context &) override
Definition: COP2_Node.h:742
OP_ERROR(* COP2_FullImageCB)(COP2_Context &, const TIL_Region *, TIL_Region *, COP2_Node *)
Definition: COP2_Node.h:70
GLfloat f
Definition: glcorearb.h:1926
virtual bool isGenerator() const
Definition: COP2_Node.h:386
virtual int scope(UT_String &)
Definition: COP2_Node.h:1218
GLboolean reset
Definition: glad.h:5138
int open(float queuesize) override
virtual COP2_ThreadPref getThreadPreference() const
Definition: COP2_Node.h:794
void opChanged(OP_EventType reason, void *data=0) override
int64 getMemoryUsage(bool inclusive) const override
virtual OP_ERROR saveIntrinsic(std::ostream &os, const OP_SaveFlags &flags)
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLdouble y1
Definition: glad.h:2349
virtual void getMaxNumThreadsInCook(COP2_Context &, int &plane, int &node, int &op) const
Definition: COP2_Node.h:551
OP_Node * getInput(unsigned idx, bool mark_used=false) const
Returns the node connected to a particular input (may be null).
GLint GLuint mask
Definition: glcorearb.h:124
OP_OpTypeId getOpTypeID() const override
Definition: COP2_Node.h:637
#define PLANE_MAX_VECTOR_SIZE
Definition: TIL_Defines.h:167
virtual bool cook(OP_Context &context)
virtual void userDataChanged(const UT_StringHolder &key)
HUSD_API const char * raster()
long long int64
Definition: SYS_Types.h:116
OP_OpTypeId
Definition: OP_OpTypeId.h:18
bool isOpen() const
Definition: COP2_Node.h:80
GLuint const GLchar * name
Definition: glcorearb.h:786
GLint GLenum GLint x
Definition: glcorearb.h:409
virtual bool isTimeModifier() const
Definition: COP2_Node.h:374
int getCookSerial()
Definition: COP2_Node.h:1343
bool getInputBounds(int input, COP2_Context &context, int &x1, int &y1, int &x2, int &y2)
Definition: COP2_Node.h:1767
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
int myInputBlockFlags
Definition: COP2_Node.h:1350
GLdouble t
Definition: glad.h:2397
TIL_ViewerType
Definition: TIL_Defines.h:139
IFDmantra py
Definition: HDK_Image.dox:266
virtual void getInputRes(int input, fpreal t, const OP_Context &context, OP_Context &input_context)
GLsizeiptr size
Definition: glcorearb.h:664
**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
OP_ERROR error(OP_Context &context) override
Definition: COP2_Node.h:492
virtual const char * getFileExtension(int binary) const =0
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)
virtual bool onlyCookInMainThread() const
Definition: COP2_Node.h:558
Parameters for OP_Node::fillInfoTree()/OP_Node::fillInfoTreeNodeSpecific()
virtual void fillInfoTreeNodeSpecific(UT_InfoTree &tree, const OP_NodeInfoTreeParms &parms)
#define COP2_API
Definition: COP2_API.h:10
Base Integer Rectangle class.
virtual int isSingleThreadedCop() const
Definition: COP2_Node.h:414
GLuint color
Definition: glcorearb.h:1261
OP_DataType getCookedDataType() const override
Definition: COP2_Node.h:648
fpreal64 fpreal
Definition: SYS_Types.h:277
OP_ERROR getErrorSeverity() override
virtual fpreal getTimeTransform(int input, fpreal t)
GLuint index
Definition: glcorearb.h:786
GLuint GLfloat * val
Definition: glcorearb.h:1608
static ut_thread_id_t getMyThreadId()
virtual bool loadPacket(UT_IStream &is, short class_id, short sig, const char *path=0)
OP_EventType
Definition: OP_Value.h:22
A global error manager scope.
OP_DataType
Definition: OP_DataTypes.h:28
virtual void getMyExternalReferences(UT_StringArray &reflist, UT_StringArray *nodelist=0, bool collapse=false, bool check_missing=false, bool show_missing_only=false)
static OP_TemplatePair myTemplatePair
Definition: COP2_Node.h:662
virtual bool evalVariableValue(UT_String &val, int index, int thread)
#define TIL_MAX_THREADS
Definition: TIL_Defines.h:38
Definition: core.h:982
virtual bool isFrameScoped(int)
Definition: COP2_Node.h:1215
virtual bool isGPUAssisted(const TIL_Plane &, int, float, int, int, int)
Definition: COP2_Node.h:380
void getImageBounds(const TIL_Plane *plane, int array, float t, int xres, int yres, int thread, int &x1, int &y1, int &x2, int &y2)
bool load(UT_IStream &is, const char *ext="", const char *path=0) override
virtual int frameScope(UT_String &)
Definition: COP2_Node.h:1219
const TIL_Plane * myPlane
Definition: COP2_Context.h:74
virtual OP_ERROR save(std::ostream &os, const OP_SaveFlags &flags, const char *path_prefix="", const UT_String &name_override=UT_String())
virtual COP2_Node * getInputToOpen(int i)
Definition: COP2_Node.h:688
GLboolean r
Definition: glcorearb.h:1222
void * getCookedData(OP_Context &) override
Definition: COP2_Node.h:650
GLdouble GLdouble GLdouble y2
Definition: glad.h:2349
COP2_ThreadPref myThreadPreference
Definition: COP2_Node.h:1351
type
Definition: core.h:1059
**Note that the tasks the thread_id
Definition: thread.h:637
virtual void inputOpenFailed(int)
Definition: COP2_Node.h:791
virtual int getMaskInput() const
Definition: COP2_Node.h:389
virtual UT_TokenString & getParmHashCode(OP_Context &context, int group_mask=1)
OIIO_UTIL_API std::string extension(string_view filepath, bool include_dot=true) noexcept
TIL_TileList * inputTile(int input_index, COP2_Context &context, const TIL_Plane *plane, int array_index, float t, int xstart, int ystart, OP_ERROR *err=0, int block=1, bool *mask=0, COP2_Node *fromtile=0, bool correctorig=true, bool *blocked=0, bool *was_corrected=0)
COP2_ColorComponent
Definition: COP2_Common.h:256
const char * getChildType() const override
Definition: COP2_Node.h:630
Definition: format.h:895
bool isCooking(bool include_ancestors) const
virtual void deleteCookedData()=0
COP2_OpColorType
Definition: COP2_Common.h:242
GLenum src
Definition: glcorearb.h:1793
bool isDiskCacheEnabled() const
Definition: COP2_Node.h:448