Blender V5.3
denoiser_oidn_gpu.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#if defined(WITH_OPENIMAGEDENOISE)
8
11# include "util/openimagedenoise.h" // IWYU pragma: keep
12
14
15/* Implementation of a GPU denoiser which uses OpenImageDenoise library. */
16class OIDNDenoiserGPU : public DenoiserGPU {
17 public:
18 class State;
19
20 OIDNDenoiserGPU(Device *denoiser_device, const DenoiseParams &params);
21
22 static bool is_device_supported(const DeviceInfo &device);
23
24 protected:
25 enum class ExecMode {
26 SYNC,
27 ASYNC,
28 };
29
30 /* Create OIDN denoiser descriptor if needed.
31 * Will do nothing if the current OIDN descriptor is usable for the given parameters.
32 * If the OIDN denoiser descriptor did re-allocate here it is left unconfigured. */
33 bool denoise_create_if_needed(DenoiseContext &context) override;
34
35 /* Configure existing OIDN denoiser descriptor for the use for the given task. */
36 bool denoise_configure_if_needed(DenoiseContext &context) override;
37
38 /* Run configured denoiser. */
39 bool denoise_run(const DenoiseContext &context, const DenoisePass &pass) override;
40
41 bool commit_and_execute_filter(OIDNFilter filter, ExecMode mode = ExecMode::SYNC);
42
43 void set_filter_pass(OIDNFilter filter,
44 const char *name,
45 device_ptr ptr,
46 const int format,
47 const int width,
48 const int height,
49 const size_t offset_in_bytes,
50 const size_t pixel_stride_in_bytes,
51 size_t row_stride_in_bytes);
52
53 OIDNDenoiserBase base_;
54
55 /* Filter memory usage limit if we ran out of memory with OIDN's default limit. */
56 int max_mem_ = 768;
57};
58
60
61#endif
#define CCL_NAMESPACE_END
uint64_t device_ptr
Definition types_base.h:44