From 533532d01efa80a112a45e5c1de1d7abe5a12f22 Mon Sep 17 00:00:00 2001 From: Kaito Udagawa Date: Wed, 29 Mar 2023 13:40:29 +0900 Subject: [PATCH 1/4] Update background-filter.cpp --- src/background-filter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/background-filter.cpp b/src/background-filter.cpp index 630f0b83..d66c2bbf 100644 --- a/src/background-filter.cpp +++ b/src/background-filter.cpp @@ -56,7 +56,6 @@ struct background_removal_filter { std::vector> outputDims; std::vector> outputTensorValues; std::vector> inputTensorValues; - Ort::MemoryInfo memoryInfo; float threshold = 0.5f; cv::Scalar backgroundColor{0, 0, 0, 0}; float contourFilter = 0.05f; @@ -288,8 +287,8 @@ static void filter_update(void *data, obs_data_t *settings) static void *filter_create(obs_data_t *settings, obs_source_t *source) { - struct background_removal_filter *tf = reinterpret_cast( - bzalloc(sizeof(struct background_removal_filter))); + void *data = bmalloc(sizeof(struct background_removal_filter)); + struct background_removal_filter *tf = new(data) background_removal_filter(); tf->source = source; @@ -307,6 +306,7 @@ static void filter_destroy(void *data) struct background_removal_filter *tf = reinterpret_cast(data); if (tf) { + tf->~background_removal_filter(); bfree(tf); } } From 68a9fda15085853c1656d382ada1bae85dbcb40c Mon Sep 17 00:00:00 2001 From: Kaito Udagawa Date: Wed, 29 Mar 2023 14:26:51 +0900 Subject: [PATCH 2/4] Update background-filter.cpp --- src/background-filter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background-filter.cpp b/src/background-filter.cpp index d66c2bbf..520f2de3 100644 --- a/src/background-filter.cpp +++ b/src/background-filter.cpp @@ -288,7 +288,7 @@ static void filter_update(void *data, obs_data_t *settings) static void *filter_create(obs_data_t *settings, obs_source_t *source) { void *data = bmalloc(sizeof(struct background_removal_filter)); - struct background_removal_filter *tf = new(data) background_removal_filter(); + struct background_removal_filter *tf = new (data) background_removal_filter(); tf->source = source; From d5555c0d3979f6a38005e2bd320d8e6bcb4493b8 Mon Sep 17 00:00:00 2001 From: Kaito Udagawa Date: Wed, 29 Mar 2023 20:08:26 +0900 Subject: [PATCH 3/4] Update background-filter.cpp --- src/background-filter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/background-filter.cpp b/src/background-filter.cpp index 520f2de3..b271e2d2 100644 --- a/src/background-filter.cpp +++ b/src/background-filter.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include "plugin-macros.generated.h" #include "models/ModelSINET.h" From 7102c6a0f6f8e2f203210ccb17e6346fb7741ad9 Mon Sep 17 00:00:00 2001 From: Kaito Udagawa Date: Wed, 29 Mar 2023 22:55:41 +0900 Subject: [PATCH 4/4] Update background-filter.cpp --- src/background-filter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/background-filter.cpp b/src/background-filter.cpp index 582380f5..a59bf403 100644 --- a/src/background-filter.cpp +++ b/src/background-filter.cpp @@ -310,13 +310,13 @@ static void filter_destroy(void *data) struct background_removal_filter *tf = reinterpret_cast(data); if (tf) { - tf->~background_removal_filter(); obs_enter_graphics(); gs_texrender_destroy(tf->texrender); if (tf->stagesurface) { gs_stagesurface_destroy(tf->stagesurface); } obs_leave_graphics(); + tf->~background_removal_filter(); bfree(tf); } }