3
0
Fork 0
forked from mirrors/nixpkgs

obs-studio-plugins.obs-backgroundremoval: remove

This commit is contained in:
Daniel Nagy 2022-12-29 13:00:00 +01:00 committed by Frederik Rietdijk
parent d6ec92f8bf
commit e999f05705
4 changed files with 2 additions and 121 deletions

View file

@ -10,8 +10,6 @@
looking-glass-obs = callPackage ./looking-glass-obs.nix { };
obs-backgroundremoval = callPackage ./obs-backgroundremoval { };
obs-gstreamer = callPackage ./obs-gstreamer.nix { };
obs-hyperion = qt6Packages.callPackage ./obs-hyperion/default.nix { };
@ -34,5 +32,7 @@
obs-websocket = throw "obs-websocket has been removed: Functionality has been integrated into obs-studio itself.";
obs-backgroundremoval = throw "obs-backgroundremoval has been removed: It does not work anymore and is unmaintained.";
wlrobs = callPackage ./wlrobs.nix { };
}

View file

@ -1,51 +0,0 @@
{ lib
, stdenv
, fetchFromGitHub
, cmake
, obs-studio
, onnxruntime
, opencv
}:
stdenv.mkDerivation rec {
pname = "obs-backgroundremoval";
version = "unstable-2022-05-02";
src = fetchFromGitHub {
owner = "royshil";
repo = "obs-backgroundremoval";
rev = "cc9d4a5711f9388ed110230f9f793bb071577a23";
hash = "sha256-xkVZ4cB642p4DvZAPwI2EVhkfVl5lJhgOQobjNMqpec=";
};
patches = [
# Fix c++ include directives
./includes.patch
# Use CPU backend instead of CUDA/DirectML
./use-cpu-backend.patch
];
nativeBuildInputs = [ cmake ];
buildInputs = [ obs-studio onnxruntime opencv ];
dontWrapQtApps = true;
cmakeFlags = [
"-DLIBOBS_INCLUDE_DIR=${obs-studio.src}/libobs"
"-DOnnxruntime_INCLUDE_DIRS=${onnxruntime.dev}/include/onnxruntime/core/session"
];
prePatch = ''
sed -i 's/version_from_git()/set(VERSION "0.4.0")/' CMakeLists.txt
'';
meta = with lib; {
description = "OBS plugin to replace the background in portrait images and video";
homepage = "https://github.com/royshil/obs-backgroundremoval";
maintainers = with maintainers; [ puffnfresh ];
license = licenses.mit;
platforms = [ "x86_64-linux" "i686-linux" ];
};
}

View file

@ -1,36 +0,0 @@
diff --git a/src/Model.h b/src/Model.h
index 6a73745..6bb8a7d 100644
--- a/src/Model.h
+++ b/src/Model.h
@@ -1,13 +1,8 @@
#ifndef MODEL_H
#define MODEL_H
-#if defined(__APPLE__)
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#include <onnxruntime/core/providers/cpu/cpu_provider_factory.h>
-#else
-#include <onnxruntime_cxx_api.h>
-#include <cpu_provider_factory.h>
-#endif
#ifdef WITH_CUDA
#include <cuda_provider_factory.h>
diff --git a/src/background-filter.cpp b/src/background-filter.cpp
index 0853818..32c6483 100644
--- a/src/background-filter.cpp
+++ b/src/background-filter.cpp
@@ -1,13 +1,8 @@
#include <obs-module.h>
#include <media-io/video-scaler.h>
-#if defined(__APPLE__)
#include <onnxruntime/core/session/onnxruntime_cxx_api.h>
#include <onnxruntime/core/providers/cpu/cpu_provider_factory.h>
-#else
-#include <onnxruntime_cxx_api.h>
-#include <cpu_provider_factory.h>
-#endif
#ifdef WITH_CUDA
#include <cuda_provider_factory.h>
#endif

View file

@ -1,32 +0,0 @@
From d04e167f9081a3ec8c49f0967b5b0cec79e40e4d Mon Sep 17 00:00:00 2001
From: Raphael Robatsch <raphael-git@tapesoftware.net>
Date: Fri, 14 Oct 2022 16:55:36 +0200
Subject: [PATCH] unix: use CPU backend instead of DirectML
---
src/background-filter.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/background-filter.cpp b/src/background-filter.cpp
index 32c6483..55e838f 100644
--- a/src/background-filter.cpp
+++ b/src/background-filter.cpp
@@ -205,10 +205,14 @@ static void createOrtSession(struct background_removal_filter *tf) {
if (tf->useGPU == USEGPU_CUDA) {
Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_CUDA(sessionOptions, 0));
}
-#else
+#elseif _WIN32
if (tf->useGPU == USEGPU_DML) {
Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_DML(sessionOptions, 0));
}
+#else
+ if (tf->useGPU == USEGPU_CPU) {
+ Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_CPU(sessionOptions, 0));
+ }
#endif
tf->session.reset(new Ort::Session(*tf->env, tf->modelFilepath, sessionOptions));
} catch (const std::exception& e) {
--
2.37.3