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