Blender V5.0
COM_utilities_oidn.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#ifdef WITH_OPENIMAGEDENOISE
8
9# include "BLI_span.hh"
10
11# include "COM_context.hh"
12
13# include <OpenImageDenoise/oidn.hpp>
14
15namespace blender::compositor {
16
17/* Create an appropriate device based on the device preferences in the given context. Special
18 * attention is given to GPU devices, as multiple GPUs could exist, so the same GPU device used in
19 * the active GPU context is chosen. If no GPU context is active, OIDN chooses the best device,
20 * which is typically the fastest in the system. Such device selection makes execution more
21 * predictable and allows interoperability across APIs. */
22oidn::DeviceRef create_oidn_device(const Context &context);
23
24/* Creates a buffer on the given device that represents the given image. If the device can access
25 * host-side data, the returned buffer is a simple wrapper around the data, otherwise, the data is
26 * copied to a device-only buffer. It is thus expected that the given image data will outlive the
27 * returned buffer. */
28oidn::BufferRef create_oidn_buffer(const oidn::DeviceRef &device, const MutableSpan<float> image);
29
30} // namespace blender::compositor
31
32#endif