diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-09-19 21:12:53 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-09-19 22:13:51 +0300 |
commit | 276eebb274744d819dcdab8a95770dd7382c0664 (patch) | |
tree | 2f1ab6ee7c3b87eb297143c32f4a2c09bd714f0c /source/blender/compositor/operations/COM_DenoiseOperation.h | |
parent | f256bfb3e26c32af12c82dbd32d4b3bcfba252f3 (diff) |
Compositor: Add OIDN prefiltering option to Denoise node
It's equivalent to the OpenImageDenoise prefiltering option in Cycles.
See D12043.
Prefilter modes:
- None: No prefiltering, use when guiding passes are noise-free.
- Fast: Denoise image and guiding passes together. Improves quality when
guiding passes are noisy using least amount of extra processing time.
- Accurate: Prefilter noisy guiding passes before denoising image.
Improves quality when guiding passes are noisy using extra
processing time.
Reviewed By: #compositing, jbakker, sergey
Differential Revision: https://developer.blender.org/D12342
Diffstat (limited to 'source/blender/compositor/operations/COM_DenoiseOperation.h')
-rw-r--r-- | source/blender/compositor/operations/COM_DenoiseOperation.h | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/source/blender/compositor/operations/COM_DenoiseOperation.h b/source/blender/compositor/operations/COM_DenoiseOperation.h index 48209c3eacf..1b053b79c2d 100644 --- a/source/blender/compositor/operations/COM_DenoiseOperation.h +++ b/source/blender/compositor/operations/COM_DenoiseOperation.h @@ -23,7 +23,24 @@ namespace blender::compositor { -class DenoiseOperation : public SingleThreadedOperation { +bool COM_is_denoise_supported(); + +class DenoiseBaseOperation : public SingleThreadedOperation { + protected: + bool output_rendered_; + + protected: + DenoiseBaseOperation(); + + public: + bool determineDependingAreaOfInterest(rcti *input, + ReadBufferOperation *readOperation, + rcti *output) override; + + void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; +}; + +class DenoiseOperation : public DenoiseBaseOperation { private: /** * \brief Cached reference to the input programs @@ -37,8 +54,6 @@ class DenoiseOperation : public SingleThreadedOperation { */ NodeDenoise *m_settings; - bool output_rendered_; - public: DenoiseOperation(); /** @@ -55,16 +70,13 @@ class DenoiseOperation : public SingleThreadedOperation { { this->m_settings = settings; } - bool determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) override; - void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) override; protected: + void hash_output_params() override; void generateDenoise(MemoryBuffer *output, MemoryBuffer *input_color, MemoryBuffer *input_normal, @@ -74,4 +86,28 @@ class DenoiseOperation : public SingleThreadedOperation { MemoryBuffer *createMemoryBuffer(rcti *rect) override; }; +class DenoisePrefilterOperation : public DenoiseBaseOperation { + private: + std::string image_name_; + + public: + DenoisePrefilterOperation(DataType data_type); + + void set_image_name(StringRef name) + { + image_name_ = name; + } + + void update_memory_buffer(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; + + protected: + void hash_output_params() override; + MemoryBuffer *createMemoryBuffer(rcti *rect) override; + + private: + void generate_denoise(MemoryBuffer *output, MemoryBuffer *input); +}; + } // namespace blender::compositor |