HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PXL_Common.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: PXL_Defines.h (Pixel Library, C++)
7  *
8  * COMMENTS:
9  *
10  */
11 #ifndef PXL_DEFINES_H
12 #define PXL_DEFINES_H
13 
14 #include <limits.h>
15 #include "PXL_API.h"
16 #include <UT/UT_Assert.h>
17 #include <UT/UT_ComputeGPU.h>
18 
20 {
21  PXL_INT8 = 0,
27 };
28 
30 {
31  PACK_SINGLE =0, // single channel
32  PACK_DUAL, // 2 channel interleaved + 1 black channel. (12B12B).
33  PACK_DUAL_NI, // 2 channel, non-interleaved (11111....12222222...2)
34  PACK_RGB, // RGB interleaved (rgbrgb...rgb)
35  PACK_RGBA, // RGBA interleaved
36  PACK_RGB_NI, // RGB non-interleaved (rrr...rggg...gbbb..b)
37  PACK_RGBA_NI, // RGBA non-interleaved
38 
40 };
41 
43 {
45 
50 
51  // For future support:
54 
55  // Append all new color spaces to this list here
56 
58 };
59 
61 PXL_API PXL_ColorSpace PXLgetColorSpace(const char *csname);
62 
63 
64 #define PXL_WHITE_8 UCHAR_MAX
65 #define PXL_WHITE_16 USHRT_MAX
66 #define PXL_WHITE_32 UINT_MAX
67 
68 PXL_API extern const int pxlDefinesDepth[6];
69 PXL_API extern const int pxlDefinesPComp[256];
70 PXL_API extern const int pxlDefinesPDepth[256];
71 PXL_API extern const unsigned int pxlDefinesWhite[6];
72 
74 {
75  switch(t)
76  {
77  default:
78  case PXL_INT8: return UT_GPU_UINT8;
79  case PXL_INT16: return UT_GPU_UINT16;
80  case PXL_INT32: return UT_GPU_UINT32;
81  case PXL_FLOAT32: return UT_GPU_FLOAT32;
82  case PXL_FLOAT16: return UT_GPU_FLOAT16;
83  }
84 
85  UT_ASSERT(!"Unknown type");
86  return UT_GPU_UINT8;
87 }
88 
90  { return pxlDefinesDepth[(int) d]; }
91 
93  { return pxlDefinesPComp[(int) p]; }
94 
96  { return pxlDefinesPDepth[(int) p]; }
97 
98 inline unsigned int PXLwhitePoint(PXL_DataFormat dt)
99  { return pxlDefinesWhite[ (int) dt]; }
100 
101 
102 // must be called before the following 3 CPU flag checks.
104 PXL_API bool PXLcpuHasMMX();
105 PXL_API int PXLcpuHasSSE();
106 PXL_API bool PXLcpuHasXMMX();
108 
109 inline int PXLclampChar(int t)
110 {
111  if(t < 0)
112  t = 0;
113  else if(t > 255)
114  t = 255;
115 
116  return t;
117 }
118 
119 inline int PXLclampShort(int t)
120 {
121  if(t < 0)
122  t = 0;
123  else if(t > 65535)
124  t = 65535;
125  return t;
126 }
127 
128 
129 #endif
PXL_API const int pxlDefinesPDepth[256]
int PXLpackingComponents(PXL_Packing p)
Definition: PXL_Common.h:92
unsigned int PXLwhitePoint(PXL_DataFormat dt)
Definition: PXL_Common.h:98
PXL_API bool PXLcpuHasMMX()
PXL_API int PXLcpuHasSSE()
PXL_API bool PXLcpuHasCondMov()
#define PXL_API
Definition: PXL_API.h:10
PXL_API const char * PXLgetColorSpaceName(PXL_ColorSpace cs)
UT_GPUType
Definition: UT_ComputeGPU.h:41
UT_GPUType PXLconvertToUTGPUType(PXL_DataFormat t)
Definition: PXL_Common.h:73
#define UT_ASSERT(ZZ)
Definition: UT_Assert.h:102
int PXLpackingDepth(PXL_Packing p)
Definition: PXL_Common.h:95
PXL_Packing
Definition: PXL_Common.h:29
PXL_DataFormat
Definition: PXL_Common.h:19
PXL_API const unsigned int pxlDefinesWhite[6]
PXL_API const int pxlDefinesDepth[6]
typedef int
Definition: png.h:1175
PXL_API bool PXLcpuHasXMMX()
PXL_ColorSpace
Definition: PXL_Common.h:42
int PXLformatDepth(PXL_DataFormat d)
Definition: PXL_Common.h:89
int PXLclampChar(int t)
Definition: PXL_Common.h:109
PXL_API PXL_ColorSpace PXLgetColorSpace(const char *csname)
int PXLclampShort(int t)
Definition: PXL_Common.h:119
PXL_API const int pxlDefinesPComp[256]
PXL_API void PXLdetermineProcCaps()