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
This commit is contained in:
parent
6670019607
commit
b91b9a8eca
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user