MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / CreateCPUEngine

Function CreateCPUEngine

src/OpenColorIO/CPUProcessor.cpp:122–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120}
121
122void CreateCPUEngine(const OpRcPtrVec & ops,
123 BitDepth in,
124 BitDepth out,
125 OptimizationFlags oFlags,
126 // The bit-depth 'cast' or the first CPU Op.
127 ConstOpCPURcPtr & inBitDepthOp,
128 // The remaining CPU Ops.
129 ConstOpCPURcPtrVec & cpuOps,
130 // The bit-depth 'cast' or the last CPU Op.
131 ConstOpCPURcPtr & outBitDepthOp)
132{
133 const size_t maxOps = ops.size();
134 const bool fastLogExpPow = HasFlag(oFlags, OPTIMIZATION_FAST_LOG_EXP_POW);
135 for(size_t idx=0; idx<maxOps; ++idx)
136 {
137 ConstOpRcPtr op = ops[idx];
138 ConstOpDataRcPtr opData = op->data();
139
140 if(idx==0)
141 {
142 if(opData->getType()==OpData::Lut1DType)
143 {
144 ConstLut1DOpDataRcPtr lut = DynamicPtrCast<const Lut1DOpData>(opData);
145 inBitDepthOp = GetLut1DRenderer(lut, in, BIT_DEPTH_F32);
146 }
147 else if(in==BIT_DEPTH_F32)
148 {
149 inBitDepthOp = op->getCPUOp(fastLogExpPow);
150 }
151 else
152 {
153 inBitDepthOp = CreateGenericBitDepthHelper(in, BIT_DEPTH_F32);
154 cpuOps.push_back(op->getCPUOp(fastLogExpPow));
155 }
156
157 if(maxOps==1)
158 {
159 outBitDepthOp = CreateGenericBitDepthHelper(BIT_DEPTH_F32, out);
160 }
161 }
162 else if(idx==(maxOps-1))
163 {
164 if(opData->getType()==OpData::Lut1DType)
165 {
166 ConstLut1DOpDataRcPtr lut = DynamicPtrCast<const Lut1DOpData>(opData);
167 outBitDepthOp = GetLut1DRenderer(lut, BIT_DEPTH_F32, out);
168 }
169 else if(out==BIT_DEPTH_F32)
170 {
171 outBitDepthOp = op->getCPUOp(fastLogExpPow);
172 }
173 else
174 {
175 outBitDepthOp = CreateGenericBitDepthHelper(BIT_DEPTH_F32, out);
176 cpuOps.push_back(op->getCPUOp(fastLogExpPow));
177 }
178 }
179 else

Callers 1

finalizeMethod · 0.85

Calls 8

HasFlagFunction · 0.85
GetLut1DRendererFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45
getTypeMethod · 0.45
getCPUOpMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected