mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
filter/denoising: Don't denoise the same image twice
This commit is contained in:
parent
3735627b13
commit
f9c03f2c86
1 changed files with 3 additions and 55 deletions
|
@ -251,61 +251,6 @@ void denoising_instance::video_render(gs_effect_t* effect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Capture the input.
|
|
||||||
if (obs_source_process_filter_begin(_self, GS_RGBA, OBS_ALLOW_DIRECT_RENDERING)) {
|
|
||||||
auto op = _input->render(_size.first, _size.second);
|
|
||||||
|
|
||||||
// Clear the buffer
|
|
||||||
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &blank, 0, 0);
|
|
||||||
|
|
||||||
// Set GPU state
|
|
||||||
gs_blend_state_push();
|
|
||||||
gs_enable_color(true, true, true, true);
|
|
||||||
gs_enable_blending(false);
|
|
||||||
gs_enable_depth_test(false);
|
|
||||||
gs_enable_stencil_test(false);
|
|
||||||
gs_set_cull_mode(GS_NEITHER);
|
|
||||||
|
|
||||||
// Render
|
|
||||||
bool srgb = gs_framebuffer_srgb_enabled();
|
|
||||||
gs_enable_framebuffer_srgb(gs_get_linear_srgb());
|
|
||||||
obs_source_process_filter_end(_self, obs_get_base_effect(OBS_EFFECT_DEFAULT), _size.first, _size.second);
|
|
||||||
gs_enable_framebuffer_srgb(srgb);
|
|
||||||
|
|
||||||
// Reset GPU state
|
|
||||||
gs_blend_state_pop();
|
|
||||||
} else {
|
|
||||||
obs_source_skip_video_filter(_self);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process the captured input with the provider.
|
|
||||||
{
|
|
||||||
switch (_provider) {
|
|
||||||
#ifdef ENABLE_FILTER_DENOISING_NVIDIA
|
|
||||||
case denoising_provider::NVIDIA_DENOISING:
|
|
||||||
nvvfx_denoising_process();
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
_output = nullptr;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_output) {
|
|
||||||
D_LOG_ERROR("Provider '%s' did not return a result.", cstring(_provider));
|
|
||||||
obs_source_skip_video_filter(_self);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unlock the provider, as we are no longer doing critical work with it.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_dirty) {
|
|
||||||
// Lock the provider from being changed.
|
|
||||||
std::unique_lock<std::mutex> ul(_provider_lock);
|
|
||||||
|
|
||||||
{ // Capture the incoming frame.
|
{ // Capture the incoming frame.
|
||||||
#ifdef ENABLE_PROFILING
|
#ifdef ENABLE_PROFILING
|
||||||
::streamfx::obs::gs::debug_marker profiler1{::streamfx::obs::gs::debug_color_capture, "Capture"};
|
::streamfx::obs::gs::debug_marker profiler1{::streamfx::obs::gs::debug_color_capture, "Capture"};
|
||||||
|
@ -368,7 +313,10 @@ void denoising_instance::video_render(gs_effect_t* effect)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mark "clean".
|
||||||
_dirty = false;
|
_dirty = false;
|
||||||
|
|
||||||
|
// Unlock the provider, as we are no longer doing critical work with it.
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Draw the result for the next filter to use.
|
{ // Draw the result for the next filter to use.
|
||||||
|
|
Loading…
Reference in a new issue