*/
static GList *parse_accl_hw_all (const gchar * accelerators,
const gchar ** supported_accelerators);
+static gint _gtfc_setprop_IS_UPDATABLE (GstTensorFilterPrivate * priv,
+ GstTensorFilterProperties * prop, const GValue * value);
+static gint _gtfc_setprop_ACCELERATOR (GstTensorFilterPrivate * priv,
+ GstTensorFilterProperties * prop, const GValue * value);
/**
* @brief GstTensorFilter properties.
_gtfc_setprop_FRAMEWORK (GstTensorFilterPrivate * priv,
GstTensorFilterProperties * prop, const GValue * value)
{
+ gint status;
const gchar *fw_name = g_value_get_string (value);
+ GValue val = G_VALUE_INIT;
if (priv->fw != NULL) {
if (g_strcmp0 (priv->prop.fwname, fw_name) != 0) {
}
gst_tensor_filter_get_available_framework (priv, fw_name);
+
+ /** set PROP_IS_UPDATABLE in case it was set before framework */
+ g_value_init (&val, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&val, priv->is_updatable);
+ status = _gtfc_setprop_IS_UPDATABLE (priv, prop, &val);
+ g_value_unset (&val);
+ if (status != 0) {
+ g_warning ("Set propery is-updatable failed with error: %d", status);
+ return status;
+ }
+
+ /** set PROP_ACCELERATOR in case it was set before framework */
+ if (prop->accl_str) {
+ g_value_init (&val, G_TYPE_STRING);
+ g_value_set_string (&val, prop->accl_str);
+ status = _gtfc_setprop_ACCELERATOR (priv, prop, &val);
+ g_value_unset (&val);
+ if (status != 0) {
+ g_warning ("Set propery accelerator failed with error: %d", status);
+ return status;
+ }
+ }
+
return 0;
}
return 0;
}
- if (GST_TF_FW_V0 (priv->fw)) {
- g_free_const (prop->accl_str);
+ if (priv->fw) {
+ if (GST_TF_FW_V0 (priv->fw)) {
+ g_free_const (prop->accl_str);
+ prop->accl_str = g_strdup (accelerators);
+ } else if (GST_TF_FW_V1 (priv->fw)) {
+ gst_tensor_filter_parse_accelerator (priv, &priv->prop, accelerators);
+ }
+ } else {
prop->accl_str = g_strdup (accelerators);
- } else if (GST_TF_FW_V1 (priv->fw)) {
- gst_tensor_filter_parse_accelerator (priv, &priv->prop, accelerators);
}
return 0;
}
_gtfc_setprop_IS_UPDATABLE (GstTensorFilterPrivate * priv,
GstTensorFilterProperties * prop, const GValue * value)
{
- if (GST_TF_FW_V0 (priv->fw) && priv->fw->reloadModel == NULL) {
- return 0;
- } else if (GST_TF_FW_V1 (priv->fw) &&
- priv->fw->eventHandler (priv->fw, prop, priv->privateData, RELOAD_MODEL,
- NULL)
- == -ENOENT) {
- return 0;
+ if (priv->fw) {
+ if (GST_TF_FW_V0 (priv->fw) && priv->fw->reloadModel == NULL) {
+ priv->is_updatable = FALSE;
+ return 0;
+ } else if (GST_TF_FW_V1 (priv->fw) &&
+ priv->fw->eventHandler (priv->fw, prop, priv->privateData, RELOAD_MODEL,
+ NULL)
+ == -ENOENT) {
+ priv->is_updatable = FALSE;
+ return 0;
+ }
}
priv->is_updatable = g_value_get_boolean (value);
}
arch=$(uname -m)
-if [ "$arch" = "armv7l" ]; then
+if [ "$arch" = "aarch64" ] || [ "$arch" = "armv7l" ]; then
auto_accl="cpu.neon"
elif [ "$arch" = "x86_64" ]; then
auto_accl="cpu.simd"
cat info | grep "nnapi = 1, accl = ${auto_accl}$"
testResult $? 2-17 "NNAPI activation test" 0 1
+# Property reading test for nnapi before setting the framework (analogous test is 2-3)
+gst-launch-1.0 --gst-plugin-path=${PATH_TO_PLUGIN} filesrc location=${PATH_TO_IMAGE} ! pngdec ! videoscale ! imagefreeze ! videoconvert ! video/x-raw,format=RGB,framerate=0/1 ! tensor_converter ! tensor_filter accelerator=true:!npu,gpu framework=tensorflow-lite model=${PATH_TO_MODEL} ! filesink location=tensorfilter.out.log 2>info
+cat info | grep "nnapi = 1, accl = gpu$"
+testResult $? 2-18 "NNAPI activation test" 0 1
+
# Cleanup
rm info