MCPcopy Create free account
hub / github.com/OpenPathGuidingLibrary/openpgl / Denoiser

Method Denoiser

openpgl/imagespace/Denoiser.h:15–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13struct Denoiser
14{
15 Denoiser(pgl_point2i resolution, bool filterFeatures) : m_resolution(resolution), m_filterFeatures(filterFeatures)
16 {
17 oidnDevice = oidn::newDevice();
18 oidnDevice.commit();
19
20 std::size_t numPixels = m_resolution.x * m_resolution.y;
21
22 bufferColor3f = oidnDevice.newBuffer(numPixels * 3 * sizeof(float));
23 bufferScalar = oidnDevice.newBuffer(numPixels * 1 * sizeof(float));
24 bufferAlbedo = oidnDevice.newBuffer(numPixels * 3 * sizeof(float));
25 bufferNormal = oidnDevice.newBuffer(numPixels * 3 * sizeof(float));
26
27 if (filterFeatures)
28 {
29 oidnAlbedoFilter = oidnDevice.newFilter("RT");
30 oidnAlbedoFilter.setImage("albedo", bufferAlbedo, oidn::Format::Float3, m_resolution.x, m_resolution.y);
31 oidnAlbedoFilter.setImage("output", bufferAlbedo, oidn::Format::Float3, m_resolution.x, m_resolution.y);
32 oidnAlbedoFilter.commit();
33
34 oidnNormalFilter = oidnDevice.newFilter("RT");
35 oidnNormalFilter.setImage("normal", bufferNormal, oidn::Format::Float3, m_resolution.x, m_resolution.y);
36 oidnNormalFilter.setImage("output", bufferNormal, oidn::Format::Float3, m_resolution.x, m_resolution.y);
37 oidnNormalFilter.commit();
38
39 oidnColor3fFilter = oidnDevice.newFilter("RT");
40 oidnColor3fFilter.setImage("color", bufferColor3f, oidn::Format::Float3, m_resolution.x, m_resolution.y);
41 oidnColor3fFilter.setImage("albedo", bufferAlbedo, oidn::Format::Float3, m_resolution.x, m_resolution.y);
42 oidnColor3fFilter.setImage("normal", bufferNormal, oidn::Format::Float3, m_resolution.x, m_resolution.y);
43 oidnColor3fFilter.setImage("output", bufferColor3f, oidn::Format::Float3, m_resolution.x, m_resolution.y);
44 oidnColor3fFilter.set("cleanAux", true); // auxiliary images will be prefiltered
45 oidnColor3fFilter.set("hdr", true);
46 oidnColor3fFilter.commit();
47 }
48 else
49 {
50 oidnColor3fFilter = oidnDevice.newFilter("RT");
51 oidnColor3fFilter.setImage("color", bufferColor3f, oidn::Format::Float3, m_resolution.x, m_resolution.y);
52 oidnColor3fFilter.setImage("albedo", bufferAlbedo, oidn::Format::Float3, m_resolution.x, m_resolution.y);
53 oidnColor3fFilter.setImage("normal", bufferNormal, oidn::Format::Float3, m_resolution.x, m_resolution.y);
54 oidnColor3fFilter.setImage("output", bufferColor3f, oidn::Format::Float3, m_resolution.x, m_resolution.y);
55
56 oidnColor3fFilter.set("hdr", true);
57 oidnColor3fFilter.commit();
58 }
59
60 oidnScalarFilter = oidnDevice.newFilter("RT");
61 oidnScalarFilter.setImage("color", bufferScalar, oidn::Format::Float, m_resolution.x, m_resolution.y);
62 oidnScalarFilter.setImage("output", bufferScalar, oidn::Format::Float, m_resolution.x, m_resolution.y);
63 oidnScalarFilter.set("hdr", true);
64 oidnScalarFilter.commit();
65 }
66
67 Denoiser(const Denoiser &denoiser) = delete;
68

Callers

nothing calls this directly

Calls 1

setMethod · 0.45

Tested by

no test coverage detected