[Bf-blender-cvs] [566b3193355] master: Cleanup: Cryptomatte node style tweaks.

Brecht Van Lommel noreply at git.blender.org
Wed Jul 18 14:03:21 CEST 2018


Commit: 566b319335563888e252b2186c93606ad41ff216
Author: Brecht Van Lommel
Date:   Wed Jul 18 13:34:22 2018 +0200
Branches: master
https://developer.blender.org/rB566b319335563888e252b2186c93606ad41ff216

Cleanup: Cryptomatte node style tweaks.

===================================================================

M	source/blender/blenlib/intern/hash_mm3.c
M	source/blender/compositor/nodes/COM_CryptomatteNode.cpp
M	source/blender/nodes/composite/nodes/node_composite_cryptomatte.c

===================================================================

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;



More information about the Bf-blender-cvs mailing list