diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_KeyingOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_KeyingOperation.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/compositor/operations/COM_KeyingOperation.cpp b/source/blender/compositor/operations/COM_KeyingOperation.cpp index e92e5c84c2d..48d1967b5b3 100644 --- a/source/blender/compositor/operations/COM_KeyingOperation.cpp +++ b/source/blender/compositor/operations/COM_KeyingOperation.cpp @@ -45,9 +45,10 @@ static float get_pixel_saturation(float pixelColor[4], float screen_balance, int int other_1 = (primary_channel + 1) % 3; int other_2 = (primary_channel + 2) % 3; - float min = MIN2(pixelColor[other_1], pixelColor[other_2]); - float max = MAX2(pixelColor[other_1], pixelColor[other_2]); - float val = screen_balance * min + (1.0f - screen_balance) * max; + int min_channel = MIN2(other_1, other_2); + int max_channel = MAX2(other_1, other_2); + + float val = screen_balance * pixelColor[min_channel] + (1.0f - screen_balance) * pixelColor[max_channel]; return (pixelColor[primary_channel] - val) * fabsf(1.0f - val); } |