| 198 | } |
| 199 | |
| 200 | void BuildCDLOp(OpRcPtrVec & ops, |
| 201 | const Config & config, |
| 202 | const CDLTransform & cdlTransform, |
| 203 | TransformDirection dir) |
| 204 | { |
| 205 | if (config.getMajorVersion() == 1) |
| 206 | { |
| 207 | const auto combinedDir = CombineTransformDirections(dir, cdlTransform.getDirection()); |
| 208 | |
| 209 | double slope4[] = { 1.0, 1.0, 1.0, 1.0 }; |
| 210 | cdlTransform.getSlope(slope4); |
| 211 | |
| 212 | double offset4[] = { 0.0, 0.0, 0.0, 0.0 }; |
| 213 | cdlTransform.getOffset(offset4); |
| 214 | |
| 215 | double power4[] = { 1.0, 1.0, 1.0, 1.0 }; |
| 216 | cdlTransform.getPower(power4); |
| 217 | |
| 218 | double lumaCoef3[] = { 1.0, 1.0, 1.0 }; |
| 219 | cdlTransform.getSatLumaCoefs(lumaCoef3); |
| 220 | |
| 221 | double sat = cdlTransform.getSat(); |
| 222 | |
| 223 | switch (combinedDir) |
| 224 | { |
| 225 | case TRANSFORM_DIR_FORWARD: |
| 226 | { |
| 227 | // 1) Scale + Offset |
| 228 | CreateScaleOffsetOp(ops, slope4, offset4, TRANSFORM_DIR_FORWARD); |
| 229 | |
| 230 | // 2) Power + Clamp at 0 (NB: This is not in accord with the |
| 231 | // ASC v1.2 spec since it also requires clamping at 1.) |
| 232 | CreateExponentOp(ops, power4, TRANSFORM_DIR_FORWARD); |
| 233 | |
| 234 | // 3) Saturation (NB: Does not clamp at 0 and 1 |
| 235 | // as per ASC v1.2 spec) |
| 236 | CreateSaturationOp(ops, sat, lumaCoef3, TRANSFORM_DIR_FORWARD); |
| 237 | break; |
| 238 | } |
| 239 | case TRANSFORM_DIR_INVERSE: |
| 240 | { |
| 241 | // 3) Saturation (NB: Does not clamp at 0 and 1 |
| 242 | // as per ASC v1.2 spec) |
| 243 | CreateSaturationOp(ops, sat, lumaCoef3, TRANSFORM_DIR_INVERSE); |
| 244 | |
| 245 | // 2) Power + Clamp at 0 (NB: This is not in accord with the |
| 246 | // ASC v1.2 spec since it also requires clamping at 1.) |
| 247 | CreateExponentOp(ops, power4, TRANSFORM_DIR_INVERSE); |
| 248 | |
| 249 | // 1) Scale + Offset |
| 250 | CreateScaleOffsetOp(ops, slope4, offset4, TRANSFORM_DIR_INVERSE); |
| 251 | break; |
| 252 | } |
| 253 | } |
| 254 | } |
| 255 | else |
| 256 | { |
| 257 | // Starting with the version 2, OCIO is now using a CDL Op |