Blender V5.3
denoiser_oidn_base.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2026 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#ifdef WITH_OPENIMAGEDENOISE
8
9# include "integrator/denoiser.h"
11# include "util/vector.h"
12
14
15/* Shared OIDN denoiser functionality for both CPU and GPU implementations.
16 * Uses composition pattern to avoid multiple inheritance. */
17class OIDNDenoiserBase {
18 public:
19 explicit OIDNDenoiserBase(Denoiser *denoiser);
20 ~OIDNDenoiserBase()
21 {
22 release_all_resources();
23 }
24
25 /* OIDN handles and state. */
26 OIDNDevice oidn_device_ = nullptr;
27 OIDNFilter oidn_filter_ = nullptr;
28 OIDNFilter albedo_filter_ = nullptr;
29 OIDNFilter normal_filter_ = nullptr;
31 bool is_configured_ = false;
32 int2 configured_size_ = make_int2(0, 0);
33 vector<uint8_t> custom_weights_;
34 bool use_pass_albedo_ = false;
35 bool use_pass_normal_ = false;
36
37 /* Shared methods. */
38 bool create_filters(DenoiserQuality quality, bool denoise_abledo, bool denoise_normal);
39 void load_custom_weights();
40 void release_all_resources();
41 bool denoise_configure_if_needed(int width, int height);
42
43 private:
44 OIDNFilter new_filter();
45 Denoiser *denoiser_; /* Back-pointer for error reporting. */
46};
47
49
50#endif /* WITH_OPENIMAGEDENOISE */
DenoiserQuality
Definition denoise.h:55
@ DENOISER_QUALITY_HIGH
Definition denoise.h:56
#define CCL_NAMESPACE_END
ccl_device_forceinline int2 make_int2(const int x, const int y)
VecBase< int, 2 > int2