diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-04-12 15:29:49 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-04-12 15:29:49 +0300 |
commit | 53f277a2e6b433c7ad4fa3ad54547842e5672a8d (patch) | |
tree | 91b37f56de62f9da3ee60a7b3d5e570d3360c9b8 /source/blender/compositor/operations | |
parent | 71cb0bdc43368c5041daac5565697b36d54d5186 (diff) |
Compositor: Allocate OIDN memory after receiving lock.
Related to {T77023}. When using many Denoise nodes the memory in OIDN
are allocated up front. A mutex could stall the process until. This
change will allocate the memory after it received the lock.
Diffstat (limited to 'source/blender/compositor/operations')
-rw-r--r-- | source/blender/compositor/operations/COM_DenoiseOperation.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.cc b/source/blender/compositor/operations/COM_DenoiseOperation.cc index 587afdc2d00..ec11ad4d69a 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.cc +++ b/source/blender/compositor/operations/COM_DenoiseOperation.cc @@ -101,6 +101,11 @@ void DenoiseOperation::generateDenoise(float *data, if (BLI_cpu_support_sse41()) # endif { + /* 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); + oidn::DeviceRef device = oidn::newDevice(); device.commit(); @@ -145,10 +150,6 @@ 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); |