void BuildCDLOps(OpRcPtrVec & ops, const Config & /*config*/, const CDLTransform & cdlTransform, TransformDirection dir) { float scale4[] = { 1.0f, 1.0f, 1.0f, 1.0f }; cdlTransform.getSlope(scale4); float offset4[] = { 0.0f, 0.0f, 0.0f, 0.0f }; cdlTransform.getOffset(offset4); float power4[] = { 1.0f, 1.0f, 1.0f, 1.0f }; cdlTransform.getPower(power4); float lumaCoef3[] = { 1.0f, 1.0f, 1.0f }; cdlTransform.getSatLumaCoefs(lumaCoef3); float sat = cdlTransform.getSat(); TransformDirection combinedDir = CombineTransformDirections(dir, cdlTransform.getDirection()); // TODO: Confirm ASC Sat math is correct. // TODO: Handle Clamping conditions more explicitly if(combinedDir == TRANSFORM_DIR_FORWARD) { // 1) Scale + Offset CreateScaleOffsetOp(ops, scale4, offset4, TRANSFORM_DIR_FORWARD); // 2) Power + Clamp CreateExponentOp(ops, power4, TRANSFORM_DIR_FORWARD); // 3) Saturation + Clamp CreateSaturationOp(ops, sat, lumaCoef3, TRANSFORM_DIR_FORWARD); } else if(combinedDir == TRANSFORM_DIR_INVERSE) { // 3) Saturation + Clamp CreateSaturationOp(ops, sat, lumaCoef3, TRANSFORM_DIR_INVERSE); // 2) Power + Clamp CreateExponentOp(ops, power4, TRANSFORM_DIR_INVERSE); // 1) Scale + Offset CreateScaleOffsetOp(ops, scale4, offset4, TRANSFORM_DIR_INVERSE); } }
void CreateOffsetOp(OpRcPtrVec & ops, const float * offset4, TransformDirection direction) { float scale4[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; CreateScaleOffsetOp(ops, scale4, offset4, direction); }