Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Werner <stefan.werner@tangent-animation.com>2019-08-27 12:06:48 +0300
committerStefan Werner <stefan.werner@tangent-animation.com>2019-08-27 12:06:48 +0300
commitb91b9a8ecaf5392ee64305e9c6f96297a9aec71f (patch)
tree3bf959430d7f9ead16a897bceb82f99581f9a220 /source/blender/compositor
parent66700196074ad168f3322f2766846a0a07f7a00f (diff)
Compositor: Run only one instance of OIDN at a time.
Running multiple instances of OIDN simultaneously can use dozens of GBs of memory. Since OIDN is multithreaded internally, we can run only one instance at a time and should not lose much performance. Fixing T69006
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/operations/COM_DenoiseOperation.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.cpp b/source/blender/compositor/operations/COM_DenoiseOperation.cpp
index ad53ab13def..39ebc63ed20 100644
--- a/source/blender/compositor/operations/COM_DenoiseOperation.cpp
+++ b/source/blender/compositor/operations/COM_DenoiseOperation.cpp
@@ -22,7 +22,9 @@
#include "COM_DenoiseOperation.h"
#include "BLI_math.h"
#ifdef WITH_OPENIMAGEDENOISE
+# include "BLI_threads.h"
# include <OpenImageDenoise/oidn.hpp>
+static pthread_mutex_t oidn_lock = BLI_MUTEX_INITIALIZER;
#endif
#include <iostream>
@@ -139,7 +141,11 @@ void DenoiseOperation::generateDenoise(float *data,
}
filter.commit();
+ /* Since it's memory intensive, it's better to run only one instance of OIDN at a time.
+ * OpenImageDenoise is multithreaded internally and should use all available cores nonetheless. */
+ BLI_mutex_lock(&oidn_lock);
filter.execute();
+ BLI_mutex_unlock(&oidn_lock);
/* copy the alpha channel, OpenImageDenoise currently only supports RGB */
size_t numPixels = inputTileColor->getWidth() * inputTileColor->getHeight();