00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __COP2_Node_h__
00022 #define __COP2_Node_h__
00023
00024 #include "COP2_API.h"
00025 #include <UT/UT_ErrorManager.h>
00026 #include <UT/UT_SymbolTable.h>
00027 #include <UT/UT_FloatArray.h>
00028 #include <UT/UT_IntArray.h>
00029 #include <UT/UT_PtrArray.h>
00030 #include <UT/UT_RefArray.h>
00031 #include <UT/UT_Lock.h>
00032 #include <UT/UT_Rect.h>
00033 #include <UT/UT_TokenString.h>
00034 #include <UT/UT_Thread.h>
00035 #include <UT/UT_FilterType.h>
00036
00037 #include <OP/OP_Network.h>
00038
00039 #include <TIL/TIL_Defines.h>
00040 #include <TIL/TIL_Sequence.h>
00041 #include <TIL/TIL_Region.h>
00042 #include <TIL/TIL_TileList.h>
00043
00044 #include "COP2_Common.h"
00045 #include "COP2_Context.h"
00046 #include "COP2_BoundsCache.h"
00047
00048 class UT_Color;
00049 class UT_FileLUT;
00050 class UT_Matrix4;
00051 class UT_Interrupt;
00052 class UT_StringArray;
00053 class UT_IntArray;
00054 class IMG_TileOptions;
00055 class TIL_Raster;
00056 class TIL_TileCache;
00057 class TIL_Plane;
00058 class TIL_ProxyManager;
00059 class TIL_Region;
00060 class TIL_Tile;
00061 class TIL_TileList;
00062 class TIL_TileManager;
00063 class TIL_TileMPlay;
00064 class OP_OperatorTable;
00065 class OP_TemplatePair;
00066 class OP_VariablePair;
00067 class COP2_ImageSource;
00068 class COP2_PixelFunction;
00069 class COP2_TransformParms;
00070 class COP2_ThreadCookParms;
00071 class COP2_PlaneCookParms;
00072 class COP2_CheckpointWrapper;
00073 class COP2_CookAreaInfo;
00074 class COP2_CookAreaList;
00075 class COP2_VolatileParmManager;
00076 class COP2_DebugTimingTable;
00077
00078 typedef OP_ERROR (*COP2_FullImageCB)(COP2_Context &, const TIL_Region *,
00079 TIL_Region *, COP2_Node *);
00080
00081
00082 class COP2_API COP2_Node : public OP_Network
00083 {
00084 public:
00085
00086
00087 virtual OP_ERROR open(short &key, int clear_errors = 0);
00088 bool isOpen() const { return myCopOpenCount > 0; }
00089 virtual void close(short key);
00090
00091
00092 TIL_Sequence * getSequenceInfo(OP_ERROR *error = 0);
00093
00094
00095 const TIL_Sequence *inputInfo(int input);
00096
00097
00098 float getSequenceTime() const;
00099
00100
00101 COP2_ImageSource *getImageSource() { return myImageSource; }
00102
00103 virtual void forceRecook(bool evensmartcache = false);
00104
00105
00106
00107 static void setNodeTimingTable(COP2_DebugTimingTable *table);
00108
00109
00110
00111
00112
00113
00114 int cookToRaster(TIL_Raster *raster, OP_Context &,
00115 const TIL_Plane *plane,
00116 int array_index = 0,
00117 int subregion = 1, int clear = 1,
00118 float black = 0.0F, float white = 1.0F,
00119 int compindex = -1,
00120 int ignore_bwpoints=0,
00121 const int *comp_map=0,
00122 float gamma = 1.0F,
00123 bool interactive = false);
00124
00125 int cookToRaster(TIL_Raster *raster, OP_Context &,
00126 const TIL_Plane *plane,
00127 int array_index,
00128 int xstart,int ystart,int xend,int yend,
00129 int subregion = 1, int clear = 1,
00130 float black = 0.0F, float white = 1.0F,
00131 int compindex = -1,
00132 int ignore_bwpoints=0,
00133 const int *comp_map=0,
00134 float gamma = 1.0F,
00135 bool interactive = false,
00136 UT_PtrArray<TIL_Raster *> *tiles = 0,
00137 int tile_index = 0, TIL_TileMPlay * =0,
00138 bool cleanup_after = true);
00139
00140
00141
00142
00143
00144
00145 int cookToRaster(UT_PtrArray<TIL_Raster *> &rasters,
00146 UT_PtrArray<OP_Context *> &contexts,
00147 UT_PtrArray<const TIL_Plane *> &planes,
00148 UT_IntArray &array_index,
00149 UT_PtrArray<const int *> &comp_map,
00150 UT_RefArray<UT_InclusiveRect> &bounds,
00151 int subregion = 1, int clear = 1,
00152 float black = 0.0F, float white = 1.0F,
00153 int compindex = -1,
00154 int ignore_bwpoints=0,
00155 float gamma = 1.0F,
00156 bool interactive = false,
00157 UT_PtrArray<TIL_Raster *> *tiles = 0,
00158 int tile_index = 0, TIL_TileMPlay * =0,
00159 bool cleanup_after = true);
00160
00161
00162
00163
00164 void computePlaneCookParms(COP2_PlaneCookParms &plane_parms,
00165 OP_Context &context,
00166 const TIL_Plane *rplane,
00167 int array_index,
00168 TIL_Raster *raster,
00169 int thread_index,
00170 const int *compmap,
00171 int xstart, int ystart,
00172 int xend, int yend,
00173 bool flipbook,
00174 UT_PtrArray<TIL_Tile *> *tile_list);
00175
00176
00177 bool isPlaneCached(const TIL_Plane &refplane,
00178 int array_index, float time,
00179 int xres, int yres,
00180 int xstart, int ystart, int xend, int yend,
00181 bool flipbook);
00182 bool isPlaneCached(COP2_Context &context,
00183 const TIL_Plane &refplane,
00184 int xstart, int ystart, int xend, int yend,
00185 bool flipbook);
00186
00187
00188
00189
00190 void checkpointCachedTilesForPlane(
00191 const TIL_Plane &refplane,
00192 int array_index, float time,
00193 int xres, int yres,
00194 int xstart, int ystart, int xend, int yend,
00195 bool flipbook,
00196 UT_PtrArray<TIL_Tile *> &tile_list);
00197 void checkpointCachedTilesForPlane(COP2_Context &context,
00198 const TIL_Plane &refplane,
00199 int xstart, int ystart, int xend, int yend,
00200 bool flipbook,
00201 UT_PtrArray<TIL_Tile *> &tile_list);
00202
00203
00204
00205
00206 float mapTimeIntoSequence(float time);
00207
00208
00209
00210
00211 int cookToFile(const UT_StringArray &filenames,
00212 const IMG_TileOptions *,
00213 const TIL_Sequence *scope,
00214 const UT_IntArray &image_index,
00215 const char *uselut = 0,
00216 float gamma = 1.0F,
00217 UT_InclusiveRect *bounds = 0,
00218 bool single_frame = false,
00219 bool thread_io = false);
00220
00221 int cookToFile(const UT_StringArray &filenames,
00222 const IMG_TileOptions *,
00223 OP_Context &context,
00224 const UT_IntArray &image_index,
00225 const char *cplane, const char *aplane = 0,
00226 const char *uselut = 0,
00227 float gamma = 1.0F,
00228 UT_InclusiveRect *bounds = 0,
00229 bool single_frame = false,
00230 bool thread_io = false);
00231
00232 void waitForLastFile();
00233
00234
00235
00236 int cookFlipbook(const TIL_Sequence &info, int step = 1,
00237 float gamma = 1.0f,
00238 const char *lut = 0, bool startnew=true,
00239 bool (*updateCallback)(void *) = 0,
00240 void *updateEntity = 0,
00241 bool write_houdini_frame = true);
00242
00243
00244
00245
00246 virtual UT_TokenString *getImageIdentifier(const TIL_Plane *plane,
00247 int array_index, float t,
00248 int xres, int yres,
00249 int thread);
00250
00251
00252
00253
00254 COP2_Context *getContextData(const TIL_Plane *plane,
00255 int array_index,
00256 float t,
00257 int xres,
00258 int yres,
00259 int thread,
00260 bool force_bounds = true);
00261
00262
00263 void getImageBounds(const TIL_Plane *plane, int array,
00264 float t, int xres, int yres, int thread,
00265 int &x1, int &y1,int &x2, int &y2);
00266 inline void getImageBounds(COP2_Context &context,
00267 int &x1, int &y1,int &x2, int &y2);
00268
00269
00270
00271 inline bool getInputBounds(int input, COP2_Context &context,
00272 int &x1, int &y1, int &x2, int &y2);
00273
00274
00275 bool getInputBounds(int input,
00276 const TIL_Plane *plane, int array,
00277 float t, int xres, int yres,
00278 int thread,
00279 int &x1, int &y1, int &x2, int &y2);
00280
00281
00282
00283
00284
00285
00286 bool isTileAlignedWithInput(int input,
00287 COP2_Context &context,
00288 int tilex, int tiley,
00289 COP2_Node *with_node = 0);
00290 bool isTileAlignedWithInput(int input,
00291 const TIL_Plane *plane,
00292 int array_index,
00293 float t, int xres, int yres,
00294 int thread,
00295 int tilex, int tiley,
00296 COP2_Node *with_node=0);
00297
00298
00299
00300 bool isTileAlignedWithInputAtTime(int input,
00301 COP2_Context &context,
00302 int tilex, int tiley,
00303 float input_time,
00304 COP2_Node *with_node=0);
00305
00306
00307
00308
00309
00310 bool isInputTileAlignedWithContext(int input,
00311 const TIL_Plane *plane,
00312 int tilex, int tiley,
00313 COP2_Context &context,
00314 COP2_Node *with_node=0);
00315
00316 bool arePlanesAligned(COP2_Context &context,
00317 const TIL_Plane *plane1, int aindex1,
00318 const TIL_Plane *plane2, int aindex2,
00319 int tilex, int tiley);
00320
00321
00322 bool isInputPlaneCompatible(COP2_Context &context,
00323 int input_num);
00324
00325
00326 bool getInputBoundsDiff(int input, COP2_Context &context,
00327 int &dx, int &dy);
00328
00329
00330
00331 virtual float getTimeTransform(int input, float t);
00332
00333
00334 virtual void getInputRes(int input, float t,
00335 const OP_Context &context,
00336 OP_Context &icontext);
00337
00338
00339 virtual float remapTime(float t);
00340 virtual bool isTimeModifier() const { return false; }
00341
00342
00343
00344 virtual bool isSlowOperation() const { return true; }
00345 virtual bool isTimeDepOperation() { return false; }
00346 virtual bool isGPUAssisted(const TIL_Plane & ,
00347 int , float ,
00348 int , int ,
00349 int )
00350 { return false; }
00351
00352 virtual bool isGenerator() const { return false; }
00353 virtual bool isPixelBased() const { return false; }
00354
00355 virtual int getMaskInput() const { return -1; }
00356
00357
00358
00359
00360 void getScaleFactors(int xres, int yres,
00361 float &sx, float &sy) const;
00362 float getXScaleFactor(int xres) const;
00363 float getYScaleFactor(int yres) const;
00364
00365
00366
00367 TIL_Plane *getPreviewPlane(int &index);
00368 int getPreviewPlane(int &pindex, int &aindex);
00369 int isFollowingParent(const COP2_Node *parent);
00370 void setPreviewPlane(int pindex, int aindex =0);
00371 void parentPreviewChanged();
00372
00373
00374
00375
00376
00377
00378
00379
00380 virtual int isSingleThreadedCop() const {return COP_MULTITHREADED;}
00381
00382
00383 void clearTilesInCache();
00384
00385
00386
00387
00388 virtual bool doesFrameExist(int ,
00389 bool =true) { return true; }
00390
00391
00392
00393
00394 int isAnythingLocked() const;
00395
00396
00397 int isPlaneLocked(const TIL_Plane *p) const;
00398
00399
00400 int isSequenceLocked(float t);
00401
00402
00403 int isPlaneLocked(const TIL_Plane *p, float t);
00404
00405
00406 int lockPlane(const TIL_Plane *p, float t);
00407 int lockPlanes(float t);
00408 int unlockPlane(const TIL_Plane *p, float t);
00409 int unlockPlanes(float t);
00410 int unlockAll();
00411
00412
00413 void enableDiskCache(bool enable);
00414 bool isDiskCacheEnabled() const { return myProxyEnable; }
00415
00416
00417 virtual void setColorSelection(float *col, int size, bool accum);
00418
00419
00420
00421 static void tileRemovalCallback(void *parent, TIL_Tile *removed);
00422 void tileRemoved(TIL_Tile *removed);
00423
00424 static void setUpdateCallback(void (*callback)(float, bool, bool));
00425 static void setViewerCallback(void (*viewer)(COP2_Node *, void *,
00426 TIL_ViewerType ),
00427 void *data);
00428
00429
00430 static void setCookPosition(float u, float v);
00431 static void abortCook();
00432 static bool isCookAborted();
00433 static void resetAbortFlag();
00434 static bool isCooking();
00435
00436 bool isCookAborted(int thread_index);
00437
00438 bool isInterrupted(int threadidx);
00439 void setInterrupted(int threadidx);
00440
00441 static TIL_TileCache *getCache();
00442 static TIL_ProxyManager *getProxyManager();
00443 static TIL_TileManager *getTileManager();
00444
00445 virtual OP_ERROR getErrorSeverity()
00446 { return error(); }
00447
00448 virtual OP_ERROR error()
00449 {
00450
00451
00452 OP_ERROR sev = OP_Network::getErrorSeverity();
00453 OP_ERROR csev = myCookErrorManager.getSeverity();
00454
00455 return sev > csev ? sev : csev;
00456 }
00457
00458
00459 virtual UT_TokenString & getParmHashCode(OP_Context &context,
00460 int group_mask = 1);
00461
00462
00463
00464 virtual void getPixelFunction(const TIL_Plane *plane,
00465 int array_index, float t,
00466 int xres, int yres,
00467 int thread,
00468 COP2_PixelFunction *&function,
00469 bool concatenate,
00470 bool dependent_too);
00471
00472 virtual void getImageTransform(COP2_Context &context,
00473 COP2_TransformParms &parms,
00474 COP2_Node *& source,
00475 int &input_index);
00476
00477
00478
00479
00480
00481
00482 bool getPixelValue(const TIL_Plane *plane,
00483 int array_index, float t,
00484 int xres, int yres,
00485 int x, int y,
00486 float *color);
00487
00488 bool getPixelValueByUV(const char *plane_name,
00489 double u, double v,
00490 bool interpolate,
00491 UT_FloatArray &vals);
00492
00493 bool getPixelColorValueByUV(COP2_ColorComponent comp,
00494 double u, double v,
00495 bool interpolate,
00496 float &val);
00497
00498 COP2_ThreadPref getThreadPref() const { return myThreadPreference; }
00499
00500
00501
00502
00503
00504
00505
00506
00507 virtual void getMaxNumThreadsInCook(COP2_Context &,
00508 int &plane,
00509 int &node,
00510 int &op) const
00511 { plane = node = op = TIL_MAX_THREADS; }
00512
00513
00514 virtual bool onlyCookInMainThread() const { return false; }
00515
00516
00517
00518 static void setWorkingThreadId(int thread_index);
00519 static void clearWorkingThreadId(int thread_index);
00520
00521
00522
00523 int getThreadIndex();
00524
00525
00526 static void buildPlanePreviewMenu(void *, PRM_Name *,
00527 int,const PRM_SpareData *, PRM_Parm *);
00528 static void buildScopeMenu(void *, PRM_Name *,
00529 int,const PRM_SpareData *, PRM_Parm *);
00530 static void buildPlaneScopeMenu(void *, PRM_Name *,
00531 int,const PRM_SpareData *, PRM_Parm *);
00532 static void buildScopeMenuNoColAlpha(void *, PRM_Name *,
00533 int,const PRM_SpareData *, PRM_Parm *);
00534 static void buildPlaneMenu(void *, PRM_Name *,
00535 int,const PRM_SpareData *, PRM_Parm *);
00536 static void buildCompMenu(void *, PRM_Name *,
00537 int,const PRM_SpareData *, PRM_Parm *);
00538 static void buildInputScopeMenu(void *, PRM_Name *,
00539 int,const PRM_SpareData *, PRM_Parm *);
00540 static void buildInputPlaneMenu(void *, PRM_Name *,
00541 int,const PRM_SpareData *, PRM_Parm *);
00542 static void buildInputCompMenu(void *, PRM_Name *,
00543 int,const PRM_SpareData *, PRM_Parm *);
00544
00545 void buildPlaneMenu(PRM_Name *items, int maxsize,
00546 bool useinput = false,
00547 bool planes_only = false,
00548 bool comps_only = false,
00549 bool wild = true,
00550 int input = 0,
00551 bool nocoloralpha = false);
00552
00553 static const char *getColorPlaneName();
00554 static const char *getAlphaPlaneName();
00555 static const char *getMaskPlaneName();
00556 static const char *getDepthPlaneName();
00557 static const char *getLumPlaneName();
00558 static const char *getBumpPlaneName();
00559 static const char *getPointPlaneName();
00560 static const char *getNormalPlaneName();
00561 static const char *getVelocityPlaneName();
00562
00563
00564 static int dumpCache(void *me, int i, float t,
00565 const PRM_Template *);
00566 static void printMe(void *me, ostream &os);
00567
00568 static void addToFileLoadTime(float t);
00569
00570
00571 virtual const char *getChildType() const { return COP2_OPTYPE_NAME; }
00572 virtual const char *getOpType() const { return COP2_OPTYPE_NAME; }
00573
00574 virtual OP_OpTypeId getChildTypeID() const { return COP2_OPTYPE_ID; }
00575 virtual OP_OpTypeId getOpTypeID() const { return COP2_OPTYPE_ID; }
00576
00577 int64 getMemoryUsage() { return 0; }
00578
00579 virtual unsigned disableParms();
00580
00581 virtual OP_DATA_TYPE getCookedDataType() const { return OP_IMAGE_DATA; }
00582 virtual void *getCookedData(OP_Context &) { return 0; }
00583 virtual void *stealCookedData(void *) { return 0; }
00584
00585
00586 virtual int getNetOverviewColor( UT_Color &color );
00587 virtual void opChanged(OP_EventType type, void *data);
00588
00589 static void initializeExpressions();
00590 static void initializeCache();
00591 static void buildOperatorTable(OP_OperatorTable &table);
00592 static void installCommands();
00593
00594 static OP_TemplatePair myTemplatePair;
00595 static OP_VariablePair myVariablePair;
00596 static PRM_Template myTemplateList[];
00597 static CH_LocalVariable myVariableList[];
00598
00599 virtual void getNodeSpecificInfoText(OP_Context &context,
00600 int verbose,
00601 UT_WorkBuffer &text);
00602
00603 void inputRes(int input, float t, int xres, int yres,
00604 int &i_xres, int &i_yres);
00605
00606
00607
00608 void processTile(COP2_ThreadCookParms *p);
00609
00610 void setInputBlocked(bool blocked, int thread);
00611
00612
00613
00614 void removeRegions();
00615
00616
00617
00618 virtual int getNumInputsToOpen() const { return nInputs(); }
00619 virtual COP2_Node *getInputToOpen(int i)
00620 { return CAST_COP2NODE(getInput(i, true)); }
00621
00622
00623
00624
00625 virtual void getInputDependenciesForOutputArea(
00626 COP2_CookAreaInfo &output_area,
00627 const COP2_CookAreaList &input_areas,
00628 COP2_CookAreaList &needed_areas);
00629
00630
00631
00632
00633 COP2_CheckpointWrapper *getCheckpointWrapper()
00634 { return myCheckpointWrapper; }
00635 void setCheckpointWrapper(COP2_CheckpointWrapper *wrapper)
00636 { UT_ASSERT(!(myCheckpointWrapper && wrapper)); myCheckpointWrapper = wrapper; }
00637
00638 virtual void modifyViewMatrix(int input,
00639 COP2_Context &context,
00640 UT_Matrix4 &matrix,
00641 float zoom);
00642
00643 virtual COP2_Node *selectInput(int px, int py, const char *plane_name,
00644 int array_index);
00645
00646 virtual fpreal getW() const;
00647
00648 virtual fpreal getH() const;
00649
00650
00651 static void resetBadMissingFrames();
00652
00653 static void setFileProxyReduce(float rx, float ry);
00654 static void getFileProxyReduce(float &rx, float &ry);
00655
00656 virtual unsigned referenceAllParameters(OP_Parameters *from);
00657 protected:
00658 COP2_Node(OP_Network *net, const char *name, OP_Operator *entry);
00659 virtual ~COP2_Node();
00660
00661 virtual OP_ERROR cookMe (OP_Context &) { return UT_ERROR_NONE; }
00662 virtual unsigned cook (OP_Context &);
00663 virtual OP_ERROR bypassMe(OP_Context &, int &) { return UT_ERROR_NONE; }
00664
00665 static unsigned int getCookScore(float cooktime);
00666
00667
00668
00669
00670
00671 void setVariableUseFullRes(bool onoff);
00672
00673 virtual float getVariableValue(int index, int thread);
00674
00675 virtual void getMyExternalReferences(UT_StringArray &reflist,
00676 UT_StringArray *nodelist =0,
00677 bool collapse = false,
00678 bool check_missing = false,
00679 bool show_missing_only=false);
00680
00681 void launchViewer(TIL_ViewerType view);
00682
00683
00684 void addError(int code, const char *msg = 0);
00685 void addSystemError(const char *msg = 0);
00686 void addWarning(int code, const char *msg = 0);
00687 void addSystemWarning(const char *msg = 0);
00688 void addMessage(int code, const char *msg = 0);
00689
00690
00691 void addCookError(int code, const char *msg = 0);
00692 void addCookSystemError(const char *msg = 0);
00693 void addCookWarning(int code, const char *msg = 0);
00694 void addCookSystemWarning(int code, const char *msg = 0);
00695 void addCookMessage(int code, const char *msg = 0);
00696
00697 UT_ErrorManager myCookErrorManager;
00698
00699 virtual int deleteNodeData(void *) { return 0; }
00700 virtual void *copyNodeData(void *) { return 0; }
00701
00702
00703
00704 virtual int isScaledImageDifferent() const { return 0; }
00705
00706
00707 virtual void inputOpenFailed(int ) { }
00708
00709
00710 virtual COP2_ThreadPref getThreadPreference() const
00711 { return COP2_THREAD_NO_PREF; }
00712
00713
00714 virtual const char *getOperationInfo();
00715
00716
00717 virtual TIL_Sequence * cookSequenceInfo(OP_ERROR &error) = 0;
00718
00719 bool isInputBlocked(int thread);
00720
00721
00722 TIL_TileList *inputTile(int input_index,
00723 COP2_Context &context,
00724 const TIL_Plane *plane,
00725 int array_index,
00726 float t,
00727 int xstart,
00728 int ystart,
00729 OP_ERROR *err = 0,
00730 int block = 1,
00731 bool *mask = 0,
00732 COP2_Node *fromtile = 0,
00733 bool correctorig = true,
00734 bool *blocked = 0,
00735 bool *was_corrected = 0);
00736
00737
00738 inline TIL_TileList *inputTile(int input_index,
00739 COP2_Context &context,
00740 int xstart,
00741 int ystart,
00742 OP_ERROR *err = 0,
00743 int block = 1,
00744 bool *mask = 0,
00745 bool *blocked = 0,
00746 bool *was_corrected = 0);
00747
00748
00749 inline TIL_TileList *inputTile(int input,
00750 COP2_Context &context,
00751 TIL_TileList *mytile,
00752 float t,
00753 OP_ERROR *err = 0,
00754 int block = 1,
00755 bool *mask = 0,
00756 bool *blocked = 0,
00757 bool *was_corrected = 0);
00758
00759
00760 inline TIL_TileList *inputTile(int input,
00761 COP2_Context &context,
00762 TIL_TileList *mytile,
00763 OP_ERROR *err = 0,
00764 int block = 1,
00765 bool *mask = 0,
00766 bool *blocked = 0,
00767 bool *was_corrected = 0);
00768
00769
00770 bool copyInput(int input,
00771 COP2_Context &context,
00772 TIL_TileList *tilelist,
00773 float t,
00774 OP_ERROR *err = 0,
00775 int block = 1,
00776 bool *mask = 0);
00777
00778 bool copyInput(int input,
00779 COP2_Context &context,
00780 TIL_TileList *mytile,
00781 OP_ERROR *err = 0,
00782 int block = 1,
00783 bool *mask = 0);
00784
00785
00786
00787 TIL_TileList *passInputTile(int input_index,
00788 COP2_Context &context,
00789 const TIL_Plane *plane,
00790 int array_index,
00791 float t,
00792 int xstart,
00793 int ystart,
00794 int block,
00795 bool *blocked,
00796 bool *mask,
00797 COP2_Node *fromTile = 0);
00798
00799
00800
00801 void releaseTile(TIL_TileList *&, bool reset = false);
00802
00803
00804
00805
00806 TIL_Region * inputRegion(int input_index,
00807 COP2_Context &context,
00808 const TIL_Plane *plane,
00809 int array_index,
00810 float t,
00811 int xstart,
00812 int ystart,
00813 int xend,
00814 int yend,
00815 TIL_RegionExtend hold = TIL_BLACK,
00816 int share = 1,
00817 void *regionmem[PLANE_MAX_VECTOR_SIZE]=0,
00818 bool correct_aspect = true,
00819 bool correct_bounds = true,
00820 int scan_alignment = 0);
00821
00822
00823
00824 inline TIL_Region * inputRegion(int input_index,
00825 COP2_Context &context,
00826 int xstart,
00827 int ystart,
00828 int xend,
00829 int yend,
00830 TIL_RegionExtend hold = TIL_BLACK,
00831 int share = 1,
00832 void *regionmem[PLANE_MAX_VECTOR_SIZE]=0,
00833 bool correct_aspect = true,
00834 bool correct_bounds = true,
00835 int scan_alignment = 0);
00836
00837
00838
00839 TIL_Region * inputRegion(int input_index,
00840 COP2_Context &context,
00841 const TIL_Plane *plane,
00842 int array_index,
00843 float t,
00844 TIL_TileList *tilelist,
00845 int xshift=0,
00846 int yshift=0,
00847 int copy = 0,
00848 TIL_RegionExtend hold = TIL_BLACK);
00849
00850
00851
00852
00853 inline TIL_Region * inputRegion(int input_index,
00854 COP2_Context &context,
00855 TIL_TileList *tilelist,
00856 int xshift=0,
00857 int yshift=0,
00858 int copy = 0,
00859 TIL_RegionExtend hold = TIL_BLACK);
00860
00861
00862
00863
00864 inline TIL_Region * outputRegion(const TIL_Plane *plane, int array_index,
00865 float t, int xres, int yres, int thread,
00866 int xstart, int ystart,
00867 int xend, int yend,
00868 int share = 1,
00869 int rindex = 0,
00870 int alignment = 0);
00871
00872 TIL_Region * outputRegion(COP2_Context &context,
00873 int xstart, int ystart,
00874 int xend, int yend,
00875 int share = 1,
00876 int rindex = 0,
00877 int alignment = 0);
00878
00879
00880
00881
00882
00883 TIL_Region * outputRegion(const TIL_Plane *plane,
00884 const TIL_Plane *ref_plane,
00885 int array_index, float t,
00886 int xres, int yres, int thread,
00887 int xstart, int ystart,
00888 int xend, int yend,
00889 int share = 1,
00890 int rindex = 0,
00891 int alignment = 0);
00892
00893
00894
00895
00896
00897
00898
00899 void scaleInput(int input, COP2_Context &context,
00900 const TIL_Plane *plane, int array_index,
00901 float t, UT_FilterType xfilter,
00902 UT_FilterType yfilter,
00903 TIL_TileList *tilelist);
00904
00905
00906
00907 static void scaleImageArea(float sx, float sy,
00908 int ix1, int iy1, int ix2, int iy2,
00909 int &x1, int &y1, int &x2, int &y2);
00910
00911
00912
00913
00914
00915
00916 TIL_Region * transformRegion(int input,
00917 COP2_Context &context,
00918 const TIL_Plane *plane,
00919 int aindex,
00920 float t,
00921 int xres,
00922 int yres,
00923 int xstart,
00924 int ystart,
00925 int xend,
00926 int yend,
00927 const COP2_TransformParms &parms,
00928 bool input_aspect_adjust = true,
00929 bool streak_off_frame = false);
00930
00931
00932
00933
00934 bool transformRegion(int input,
00935 COP2_Context &context,
00936 TIL_Region *region,
00937 const COP2_TransformParms &parms,
00938 bool input_aspect_adjust = true,
00939 bool bounds_in_canvas_space = true,
00940 bool streak_off_frame = false);
00941
00942 bool isFullTransform(int input,
00943 COP2_Context &context,
00944 const COP2_TransformParms &cparms,
00945 bool input_aspect_adjust=true,
00946 COP2_Node **source_node=0,
00947 int *source_index=0,
00948 float *aspectx1=0,
00949 float *aspectx2=0,
00950 float *aspecty1=0,
00951 float *aspecty2=0,
00952 COP2_TransformParms *prepped_parms=0);
00953
00954 TIL_Region * transformBlurRegion(int input,
00955 COP2_Context &context,
00956 const TIL_Plane *plane,
00957 int aindex,
00958 float t,
00959 int xres,
00960 int yres,
00961 int xstart,
00962 int ystart,
00963 int xend,
00964 int yend,
00965 float amount,
00966 float bias,
00967 UT_PtrArray<const COP2_TransformParms*> &parms,
00968 bool deformation = false);
00969
00970 bool transformBlurRegion(int input,
00971 COP2_Context &context,
00972 TIL_Region *region,
00973 float amount,
00974 float bias,
00975 UT_PtrArray<const COP2_TransformParms*>&parms,
00976 bool deformation = false,
00977 bool bounds_in_canvas_space = true);
00978
00979
00980
00981 bool translateRegion(COP2_Context &context,
00982 COP2_Node &source_node,
00983 int source_input,
00984 TIL_Region *region, float tx, float ty,
00985 TIL_RegionExtend hold,
00986 bool bounds_in_canvas_space,
00987 bool streak_off_frame);
00988
00989
00990
00991 bool fullTransformRegion(COP2_Context &context,
00992 COP2_Node &source_node,
00993 int source_input,
00994 TIL_Region *region,
00995 COP2_TransformParms &parms,
00996 float haspect, float input_haspect,
00997 float vaspect, float input_vaspect,
00998 bool bounds_in_canvas_space);
00999
01000 UT_Matrix4 getShiftedInverseTransformMatrix(COP2_Context &context,
01001 COP2_Node &source_node,
01002 int source_input,
01003 const TIL_Plane *iplane,
01004 int array_index,
01005 const COP2_TransformParms &parms,
01006 int &dx, int &dy);
01007
01008
01009
01010
01011
01012
01013
01014
01015 void prepareTransformParms(COP2_Context &context,
01016 COP2_TransformParms &parms,
01017 COP2_Node *& source_node,
01018 int &source_index,
01019 bool input_aspect_adjust);
01020
01021
01022
01023
01024 void adjustPivotParms(int input_index,
01025 COP2_TransformParms &parms,
01026 bool input_aspect_adjust);
01027
01028
01029
01030
01031 void copyAndPrepareTransformParms(
01032 const UT_PtrArray<const COP2_TransformParms *>
01033 &source_parms,
01034 UT_PtrArray<COP2_TransformParms *> &dest_parms);
01035
01036
01037
01038
01039
01040 void extractFromOutputRegion(TIL_TileList *tiles,
01041 TIL_Region *output);
01042
01043
01044
01045 void releaseRegion(TIL_Region *, int output = 0);
01046
01047
01048
01049
01050
01051
01052 TIL_TileList *requestWorkingTiles(COP2_Context &context,
01053 const TIL_Plane *plane,
01054 int array_index,
01055 float t,
01056 int xstart, int ystart,
01057 int *cache_flag = 0,
01058 int ignore_bypass = 0,
01059 int block = 0);
01060
01061
01062
01063
01064 void releaseWorkingTiles(TIL_TileList *list);
01065
01066
01067 virtual void passThroughTiles(COP2_Context &context,
01068 const TIL_Plane *plane,
01069 int array_index,
01070 float t,
01071 int xstart, int ystart,
01072 TIL_TileList *&tile,
01073 int block = 1,
01074 bool *mask = 0,
01075 bool *blocked = 0);
01076
01077
01078
01079 virtual int passThrough(COP2_Context &context,
01080 const TIL_Plane *plane, int comp_index,
01081 int array_index, float t,
01082 int xstart, int ystart);
01083
01084 TIL_TileList *getBlackTile(const TIL_Plane *plane, int aindex,
01085 float t, int xres, int yres, int thread,
01086 int xstart, int ystart, bool *mask =0);
01087
01088
01089 virtual OP_ERROR cookMyTile(COP2_Context &context,
01090 TIL_TileList *tiles);
01091
01092
01093 OP_ERROR cookFullImage(COP2_Context &context,
01094 TIL_TileList *tiles,
01095 COP2_FullImageCB callback,
01096 UT_Lock &fullimagelock,
01097 bool use_float);
01098
01099 inline void lockParms(bool lock);
01100
01101
01102
01103
01104 virtual COP2_ContextData *newContextData(const TIL_Plane *plane,
01105 int array_index,
01106 float t,
01107 int xres,
01108 int yres,
01109 int thread,
01110 int max_threads);
01111
01112
01113 COP2_Context *getContext(const TIL_Plane *plane,
01114 int array_index,
01115 float t,
01116 int xres,
01117 int yres,
01118 int thread);
01119
01120
01121
01122 bool copyInputBounds(int input, COP2_Context &context,
01123 int *x1 = 0, int *y1 = 0,
01124 int *x2 = 0, int *y2 = 0);
01125
01126
01127
01128 virtual void computeImageBounds(COP2_Context &context);
01129
01130
01131 virtual bool isFrameScoped(int ) { return true; }
01132
01133
01134 virtual int scope(UT_String & ) { return 0; }
01135 virtual int frameScope(UT_String & ) { return 0; }
01136
01137 virtual OP_ERROR save(ostream &os, const OP_SaveFlags &flags,
01138 const char *pathPrefix);
01139 virtual OP_ERROR saveIntrinsic(ostream &os, const OP_SaveFlags &flags);
01140 virtual bool load(UT_IStream &is, const char *extension,
01141 const char *path=0);
01142
01143
01144
01145
01146
01147 bool getTileInFP(TIL_TileList *tilelist, float *&dest,
01148 int index, void *dtile =0);
01149
01150
01151
01152
01153 void writeFPtoTile(TIL_TileList *tilelist, float *&src,
01154 int index);
01155
01156 UT_Interrupt *getInterrupt();
01157
01158 void setCOPColoring(COP2_OpColorType type, bool enable);
01159
01160 void getOvercookStats(int &redone, int &total);
01161 void clearOvercookStats();
01162
01163 void ensureSequenceContainsColorAndAlpha();
01164
01165
01166
01167 virtual void cleanUpInputsRecursively();
01168
01169
01170
01171
01172 const COP2_CookAreaInfo *getAreaInfo(COP2_Context &context) const;
01173
01174
01175
01176 void makeOutputAreaDependOnAllInputAreas(
01177 COP2_CookAreaInfo &output_area,
01178 const COP2_CookAreaList &input_areas,
01179 COP2_CookAreaList &needed_areas);
01180
01181
01182
01183 void makeOutputAreaDependOnInputAreas(int input,
01184 COP2_CookAreaInfo &output_area,
01185 const COP2_CookAreaList &input_areas,
01186 COP2_CookAreaList &needed_areas);
01187
01188
01189
01190 COP2_CookAreaInfo *makeOutputAreaDependOnInputPlane(int input,
01191 const char *planename, int array_index, float t,
01192 const COP2_CookAreaList &input_areas,
01193 COP2_CookAreaList &needed_areas);
01194
01195
01196
01197 COP2_CookAreaInfo *makeOutputAreaDependOnMyPlane(int input,
01198 COP2_CookAreaInfo &output_area,
01199 const COP2_CookAreaList &input_areas,
01200 COP2_CookAreaList &needed_areas);
01201
01202
01203
01204
01205 void getInputAreasForCollapsedTransformInputs(
01206 COP2_Context &context,
01207 const COP2_TransformParms &transform_parms,
01208 COP2_CookAreaInfo &output_area,
01209 COP2_CookAreaList &uncollapsed_input_areas,
01210 COP2_CookAreaList &needed_areas,
01211 bool input_aspect_adjust,
01212 bool clear_uncollapse_list);
01213
01214
01215
01216
01217 virtual bool allowPartiallyScopedPlanes() const {return true;}
01218
01219
01220 void registerVolatileParm(const char *name,PRM_Callback c,
01221 bool ignore_missing = false);
01222
01223
01224
01225 void deAnimateFollowChanRef(const char *parmname);
01226
01227 void getDependencyInfo(OP_Context &context,
01228 UT_WorkBuffer &text);
01229
01230 void swapParm(const char *name1,const char *name2,
01231 int vsize);
01232 void swapStringParm(const char *name1,const char *name2,
01233 int vsize);
01234 public:
01235
01236
01237
01238
01239 virtual OP_ERROR setup(float t, int xres, int yres, int max_threads,
01240 bool doinput = true);
01241 OP_ERROR cookTile(TIL_TileList *&, float t,
01242 int xres, int yres, int thread_index,
01243 int max_threads);
01244
01245
01246
01247 void recursivelyCleanUp();
01248 void cleanUpCookContexts();
01249
01250
01251
01252 void cleanUpAllRegions();
01253
01254 void bumpCookSerial() { myCookSerial++; }
01255 int getCookSerial() { return myCookSerial; }
01256 protected:
01257 TIL_Sequence mySequence;
01258 int myCopOpenCount;
01259 unsigned char myCopRecurseFlag :1,
01260 myFramesAllScopedFlag:1;
01261 int myInterruptFlags;
01262 int myInputBlockFlags;
01263 COP2_ThreadPref myThreadPreference;
01264
01265 private:
01266 UT_PtrArray<COP2_Context *> myCookContexts;
01267 UT_PtrArray<TIL_Region *> myNonSharedRegions;
01268
01269 int myInitCook;
01270 int64 myTotalCookTime[TIL_MAX_THREADS];
01271 int64 myInputTileCookTime[TIL_MAX_THREADS];
01272 int64 myTotalTileCookTime[TIL_MAX_THREADS];
01273 unsigned char myCookStateFlags[TIL_MAX_THREADS];
01274 UT_IntArray myInputOpenKeys;
01275 int myCookDepth;
01276 int myCacheHits;
01277 int myCacheMisses;
01278 OP_Context mySequenceContext;
01279 UT_PtrArray<copLockInfo *> myLockedPlanes;
01280 int myPreviewPlaneIndex;
01281 int myPreviewPlaneArrayIndex;
01282 OP_ERROR myCookError;
01283 OP_ERROR myLastCopCookError;
01284 float myLastErrorTime;
01285 bool myProxyEnable;
01286 bool myCopDirtyFlag;
01287
01288
01289
01290
01291 int myCookSerial;
01292
01293
01294 static TIL_FastLock theParmEvalLock;
01295 static TIL_FastLock theParmHashCodeLock;
01296 TIL_FastLock mySingleThreadedLock;
01297 TIL_FastLock mySetupFuncLock;
01298 TIL_FastLock myCookVarLock;
01299 TIL_FastLock myRegionLock;
01300 TIL_FastLock myErrorLock;
01301 TIL_FastLock myIntrLock;
01302 TIL_FastLock myInputBlockLock;
01303 TIL_FastLock myContextDataLock;
01304
01305
01306 COP2_ImageSource *myImageSource;
01307
01308
01309 int myVarResX[TIL_MAX_THREADS];
01310 int myVarResY[TIL_MAX_THREADS];
01311 int myVarImageIndex[TIL_MAX_THREADS];
01312 float myVarImageTime[TIL_MAX_THREADS];
01313 int myVarImageArray[TIL_MAX_THREADS];
01314 int myVarPlaneIndex[TIL_MAX_THREADS];
01315 int myVarPlaneChannels[TIL_MAX_THREADS];
01316
01317 unsigned char myVarResUsed :1,
01318 myVarImageArrayUsed :1,
01319 myVarImagePlaneUsed :1,
01320 myVarUseFullRes :1,
01321 myCookOccurred :1;
01322
01323 UT_SymbolTable myCookedTilesTable;
01324 int myNumCookedTiles;
01325 int myDupCookedTiles;
01326
01327 COP2_CheckpointWrapper *myCheckpointWrapper;
01328
01329 COP2_VolatileParmManager *myVolatileParms;
01330
01331
01332 COP2_BoundsCache myBoundsCache;
01333 TIL_FastLock myBoundsLock;
01334
01335
01336
01337 ut_thread_id_t myOpenThreadId;
01338
01339
01340
01341 UT_Lock myOpenLock;
01342
01343 private:
01344
01345
01346
01347 void setOpenerThread(ut_thread_id_t thread_id)
01348 { myOpenThreadId = thread_id; }
01349
01350
01351
01352
01353 bool isOpenerThread() const
01354 { return myOpenThreadId
01355 == UT_Thread::getMyThreadId(); }
01356
01357 virtual float copTimeTransform(int input, COP2_Context &context,
01358 float t);
01359
01360 void setupVariables(const TIL_Plane *plane,
01361 int array,
01362 int xres,
01363 int yres,
01364 float t,
01365 int thread);
01366
01367
01368 void checkTimeDepAndRange();
01369
01370
01371 void verifyCacheIntegrity() { }
01372
01373
01374 int getWorkingTiles(COP2_Context &context,
01375 const TIL_Plane *plane,
01376 int array_index,
01377 float t,
01378 int xstart,int ystart,
01379 TIL_TileList *tilelist,
01380 int ignore_bypass = 0,
01381 int block = 1,
01382 bool *mask = 0,
01383 double *passtime = 0);
01384
01385 bool fillInteractiveTile(COP2_Context &context,
01386 const TIL_Plane *plane,
01387 int array_index, float t,
01388 int xstart,int ystart,
01389 TIL_Tile *tile, int cindex,
01390 int findex);
01391
01392
01393
01394 TIL_TileList * correctInputTile(int input_index,
01395 COP2_Context &context,
01396 const TIL_Plane *plane,
01397 int array_index,
01398 int xstart, int ystart,
01399 TIL_TileList *tilelist,
01400 int block, bool *blocked, bool *mask);
01401
01402 void doneCookOnTiles(TIL_TileList *tiles, OP_ERROR errstate,
01403 int thread_index);
01404
01405
01406
01407
01408 bool writeSafeDeepTile(COP2_ThreadCookParms *p,
01409 TIL_TileList *tilelist) const;
01410
01411
01412 void markTimerStart(int64 *now) const;
01413 void getElapsedTime(int64 *now) const;
01414 void appendCookTimesToPerformanceMonitor();
01415 void setCookDepth(int d);
01416
01417
01418 TIL_Region * allocateRegion(const TIL_Plane *plane, int input_index,
01419 int array_index, float t,
01420 int xres, int yres,
01421 int x1, int y1, int x2, int y2,
01422 int bx1, int by1, int bx2, int by2,
01423 TIL_RegionExtend hold,
01424 int output, int share,
01425 int scan_alignment);
01426
01427
01428 void openRegion(TIL_Region *region, void *regionmem[4],
01429 bool output);
01430
01431
01432 static void * threadCookTile(void *data);
01433
01434
01435
01436
01437 void insertIntoRaster(TIL_Raster *r, TIL_Tile *t,int tindex,
01438 float low=0.0F,float high=1.0F) const;
01439
01440
01441
01442
01443
01444 void insertIntoRaster(TIL_Raster *r, TIL_Tile *t,int tindex,
01445 int x1, int y1, int x2, int y2,
01446 int xshift=0, int yshift=0,
01447 float low=0.0F,float high=1.0F,
01448 int greyscale = 0,
01449 int ignore_points =0,
01450 float gamma = 1.0F) const;
01451
01452 void highlightTile(int thread, int onoff);
01453 void resetHighlight();
01454
01455
01456 void computeBoundsVariables(const OP_Context &context,
01457 const TIL_Plane *rplane,
01458 int array_index, TIL_Raster *raster,
01459 int thread_index,
01460 int orig_xstart, int orig_ystart,
01461 int orig_xend, int orig_yend,
01462 int &xstart, int &ystart, int &xend, int ¥d,
01463 int &xtile1, int &ytile1,
01464 int &xtile2, int &ytile2,
01465 int &x1, int &y1, int &x2, int &y2,
01466 int &xshift, int &yshift,
01467 int &bounds_xstart, int &bounds_ystart,
01468 int &bounds_xend, int &bounds_yend,
01469 bool flipbook);
01470
01471 void computeBoundsVariables(const TIL_Plane *rplane,
01472 float time, int xres, int yres,
01473 int array_index, TIL_Raster *raster,
01474 int thread_index,
01475 int orig_xstart, int orig_ystart,
01476 int orig_xend, int orig_yend,
01477 int &xstart, int &ystart, int &xend, int ¥d,
01478 int &xtile1, int &ytile1, int &xtile2, int &ytile2,
01479 int &x1, int &y1, int &x2, int &y2,
01480 int &xshift, int &yshift,
01481 int &bounds_xstart, int &bounds_ystart,
01482 int &bounds_xend, int &bounds_yend,
01483 bool flipbook);
01484
01485
01486
01487
01488 UT_TokenString *getPlaneIdentifierAndTileBoundaries(
01489 COP2_Context &context,
01490 const TIL_Plane &refplane,
01491 int xstart, int ystart, int xend, int yend,
01492 int &xtile1, int &ytile1, int &xtile2, int &ytile2,
01493 bool flipbook);
01494
01495 TIL_Region * getTransformRegionGPU(
01496 COP2_Node &source_node, int source_input,
01497 COP2_Context &context,
01498 const TIL_Plane *plane, int array_index,
01499 int x1, int y1, int x2, int y2,
01500 int input_origx, int input_origy,
01501 int input_xres, int input_yres,
01502 int filt_xoffset, int filt_yoffset,
01503 const COP2_TransformParms &parms,
01504 bool bounds_in_canvas_space,
01505 int &tx1, int &ty1, int &tx2, int &ty2,
01506 int preoffset[2], int postoffset[2]);
01507
01508 bool fullTransformRegionCPU(COP2_Context &context,
01509 COP2_Node &source_node,
01510 int source_input,
01511 TIL_Region *region,
01512 const COP2_TransformParms &parms,
01513 int x1, int y1, int x2, int y2,
01514 int input_x1, int input_y1,
01515 int input_x2, int input_y2,
01516 int input_xres, int input_yres,
01517 int full_input_xres, int full_input_yres,
01518 int filt_xoffset, int filt_yoffset,
01519 float haspect, float input_haspect,
01520 float vaspect, float input_vaspect,
01521 bool bounds_in_canvas_space,
01522 const UT_Matrix4 &xform);
01523
01524 bool fullTransformRegionGPU(COP2_Context &context,
01525 COP2_Node &source_node,
01526 int source_input,
01527 TIL_Region *region,
01528 const COP2_TransformParms &parms,
01529 int x1, int y1, int x2, int y2,
01530 int input_x1, int input_y1,
01531 int node_x1, int node_y1,
01532 int node_x2, int node_y2,
01533 int input_xres, int input_yres,
01534 int full_input_xres, int full_input_yres,
01535 int filt_xoffset, int filt_yoffset,
01536 float haspect, float input_haspect,
01537 float vaspect, float input_vaspect,
01538 bool bounds_in_canvas_space,
01539 const UT_Matrix4 &xform);
01540
01541 bool transformBlurRegionCPU(int input,
01542 COP2_Context &context,
01543 TIL_Region *region,
01544 UT_PtrArray<COP2_TransformParms*> &parms,
01545 bool deformation,
01546 float prev, float next, int numtimes,
01547 float itime[3], float ifact[3],
01548 bool bounds_in_canvas_space,
01549 int filt_xoffset, int filt_yoffset,
01550 int input_origx, int input_origy,
01551 int ixres, int iyres,
01552 int x1, int y1, int x2, int y2,
01553 float startt, float endt, float incr,
01554 float bfact);
01555
01556 bool transformBlurRegionGPU(int input,
01557 COP2_Context &context,
01558 TIL_Region *region,
01559 UT_PtrArray<COP2_TransformParms*> &parms,
01560 int deformation,
01561 float prev, float next, int numtimes,
01562 float itime[3], float ifact[3],
01563 bool bounds_in_canvas_space,
01564 int filt_xoffset, int filt_yoffset,
01565 int input_origx, int input_origy,
01566 int ixres, int iyres,
01567 int x1, int y1, int x2, int y2,
01568 float startt, float endt, float incr,
01569 float bfact);
01570
01571
01572
01573
01574
01575 virtual bool loadPacket(UT_IStream &is, short class_id, short sig, const char *path=0);
01576 virtual bool loadPacket(UT_IStream &is, const char *token, const char *path=0);
01577
01578 virtual void deleteCookedData() {}
01579 virtual int saveCookedData(const char *, OP_Context &);
01580 virtual int saveCookedData(ostream &, OP_Context &, int = 0)
01581 { return 0; }
01582 virtual const char *getFileExtension(int binary) const
01583 { return binary ? "bcop2" : "cop2"; }
01584
01585 static void installExpressions();
01586
01587 friend class COP2_CookScheduler;
01588 friend class COP2_VexVariableMap;
01589 friend class COP2_PixelOp;
01590 friend class COP2_VexOp;
01591 friend class COP2_MaskOp;
01592 };
01593
01594 inline TIL_TileList *
01595 COP2_Node::inputTile(int input_index, COP2_Context &context,
01596 int xstart, int ystart, OP_ERROR *err, int block,
01597 bool *mask, bool *blocked, bool *was_corrected)
01598 {
01599 return inputTile(input_index, context,
01600 context.myPlane, context.myArrayIndex,
01601 context.myTime, xstart, ystart, err, block, mask, 0,
01602 true, blocked, was_corrected);
01603 }
01604
01605
01606 inline TIL_TileList *
01607 COP2_Node::inputTile(int input_index, COP2_Context &context,
01608 TIL_TileList *tiles, OP_ERROR *err, int block,
01609 bool *mask, bool *blocked, bool *was_corrected)
01610 {
01611 return inputTile(input_index, context,
01612 context.myPlane, context.myArrayIndex,
01613 context.myTime,
01614 tiles->myX1,
01615 tiles->myY1,
01616 err, block, mask, 0, true, blocked, was_corrected);
01617 }
01618
01619 inline TIL_TileList *
01620 COP2_Node::inputTile(int index, COP2_Context &context,
01621 TIL_TileList *tilelist, float t,
01622 OP_ERROR *err,int block, bool *mask, bool *blocked,
01623 bool *was_corrected)
01624 {
01625 return inputTile(index, context, tilelist->myPlane, tilelist->myArrayIndex,
01626 t, tilelist->myX1, tilelist->myY1, err, block, mask,
01627 0, true, blocked, was_corrected);
01628 }
01629
01630 inline TIL_Region *
01631 COP2_Node::inputRegion(int input_index,
01632 COP2_Context &context,
01633 TIL_TileList *tilelist,
01634 int xshift,int yshift, int copy, TIL_RegionExtend hold)
01635 {
01636 return inputRegion(input_index, context,
01637 context.myPlane, context.myArrayIndex,
01638 context.myTime, tilelist, xshift, yshift, copy, hold);
01639 }
01640
01641 inline TIL_Region *
01642 COP2_Node::inputRegion(int input_index, COP2_Context &context,
01643 int xstart, int ystart, int xend, int yend,
01644 TIL_RegionExtend hold, int share,
01645 void *regionmem[PLANE_MAX_VECTOR_SIZE],
01646 bool correct_aspect, bool correct_bounds,
01647 int scan_alignment)
01648 {
01649 return inputRegion(input_index, context,
01650 context.myPlane, context.myArrayIndex,
01651 context.myTime, xstart, ystart, xend, yend,
01652 hold, share, regionmem, correct_aspect,
01653 correct_bounds, scan_alignment);
01654 }
01655
01656 inline TIL_Region *
01657 COP2_Node::outputRegion(const TIL_Plane *plane, int array_index, float seqt,
01658 int xres, int yres, int thread,
01659 int xstart, int ystart, int xend, int yend, int share,
01660 int rindex, int alignment)
01661 {
01662 return outputRegion(plane, plane, array_index, seqt, xres, yres, thread,
01663 xstart, ystart, xend, yend, share, rindex,alignment);
01664 }
01665
01666 inline void
01667 COP2_Node::lockParms(bool lock)
01668 {
01669 if(lock)
01670 TIL_LOCK(theParmEvalLock);
01671 else
01672 TIL_UNLOCK(theParmEvalLock);
01673 }
01674
01675 inline bool
01676 COP2_Node::getInputBounds(int input, COP2_Context &context,
01677 int &x1, int &y1, int &x2, int &y2)
01678 {
01679 return getInputBounds(input, context.myPlane, context.myArrayIndex,
01680 context.myTime, context.myXres, context.myYres,
01681 context.myThreadIndex, x1,y1, x2,y2);
01682 }
01683
01684 inline void
01685 COP2_Node::getImageBounds(COP2_Context &context,
01686 int &x1,int &y1, int &x2,int &y2)
01687 {
01688 getImageBounds(context.myPlane, context.myArrayIndex, context.myTime,
01689 context.myXres, context.myYres, context.myThreadIndex,
01690 x1,y1, x2,y2);
01691 }
01692
01693
01694
01695 COP2_API extern void
01696 COP2getVexReservedTemplateLists(UT_PtrArray<PRM_Template *> &tplatelists);
01697
01698
01699 extern "C" {
01700 DLLEXPORT extern void newCop2Operator(OP_OperatorTable *table);
01701 };
01702
01703 #endif