| 60 | } |
| 61 | |
| 62 | void RenderParams::update(ConstCDLOpDataRcPtr & cdl) |
| 63 | { |
| 64 | double slope[3], offset[3], power[3]; |
| 65 | cdl->getSlopeParams().getRGB(slope); |
| 66 | cdl->getOffsetParams().getRGB(offset); |
| 67 | cdl->getPowerParams().getRGB(power); |
| 68 | |
| 69 | const float saturation = (float)cdl->getSaturation(); |
| 70 | const CDLOpData::Style style = cdl->getStyle(); |
| 71 | |
| 72 | m_isReverse = (style == CDLOpData::CDL_V1_2_REV) || (style == CDLOpData::CDL_NO_CLAMP_REV); |
| 73 | |
| 74 | m_isNoClamp = (style == CDLOpData::CDL_NO_CLAMP_FWD) || (style == CDLOpData::CDL_NO_CLAMP_REV); |
| 75 | |
| 76 | if (isReverse()) |
| 77 | { |
| 78 | // Reverse render parameters |
| 79 | setSlope(Reciprocal((float)slope[0]), |
| 80 | Reciprocal((float)slope[1]), |
| 81 | Reciprocal((float)slope[2])); |
| 82 | |
| 83 | setOffset((float)-offset[0], (float)-offset[1], (float)-offset[2]); |
| 84 | |
| 85 | setPower(Reciprocal((float)power[0]), |
| 86 | Reciprocal((float)power[1]), |
| 87 | Reciprocal((float)power[2])); |
| 88 | |
| 89 | setSaturation(Reciprocal(saturation)); |
| 90 | } |
| 91 | else |
| 92 | { |
| 93 | // Forward render parameters |
| 94 | setSlope((float)slope[0], (float)slope[1], (float)slope[2]); |
| 95 | setOffset((float)offset[0], (float)offset[1], (float)offset[2]); |
| 96 | setPower((float)power[0], (float)power[1], (float)power[2]); |
| 97 | setSaturation(saturation); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | |
| 102 | #if OCIO_USE_SSE2 |