Skip to content
Snippets Groups Projects
Commit 2c8525ea authored by Aline Gondim Santos's avatar Aline Gondim Santos
Browse files

preferences: update preferences categories and dependencies

GitLab: #16
Change-Id: Ib02e4201db803ea81abb305e00e494d46e837ad1
parent 7ad7a3a5
No related branches found
No related tags found
No related merge requests found
......@@ -8,3 +8,6 @@ config.mak
*__pycache__*
/foo/
/.vscode/
*.crt
*.key
*.sign
[
{
"category": "ir",
"type": "List",
"key": "irFile",
"title": "Impulse Response",
"title": "Impulse response",
"summary": "Choose a impulse response",
"defaultValue": "average_space_ir_0.mp3",
"scope": "plugin,Filter",
......@@ -19,11 +18,10 @@
]
},
{
"category": "stream",
"type": "List",
"key": "streamlist",
"title": "Stream to transform",
"summary": "Select audio to transform",
"title": "Audio stream",
"summary": "Select stream",
"defaultValue": "out",
"scope": "plugin",
"entryValues": [
......
[
{
"category": "text",
"type": "EditText",
"key": "answer",
"title": "Bot Answer",
"summary": "Set bot text",
"defaultValue": "Hello World from bot preference",
"key": "inText",
"title": "Bot trigger",
"summary": "Text that bot will answer to",
"defaultValue": "Hi",
"scope": "plugin,Bot"
},
{
"category": "text",
"type": "EditText",
"key": "inText",
"title": "Bot Trigger",
"summary": "Text that bot will answer to",
"defaultValue": "Hi",
"key": "answer",
"title": "Bot answer",
"summary": "Set bot text",
"defaultValue": "Hello World from bot preference",
"scope": "plugin,Bot"
}
]
\ No newline at end of file
......@@ -14,6 +14,7 @@ set (PLUGINS_LIB ${PROJECT_SOURCE_DIR}/../lib)
set (JPL_DIRECTORY ${PROJECT_BINARY_DIR}/jpl)
set (LIBS_DIR ${PROJECT_SOURCE_DIR}/../contrib/Libs)
set (ONNX_DIR $ENV{PLUGIN_ENV}/onnxruntime)
set (PREFERENCESFILENAME preferences)
if(WIN32)
message(OS:\ WINDOWS\ ${CMAKE_SYSTEM_PROCESSOR})
......@@ -36,6 +37,7 @@ add_definitions(-DNVIDIA)
set(ONNX_DIR ${ONNX_DIR}/nvidia-gpu)
message(Provider:\ NVIDIA)
set(EXTRA_PATH nvidia-gpu)
set (PREFERENCESFILENAME ${PREFERENCESFILENAME}-accel)
else()
set(ONNX_DIR ${ONNX_DIR}/cpu)
message(Provider:\ NONE)
......@@ -100,7 +102,7 @@ add_custom_command(
COMMAND ${CMAKE_COMMAND} -E copy ${ONNX_DIR}/onnxruntime.dll ${JPL_DIRECTORY}/lib/${CONTRIB_PLATFORM}
COMMAND ${CMAKE_COMMAND} -E make_directory ${JPL_DIRECTORY}/data/model
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/modelSRC/mModel.onnx ${JPL_DIRECTORY}/data/model
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/preferences-onnx.json ${JPL_DIRECTORY}/data/preferences.json
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/${PREFERENCESFILENAME}.json ${JPL_DIRECTORY}/data/preferences.json
COMMENT "Assembling Plugin files"
)
......
......@@ -26,12 +26,14 @@ DAEMON_SRC="${DAEMON}/src"
CONTRIB_PATH="${DAEMON}/contrib"
PLUGINS_LIB="../lib"
LIBS_DIR="./../contrib/Libs"
PREFERENCESFILENAME="preferences"
if [ "${PROCESSOR}" = "CPU" ]; then
ONNX_LIBS="cpu"
elif [ "${PROCESSOR}" = "NVIDIA" ]; then
ONNX_LIBS="nvidia-gpu"
CUBLASLT="-lcublasLt"
PREFERENCESFILENAME="${PREFERENCESFILENAME}-accel"
fi
PLATFORM="linux-gnu"
......@@ -117,7 +119,7 @@ then
mkdir "./build-local/jpl/data/model"
cp "./modelSRC/mModel.onnx" "./build-local/jpl/data/model/mModel.onnx"
cp "./preferences-onnx.json" "./build-local/jpl/data/preferences.json"
cp "./${PREFERENCESFILENAME}.json" "./build-local/jpl/data/preferences.json"
elif [ "${PLATFORM}" = "android" ]
then
......@@ -283,7 +285,7 @@ then
mkdir "./build-local/jpl/data/model"
cp "./modelSRC/mModel.ort" "./build-local/jpl/data/model/mModel.ort"
cp "./preferences-ort.json" "./build-local/jpl/data/preferences.json"
cp "./${PREFERENCESFILENAME}-accel.json" "./build-local/jpl/data/preferences.json"
fi
python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${ONNX_LIBS}
......@@ -36,7 +36,21 @@ PluginMediaHandler::PluginMediaHandler(std::map<std::string, std::string>&& pref
, preferences_ {preferences}
{
setId(datapath_);
mVS = std::make_shared<VideoSubscriber>(datapath_, preferences_.at("modellist"), preferences_.at("background"), preferences_.at("acceleration") == "1");
#ifdef __ANDROID__
mVS = std::make_shared<VideoSubscriber>(datapath_,
"mModel.ort",
preferences_.at("background"),
preferences_.at("acceleration") == "1");
#else
#ifdef NVIDIA
mVS = std::make_shared<VideoSubscriber>(datapath_,
"mModel.onnx",
preferences_.at("background"),
preferences_.at("acceleration") == "1");
#else
mVS = std::make_shared<VideoSubscriber>(datapath_, "mModel.onnx", preferences_.at("background"));
#endif // NVIDIA
#endif // ANDROID
}
void
......
[
{
"category" : "StreamsListPreference",
"type": "List",
"key": "streamslist",
"title": "Streams to transform",
"summary": "Select video to transform",
"defaultValue": "out",
"entries": ["sent", "received"],
"entryValues": ["out", "in"],
"scope": "plugin"
"type": "Path",
"mimeType": "image/png,image/jpeg,image/jpg",
"key": "background",
"title": "Background image",
"summary": "Select background image file",
"defaultValue": "data/backgrounds/background2.jpeg",
"scope": "plugin,Foreground Segmentation"
},
{
"category" : "acceleration",
"type": "List",
"type": "Switch",
"key": "acceleration",
"title": "Use HW Acceleration",
"summary": "Define Yes or No",
"summary": "Use CUDA/NNAPI",
"defaultValue": "1",
"entries": ["Yes", "No"],
"entryValues": ["1", "0"],
"scope": "plugin"
},
{
"category" : "models",
"type": "List",
"key": "modellist",
"title": "Model to load",
"summary": "Select the model to use",
"defaultValue": "mModel.ort",
"entries": ["mModel"],
"entryValues": ["mModel.ort"],
"key": "streamslist",
"title": "Video stream",
"summary": "Select stream",
"defaultValue": "out",
"entries": ["sent", "received"],
"entryValues": ["out", "in"],
"scope": "plugin"
},
{
"category" : "backgrounds",
"type": "Path",
"mimeType": "image/png,image/jpeg,image/jpg",
"key": "background",
"title": "Background image",
"summary": "Select the image background to use",
"defaultValue": "data/backgrounds/background2.jpeg",
"scope": "plugin,Foreground Segmentation"
}
]
[
{
"category" : "StreamsListPreference",
"type": "List",
"key": "streamslist",
"title": "Streams to transform",
"summary": "Select video to transform",
"defaultValue": "out",
"entries": ["sent", "received"],
"entryValues": ["out", "in"],
"scope": "plugin"
},
{
"category" : "acceleration",
"type": "List",
"key": "acceleration",
"title": "Use HW Acceleration",
"summary": "Define Yes or No",
"defaultValue": "1",
"entries": ["Yes", "No"],
"entryValues": ["1", "0"],
"scope": "plugin"
},
{
"category" : "models",
"type": "List",
"key": "modellist",
"title": "Model to load",
"summary": "Select the model to use",
"defaultValue": "mModel.onnx",
"entries": ["mModel"],
"entryValues": ["mModel.onnx"],
"scope": "plugin"
},
{
"category" : "backgrounds",
"type": "Path",
"mimeType": "image/png,image/jpeg,image/jpg",
"key": "background",
"title": "Background image",
"summary": "Select the image background to use",
"summary": "Select background image file",
"defaultValue": "data/backgrounds/background2.jpeg",
"scope": "plugin,Foreground Segmentation"
},
{
"type": "List",
"key": "streamslist",
"title": "Video stream",
"summary": "Select stream",
"defaultValue": "out",
"entries": ["sent", "received"],
"entryValues": ["out", "in"],
"scope": "plugin"
}
]
......@@ -54,7 +54,10 @@ public:
class VideoSubscriber : public jami::Observer<AVFrame*>
{
public:
VideoSubscriber(const std::string& dataPath, const std::string& model, const std::string& backgroundImage, bool acc);
VideoSubscriber(const std::string& dataPath,
const std::string& model,
const std::string& backgroundImage,
bool acc = false);
~VideoSubscriber();
virtual void update(jami::Observable<AVFrame*>*, AVFrame* const&) override;
......@@ -67,7 +70,7 @@ public:
private:
// Observer pattern
Observable<AVFrame*>* observable_{};
Observable<AVFrame*>* observable_ {};
// Data
std::string path_;
......
[
{
"category": "stream",
"type": "List",
"key": "videostream",
"title": "Video stream",
"summary": "select a video direction",
"defaultValue": "0",
"scope": "plugin",
"entryValues": [
"0",
"1"
],
"entries": [
"sent",
"received"
]
},
{
"category": "color",
"type": "List",
"key": "color",
"title": "Circle color",
......@@ -34,5 +16,21 @@
"green",
"red"
]
},
{
"type": "List",
"key": "videostream",
"title": "Video stream",
"summary": "Select stream",
"defaultValue": "0",
"scope": "plugin",
"entryValues": [
"0",
"1"
],
"entries": [
"sent",
"received"
]
}
]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment