diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-18 14:34:22 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-07-18 14:59:06 +0300 |
commit | 566b319335563888e252b2186c93606ad41ff216 (patch) | |
tree | db0b9ed39f16455bd97314aac6b563bd5eb9ee49 | |
parent | bdda0964e0a5180bd0bc4fb8e38dbe2198bd9a9a (diff) |
Cleanup: Cryptomatte node style tweaks.
-rw-r--r-- | source/blender/blenlib/intern/hash_mm3.c | 2 | ||||
-rw-r--r-- | source/blender/compositor/nodes/COM_CryptomatteNode.cpp | 5 | ||||
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_cryptomatte.c | 17 |
3 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/blenlib/intern/hash_mm3.c b/source/blender/blenlib/intern/hash_mm3.c index ac483795e45..5ead9ceca63 100644 --- a/source/blender/blenlib/intern/hash_mm3.c +++ b/source/blender/blenlib/intern/hash_mm3.c @@ -49,7 +49,7 @@ static inline uint32_t rotl32(uint32_t x, int8_t r) return (x << r) | (x >> (32 - r)); } # define ROTL32(x,y) rotl32(x,y) -# define BIG_CONSTANT(x) (x##LLU) +# define BIG_CONSTANT(x) (x##LLU) #endif /* !defined(_MSC_VER) */ /* Block read - if your platform needs to do endian-swapping or can only diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp index c8134068543..bc115e66c20 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cpp +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cpp @@ -35,7 +35,8 @@ CryptomatteNode::CryptomatteNode(bNode *editorNode) : Node(editorNode) } /* This is taken from the Cryptomatte specification 1.0. */ -static inline float hash_to_float(uint32_t hash) { +static inline float hash_to_float(uint32_t hash) +{ uint32_t mantissa = hash & (( 1 << 23) - 1); uint32_t exponent = (hash >> 23) & ((1 << 8) - 1); exponent = max(exponent, (uint32_t) 1); @@ -95,7 +96,7 @@ void CryptomatteNode::convertToOperations(NodeConverter &converter, const Compos for (int i = 0; i < getNumberOfInputSockets()-1; ++i) { converter.mapInputSocket(this->getInputSocket(i + 1), operation->getInputSocket(i)); } - + SeparateChannelOperation *separateOperation = new SeparateChannelOperation; separateOperation->setChannel(3); converter.addOperation(separateOperation); diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c index 488dfa6756e..0231e4717b2 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.c @@ -4,7 +4,7 @@ * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -30,17 +30,10 @@ */ #include "node_composite_util.h" +#include "BLI_assert.h" #include "BLI_dynstr.h" #include "BLI_hash_mm3.h" -#include "BLI_assert.h" - -#ifndef max - #define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#ifndef min - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif +#include "BLI_utildefines.h" /* this is taken from the cryptomatte specification 1.0 */ @@ -48,8 +41,8 @@ static inline float hash_to_float(uint32_t hash) { uint32_t mantissa = hash & (( 1 << 23) - 1); uint32_t exponent = (hash >> 23) & ((1 << 8) - 1); - exponent = max(exponent, (uint32_t) 1); - exponent = min(exponent, (uint32_t) 254); + exponent = MAX2(exponent, (uint32_t) 1); + exponent = MIN2(exponent, (uint32_t) 254); exponent = exponent << 23; uint32_t sign = (hash >> 31); sign = sign << 31; |