00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef TIL_DEFINES_H
00020 #define TIL_DEFINES_H
00021
00022 #include "TIL_API.h"
00023 #include <limits.h>
00024 #include <SYS/SYS_Types.h>
00025 #include <UT/UT_SysClone.h>
00026 #include <IMG/IMG_FileTypes.h>
00027 #include <UT/UT_Lock.h>
00028 #include <PXL/PXL_Common.h>
00029
00030 #define TIL_Lookup PXL_Lookup
00031 #define TIL_Fill PXL_Fill
00032 #define TIL_FillParms PXL_FillParms
00033 #define TIL_Pixel PXL_Pixel
00034 #define TIL_Convert PXL_Convert
00035
00036 class UT_String;
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifdef WIN32
00053 #define TIL_MAX_THREADS 8
00054 #else
00055 #define TIL_MAX_THREADS 32
00056 #endif
00057
00058 #ifdef CELLBE
00059 #define TIL_DEFAULT_TILE_SIZE 640
00060 #else
00061 #define TIL_DEFAULT_TILE_SIZE 200
00062 #endif
00063
00064 #define TIL_DEFAULT_INT8_SIZE (TIL_DEFAULT_TILE_SIZE*TIL_DEFAULT_TILE_SIZE)
00065 #define TIL_DEFAULT_INT16_SIZE (TIL_DEFAULT_INT8_SIZE * 2)
00066 #define TIL_DEFAULT_FLOAT32_SIZE (TIL_DEFAULT_INT8_SIZE * 4)
00067
00068
00069 #define TILE_LOCK_WRITE 0
00070 #define TILE_LOCK_READ_ONLY 1
00071
00072
00073 #ifdef WIN32
00074 #include <UT/UT_SpinLock.h>
00075 typedef UT_SpinLock TIL_FastLock;
00076 #else
00077 typedef UT_Lock TIL_FastLock;
00078 #endif
00079
00080
00081
00082
00083
00084
00085
00086
00087 #define TIL_DataFormat PXL_DataFormat
00088 #define TILE_INT8 PXL_INT8
00089 #define TILE_INT16 PXL_INT16
00090 #define TILE_INT32 PXL_INT32
00091 #define TILE_FLOAT32 PXL_FLOAT32
00092 #define TILE_FLOAT16 PXL_FLOAT16
00093 #define TILE_MAX_DATA_FORMAT PXL_MAX_DATA_FORMAT
00094
00095 #define TIL_Packing PXL_Packing
00096
00097 enum TIL_Interlace
00098 {
00099 INTERLACE_OFF = 0,
00100 INTERLACE_HALF = 1,
00101 INTERLACE_BLACK = 2,
00102 INTERLACE_DOUBLE = 3
00103 };
00104
00105 enum TIL_Dominance
00106 {
00107 ODD_DOMINANT = 0,
00108 EVEN_DOMINANT = 1,
00109 ODD_ONLY = 2,
00110 EVEN_ONLY = 3
00111 };
00112
00113
00114
00115 enum TIL_Extend
00116 {
00117 EXTEND_BLACK = 0,
00118 EXTEND_CYCLE,
00119 EXTEND_MIRROR,
00120 EXTEND_HOLD_FOREVER,
00121 EXTEND_HOLD
00122 };
00123
00124 enum TIL_Storage
00125 {
00126 STORE_CACHE = 0,
00127 STORE_NO_CACHE,
00128 STORE_LOCKED,
00129 STORE_PROXY,
00130 STORE_NEVER
00131 };
00132
00133 enum TIL_HistogramType
00134 {
00135 TIL_RAW_HISTOGRAM = 0,
00136 TIL_HUE_HISTOGRAM,
00137 TIL_SAT_HISTOGRAM,
00138 TIL_LUM_HISTOGRAM,
00139 TIL_RAW_VS_U,
00140 TIL_RAW_VS_V,
00141 TIL_HUE_VS_U,
00142 TIL_HUE_VS_V,
00143 TIL_SAT_VS_U,
00144 TIL_SAT_VS_V,
00145 TIL_LUM_VS_U,
00146 TIL_LUM_VS_V,
00147 TIL_HUE_VS_SAT,
00148 TIL_HUE_VS_LUM
00149 };
00150
00151 enum TIL_ViewerType
00152 {
00153 TIL_VIEW_2D = 0,
00154 TIL_VIEW_TIME,
00155 TIL_VIEW_GRAPH_RAWHIST,
00156 TIL_VIEW_GRAPH_HUEHIST,
00157 TIL_VIEW_GRAPH_SATHIST,
00158 TIL_VIEW_GRAPH_LUMHIST,
00159 TIL_VIEW_GRAPH_CURVES,
00160 TIL_VIEW_GRAPH_RAW_VS_U,
00161 TIL_VIEW_GRAPH_RAW_VS_V,
00162 TIL_VIEW_GRAPH_HUE_VS_U,
00163 TIL_VIEW_GRAPH_HUE_VS_V,
00164 TIL_VIEW_GRAPH_SAT_VS_U,
00165 TIL_VIEW_GRAPH_SAT_VS_V,
00166 TIL_VIEW_GRAPH_LUM_VS_U,
00167 TIL_VIEW_GRAPH_LUM_VS_V,
00168 TIL_VIEW_GRAPH_HUE_VS_SAT,
00169 TIL_VIEW_GRAPH_HUE_VS_LUM
00170 };
00171
00172 #define TILE_WHITE_8 UCHAR_MAX
00173 #define TILE_WHITE_16 USHRT_MAX
00174 #define TILE_WHITE_32 UINT_MAX
00175
00176 #define TILE_CACHE_MANAGER_MAX_LOCKS 4096
00177
00178 #define PLANE_MAX_ARRAY_SIZE 4096
00179 #define PLANE_MAX_VECTOR_SIZE 4
00180
00181 #define PROXY_TABLE_SIZE 309
00182 #define POOL_TABLE_SIZE 509
00183
00184
00185
00186
00187
00188 #define FOR_EACH_TILE(list,tile, i) \
00189 for(i=0, tile=list->myItems[0]; i<PLANE_MAX_VECTOR_SIZE; \
00190 i++, tile=list->myItems[i]) \
00191 if(tile)
00192
00193 #define GET_TILE(list,tile,i) \
00194 for(tile=0, i=0, tile=list->myItems[0]; i<PLANE_MAX_VECTOR_SIZE; \
00195 i++, tile=list->myItems[i]) \
00196 if(tile) break;
00197
00198 #define GET_UNCOOKED_TILE(list,tile,i) \
00199 for(tile=0, i=0, tile=list->myItems[0]; \
00200 i<PLANE_MAX_VECTOR_SIZE; i++,tile=list->myItems[i]) \
00201 if(tile && !tile->isCooked()) break;
00202
00203 #define FOR_EACH_UNCOOKED_TILE(list,tile,i) \
00204 for(i=0, tile=list->myItems[0]; i<PLANE_MAX_VECTOR_SIZE; \
00205 i++,tile=list->myItems[i]) \
00206 if(tile && !tile->isCooked())
00207
00208 #define FOR_EACH_UNCOOKED_PAIR(outlist, inlist, out, in, i) \
00209 for(i=0, out=outlist->myItems[0], in=inlist->myItems[0]; \
00210 i<PLANE_MAX_VECTOR_SIZE; \
00211 i++,out=outlist->myItems[i], in=inlist->myItems[i]) \
00212 if(out && in && !out->isCooked())
00213
00214
00215 #define TILE_INPUT1(list,a) { \
00216 a = list->myItems[0]; }
00217
00218 #define TILE_INPUT2(list,a,b) { \
00219 a = list->myItems[0]; \
00220 b = list->myItems[1]; }
00221
00222 #define TILE_INPUT3(list,a,b,c) { \
00223 a = list->myItems[0]; \
00224 b = list->myItems[1]; \
00225 c = list->myItems[2]; }
00226
00227 #define TILE_INPUT4(list,a,b,c,d) { \
00228 a = list->myItems[0]; \
00229 b = list->myItems[1]; \
00230 c = list->myItems[2]; \
00231 d = list->myItems[3]; }
00232
00233
00234
00235 #define TILE_SCALAR(list,a) { \
00236 a = list->myItems[0]; \
00237 if(a && a->isCooked()) a = 0; \
00238 }
00239
00240 #define TILE_VECTOR2(list,a,b) { \
00241 a = list->myItems[0]; \
00242 b = list->myItems[1]; \
00243 if(a && a->isCooked()) a = 0; \
00244 if(b && b->isCooked()) b = 0; \
00245 }
00246
00247 #define TILE_VECTOR3(list,a,b,c) { \
00248 a = list->myItems[0]; \
00249 b = list->myItems[1]; \
00250 c = list->myItems[2]; \
00251 if(a && a->isCooked()) a = 0; \
00252 if(b && b->isCooked()) b = 0; \
00253 if(c && c->isCooked()) c = 0; \
00254 }
00255
00256 #define TILE_VECTOR4(list,a,b,c,d){ \
00257 a = list->myItems[0]; \
00258 b = list->myItems[1]; \
00259 c = list->myItems[2]; \
00260 d = list->myItems[3]; \
00261 if(a && a->isCooked()) a = 0; \
00262 if(b && b->isCooked()) b = 0; \
00263 if(c && c->isCooked()) c = 0; \
00264 if(d && d->isCooked()) d = 0; \
00265 }
00266
00267
00268
00269 #ifdef TIL_DEBUG_LOCK_BLOCKING
00270 #define TIL_LOCK(loc) TILlock(loc, __FILE__ ":", __LINE__)
00271 #define TIL_UNLOCK(loc) loc.unlock()
00272 #define TILwait(n) TILwaitF(n, __FILE__ ":", __LINE__)
00273 #else
00274 #define TIL_LOCK(loc) loc.lockLW()
00275 #define TIL_UNLOCK(loc) loc.unlock()
00276 #define TILwait(n) TILwaitF(n)
00277 #endif
00278
00279 inline int TILformatDepth(PXL_DataFormat d)
00280 { return PXLformatDepth(d); }
00281
00282 inline int TILpackingComponents(PXL_Packing p)
00283 { return PXLpackingComponents(p); }
00284
00285 inline int TILpackingDepth(PXL_Packing p)
00286 { return PXLpackingDepth(p); }
00287
00288 inline unsigned int TILwhitePoint(PXL_DataFormat dt)
00289 { return PXLwhitePoint(dt); }
00290
00291
00292 TIL_API TIL_DataFormat TILformatConvert(IMG_DataType);
00293 TIL_API IMG_DataType TILformatConvert(TIL_DataFormat);
00294 TIL_API void TILparsePlaneName(const char *name, UT_String &pname,
00295 int &arrayindex);
00296 TIL_API void TILgetBWPoints(TIL_DataFormat d, float b, float w,
00297 unsigned &ib, unsigned &iw, bool &fast);
00298 TIL_API void TILgetFloatBWPoints(TIL_DataFormat d,
00299 unsigned ib, unsigned iw,
00300 float &b, float &w);
00301 TIL_API void TILgetBestFormat(TIL_DataFormat d1, float b1, float w1,
00302 TIL_DataFormat d2, float b2, float w2,
00303 TIL_DataFormat &best,
00304 float &black, float &white);
00305
00306
00307 TIL_API void TILlock(UT_Lock &lock,const char *file=0, int line=0);
00308 TIL_API void TILprintLockBlockStats();
00309 TIL_API void TILclearTotalWait();
00310 TIL_API void TILwaitF(int n, const char *file=0, int line=0);
00311 TIL_API double TILgetTotalWait();
00312
00313
00314
00315 TIL_API bool TILcopyOrRefPlaneName(const char *&dname,
00316 const char *name);
00317 TIL_API bool TILcopyOrRefCompName(const char *&dname,
00318 const char *name);
00319 TIL_API void TILinitNameRefs();
00320
00321
00322
00323 TIL_API bool TILcheckConstant(void *idata, TIL_DataFormat format,
00324 int xres,int yres);
00325
00326 TIL_API bool TILemulationNeeded(int comp, float b, float w,
00327 float sc, float sh, float gamma,
00328 const char *lut, float aspect,
00329 TIL_DataFormat type,
00330 bool use8bit, bool hard_accel,
00331 bool hardlut);
00332
00333
00334 class TIL_API til_AlignedBlock
00335 {
00336 public:
00337
00338
00339
00340 static til_AlignedBlock *allocBlock(int size, int alignment);
00341
00342
00343
00344
00345 static til_AlignedBlock *allocBlock(void *aligned);
00346
00347 static void freeBlock(til_AlignedBlock *&block);
00348
00349 operator void *() { return myAligned; }
00350 operator const void *() { return myAligned; }
00351
00352 private:
00353 til_AlignedBlock();
00354 ~til_AlignedBlock();
00355
00356 void reset();
00357
00358
00359
00360
00361
00362
00363 void *myReal;
00364 union {
00365 void *myAligned;
00366 til_AlignedBlock *myNext;
00367 };
00368 };
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382 #endif // TIL_DEFINES_H