platform/upstream/nnstreamer.git
3 years ago[test/snpe] Add unittest for SNPE subplugin
Yongjoo Ahn [Thu, 16 Sep 2021 08:09:04 +0000 (17:09 +0900)]
[test/snpe] Add unittest for SNPE subplugin

- Add unittest for SNPE subplugin.
- Add a sample model file `add2_float.dlc` for the test.
It takes a single float value and returns a single float value
with plus 2.0.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[build/snpe] Check host_machine and fix join_paths
Yongjoo Ahn [Thu, 16 Sep 2021 08:05:50 +0000 (17:05 +0900)]
[build/snpe] Check host_machine and fix join_paths

- Check host_machine when using SNPE SDK.
- Use `join_paths` properly`

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[armnn] compilation error - unused parameter
Julien Vuillaumier [Thu, 16 Sep 2021 20:27:17 +0000 (20:27 +0000)]
[armnn] compilation error - unused parameter

correction for multiple occurences of compilation error:

error: unused parameter '[parameter name]' [-Werror=unused-parameter]

Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
3 years ago[armnn] compilation error - missing initializer
Julien Vuillaumier [Thu, 16 Sep 2021 20:20:44 +0000 (20:20 +0000)]
[armnn] compilation error - missing initializer

correction for compilation error:

tensor_filter_armnn.cc: In function 'int armnn_open(const GstTensorFilterProperties*, void**)':
nnstreamer_plugin_api_filter.h:568:76: error: missing initializer for member 'parse_accl_args::auto_accl' [-Werror=missing-field-initializers]
    #define parse_accl_hw(...) parse_accl_hw_fill((parse_accl_args){__VA_ARGS__})
                                                                               ^
tensor_filter_armnn.cc:672:8: note: in expansion of macro 'parse_accl_hw'
    hw = parse_accl_hw (prop->accl_str, armnn_accl_support);
         ^~~~~~~~~~~~~

Signed-off-by: Julien Vuillaumier <julien.vuillaumier@nxp.com>
3 years agoFinal fix LGTM alerts
Taras Drozdovskyi [Thu, 16 Sep 2021 14:30:52 +0000 (17:30 +0300)]
Final fix LGTM alerts

Final correction of alerts found by the LGTM, one of which is marked as false-positive

Signed-off-by: Taras Drozdovskyi <t.drozdovsky@samsung.com>
3 years ago[Bug] Fix config from structure function
gichan [Wed, 15 Sep 2021 11:28:50 +0000 (20:28 +0900)]
[Bug] Fix config from structure function

Wrong forat variable is used at L908.
If tensors format is not given, defualt format should be static.

Signed-off-by: gichan <gichan2.jang@samsung.com>
3 years ago[TEST] Adjust state change timeout.
gichan [Thu, 16 Sep 2021 02:43:22 +0000 (11:43 +0900)]
[TEST] Adjust state change timeout.

cppFilterObj.base03 test fail intermittenly on armv7l during state change to GST_STATE_PLAYING.
When measuring the state change tome, it took around 600~800ms on armv7l.
The current timeout is 1000ms, which is close to the boundary.
The test failure did not occur when repeated 1000 times.
Previously, it occurred about once in 20 times.

Signed-off-by: gichan <gichan2.jang@samsung.com>
3 years agoFix some alerts that were detected by the LGTM system
Taras Drozdovskyi [Wed, 15 Sep 2021 09:58:22 +0000 (12:58 +0300)]
Fix some alerts that were detected by the LGTM system

nnstream project was analyzed by the LGTM system

Signed-off-by: Taras Drozdovskyi <t.drozdovsky@samsung.com>
3 years ago[build/snpe] Build snpe subplugin when the platform supports the lib accepted/tizen/unified/20210915.100110 submit/tizen/20210915.065224
Yongjoo Ahn [Wed, 8 Sep 2021 09:09:26 +0000 (18:09 +0900)]
[build/snpe] Build snpe subplugin when the platform supports the lib

- If the build platform supports snpe lib, use it to build snpe subplugin
- Add snpe related packages in spec

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[query] Handle different framerate of clients
Gichan Jang [Mon, 13 Sep 2021 05:20:50 +0000 (14:20 +0900)]
[query] Handle different framerate of clients

If data is not available in the socket, check the next socket.
So, server can hanlde different framerate of clients.

Todo:
 - Create threads for each client.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Filter/SharedModel] fix svace
Jaeyun [Mon, 13 Sep 2021 07:52:02 +0000 (16:52 +0900)]
[Filter/SharedModel] fix svace

Fix svace issue,
- set next node when releasing the list item
- use macro to define local lock for shared table

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Svace] fix res leak case
Jaeyun [Mon, 13 Sep 2021 08:31:31 +0000 (17:31 +0900)]
[Svace] fix res leak case

Fix svace issue,
- fix invalid condition to check the args.
- possible res leak in query close function.
- condition to free strings for test models.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Test/CodeClean] improve coverage
Jaeyun [Mon, 6 Sep 2021 10:29:53 +0000 (19:29 +0900)]
[Test/CodeClean] improve coverage

Update testcase to improve test coverage.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Query] Identify client using id
gichan [Fri, 13 Aug 2021 05:55:54 +0000 (14:55 +0900)]
[Query] Identify client using id

currently, ip address of the client is only used to distinguish client which will receive buffers.
In this case, server cannot distinguish if more than one client with the sampe ip is connected.
So instead of ip address, changed it to use the client's unique id.

Signed-off-by: gichan <gichan2.jang@samsung.com>
Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Test/Sparse] add testcase for common functions
Jaeyun [Mon, 6 Sep 2021 07:06:59 +0000 (16:06 +0900)]
[Test/Sparse] add testcase for common functions

Add new testcase for sparse tensor utils.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Sparse] change util function param
Jaeyun [Mon, 6 Sep 2021 07:03:00 +0000 (16:03 +0900)]
[Sparse] change util function param

Change param - gst-memory to convert tensor data.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Meson] feature for supported plugins
Jaeyun [Tue, 7 Sep 2021 08:26:14 +0000 (17:26 +0900)]
[Meson] feature for supported plugins

Add feature for supported plugins in meson script.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[test/py] Fix test related python sources to increase SAM score
Yongjoo Ahn [Tue, 7 Sep 2021 09:42:55 +0000 (18:42 +0900)]
[test/py] Fix test related python sources to increase SAM score

- Refactor complex functions to increase FME score
- Total python SAM score 3.82 -> 4.66

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[tvm/test] Add negative testcase for invalid custom prop
Yongjoo Ahn [Mon, 6 Sep 2021 10:36:53 +0000 (19:36 +0900)]
[tvm/test] Add negative testcase for invalid custom prop

- Add negative testcases for invalid custom props
- Add valid custom prop in the positive launch testcase.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Doc] Add tensor_quey README.md
gichan [Fri, 3 Sep 2021 09:00:34 +0000 (18:00 +0900)]
[Doc] Add tensor_quey README.md

Add tensor query documentation.
 - How to run examples.
 - How to run test.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[lua/test] Add tc for multiple tensor types in lua filter
Yongjoo Ahn [Fri, 3 Sep 2021 07:32:40 +0000 (16:32 +0900)]
[lua/test] Add tc for multiple tensor types in lua filter

- Add a testcase which covers all tensor types in tensor_filter::lua
- Add a negative case of invalid data type.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Test] aggregator from multi clients
Jaeyun [Fri, 27 Aug 2021 09:27:13 +0000 (18:27 +0900)]
[Test] aggregator from multi clients

Add testcase - aggregator from multiple clients using query meta.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Common/Adapter] aggregation from multi clients
Jaeyun [Fri, 27 Aug 2021 05:37:15 +0000 (14:37 +0900)]
[Common/Adapter] aggregation from multi clients

Use hashtable to aggregate buffers from multiple clients.
- create gst-adapter for each client id
- for normal case, set default adaptor (no meta in gst-buffer)

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Test/CodeClean] new testcases for coverage
Jaeyun [Tue, 31 Aug 2021 05:22:18 +0000 (14:22 +0900)]
[Test/CodeClean] new testcases for coverage

Add new cases to improve test coverage and fix some minor comment.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[TEST] Add tensor query tests
Gichan Jang [Wed, 25 Aug 2021 09:29:50 +0000 (18:29 +0900)]
[TEST] Add tensor query tests

Add tensor query tests.
line coverage increased from 6.6% to 77.6%.

Signed-off-by: gichan <gichan2.jang@samsung.com>
Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Test/Filter] testcase for filter-single
Jaeyun [Mon, 30 Aug 2021 08:18:41 +0000 (17:18 +0900)]
[Test/Filter] testcase for filter-single

Add new testcases for tensor-filter single.
filter-single class is used only for ML single API. For coverage report, we need to run and test this class.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[tensor_sparse] Add SSAT test for tensor_sparse
Yongjoo Ahn [Tue, 27 Jul 2021 03:11:41 +0000 (12:11 +0900)]
[tensor_sparse] Add SSAT test for tensor_sparse

- Add SSAT test for tensor_sparse_enc and tensor_sparse_dec

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[tensor_sparse] Implement tensor_sparse_enc and tensor_sparse_dec
Yongjoo Ahn [Tue, 27 Jul 2021 03:10:58 +0000 (12:10 +0900)]
[tensor_sparse] Implement tensor_sparse_enc and tensor_sparse_dec

- tensor_sparse_enc: encoding static tensors into sparse tensors
- tensor_sparse_dec: decoding sparse tensors into stsatic tensors

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[tensor_sparse] Implement util functions for sparse tensors
Yongjoo Ahn [Tue, 27 Jul 2021 03:07:56 +0000 (12:07 +0900)]
[tensor_sparse] Implement util functions for sparse tensors

- Implement util functions for enc/decoding sparse tensors
- Allow sparse format caps in tensor_sink

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Test/Py/CodeClean] reduce code complexity
Jaeyun [Fri, 20 Aug 2021 09:48:16 +0000 (18:48 +0900)]
[Test/Py/CodeClean] reduce code complexity

Code clean, reduce complexity.
- use itertool to remove multi loops
- separate code blocks

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years agoFix mutex error in nnstreamer_filter_shared_model_insert_and_get
MyungJoo Ham [Sun, 29 Aug 2021 12:59:16 +0000 (21:59 +0900)]
Fix mutex error in nnstreamer_filter_shared_model_insert_and_get

nnstreamer_filter_shared_model_insert_and_get may return without unlocking the mutex in an exception case.
Unlock it before exiting.

3 years ago[Filter/TFLite] Fix remove shared model table
Junhwan Kim [Thu, 12 Aug 2021 11:46:58 +0000 (20:46 +0900)]
[Filter/TFLite] Fix remove shared model table

Refactored common removal behavior in destructor
Added mutex and callback on removal on shared table

Signed-off-by: Junhwan Kim <jejudo.kim@samsung.com>
3 years ago[Filter/TFLite] enable the shared representation
Hyoung Joo Ahn [Tue, 29 Jun 2021 15:16:30 +0000 (00:16 +0900)]
[Filter/TFLite] enable the shared representation

For the specific purpose, the interpreters are need to be shared.

Signed-off-by: Hyoung Joo Ahn <hello.ahn@samsung.com>
3 years ago[Filter] add a hash table for shared key
Hyoung Joo Ahn [Tue, 29 Jun 2021 15:15:29 +0000 (00:15 +0900)]
[Filter] add a hash table for shared key

[Filter] add a hash table for shared key

Signed-off-by: Hyoung Joo Ahn <hello.ahn@samsung.com>
3 years ago[Filter/Common] declare extern
Jaeyun [Fri, 27 Aug 2021 09:29:07 +0000 (18:29 +0900)]
[Filter/Common] declare extern

Declare extern to prevent warning when using filter common functions in cpp.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[query/server] Fix possible leaks in query_server_data_free
Yongjoo Ahn [Fri, 27 Aug 2021 08:19:00 +0000 (17:19 +0900)]
[query/server] Fix possible leaks in query_server_data_free

- Free remaining TensorQueryConnection in conn_queue
- Clear error in query_connect

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Query/Sink] handle error case
Jaeyun [Thu, 26 Aug 2021 07:57:03 +0000 (16:57 +0900)]
[Query/Sink] handle error case

Fix error case, unmap memory block when failed to send data to client.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Query] Fix unnecessary unreference accepted/tizen/unified/20210826.123536 submit/tizen/20210826.061507
Gichan Jang [Tue, 24 Aug 2021 08:24:58 +0000 (17:24 +0900)]
[Query] Fix unnecessary unreference

GstBaseSink unref object after render.
So, don't need to unref out buffer.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Query] Handle tensor query meta
Gichan Jang [Fri, 20 Aug 2021 06:12:21 +0000 (15:12 +0900)]
[Query] Handle tensor query meta

 - Null check of the tensor query meta
 - Copy GstMeta of the first buffer to outbuf for collect pad.
   -> Copy policy should be updated considering multiple clients.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Query] Change property type
Gichan Jang [Wed, 25 Aug 2021 07:46:46 +0000 (16:46 +0900)]
[Query] Change property type

Change port property type to unsigned int.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Filter/Sub] add event handler for filter-fw v0
Jaeyun [Fri, 20 Aug 2021 06:16:05 +0000 (15:16 +0900)]
[Filter/Sub] add event handler for filter-fw v0

Add event handler for filter framework v0 and new event to check hw availability with custom option.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[mqtt/trivial] Fix typos in mqtt related codes
Yongjoo Ahn [Mon, 23 Aug 2021 06:30:27 +0000 (15:30 +0900)]
[mqtt/trivial] Fix typos in mqtt related codes

- Fix some minor typos in mqtt related codes

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Test] unittest pkg
Jaeyun [Wed, 18 Aug 2021 11:57:56 +0000 (20:57 +0900)]
[Test] unittest pkg

Add test directory into unittest pkg and remove generated files.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Test/Py/CodeClean] util functions to run test
Jaeyun [Fri, 20 Aug 2021 02:59:32 +0000 (11:59 +0900)]
[Test/Py/CodeClean] util functions to run test

Code clean, reduce duplicated source. Add util functions to run the unittest.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[tools/pbtxt/py] fix warning
Jaeyun [Thu, 19 Aug 2021 09:06:42 +0000 (18:06 +0900)]
[tools/pbtxt/py] fix warning

remove global variables - it complains not to set global val.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Test/bmp2png]: Fix -Werror errors after warnings level increase
Xavier Roumegue [Thu, 19 Aug 2021 13:02:51 +0000 (13:02 +0000)]
[Test/bmp2png]: Fix -Werror errors after warnings level increase

This fixes the following error, encountered with gcc 10.2:

| ../../../../../../workspace/sources/nnstreamer/tests/bmp2png.c: In function 'save_png_to_file':
| ../../../../../../workspace/sources/nnstreamer/tests/bmp2png.c:95:16: error: variable 'status' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]
|    95 |   register int status = -1;
|       |                ^~~~~~
| cc1: all warnings being treated as errors

Signed-off-by: Xavier Roumegue <xavier.roumegue@nxp.com>
3 years ago[Filter/Vivante] Fix -Werror after warnings level increase
Xavier Roumegue [Thu, 19 Aug 2021 12:59:16 +0000 (12:59 +0000)]
[Filter/Vivante] Fix -Werror after warnings level increase

This fixes the following errors:

../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c:411:50: error: unused parameter 'prop' [-Werror=unused-parameter]
  411 | vivante_close (const GstTensorFilterProperties * prop, void **private_data)
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c: In function 'vivante_invoke':
../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c:456:17: error: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned int'} [-Werror=sign-compare]
  456 |   for (i = 0; i < pdata->graph->input.num; i++) {
      |                 ^
../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c:507:17: error: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned int'} [-Werror=sign-compare]
  507 |   for (i = 0; i < pdata->graph->output.num; i++) {
      |                 ^
../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c:438:51: error: unused parameter 'prop' [-Werror=unused-parameter]
  438 | vivante_invoke (const GstTensorFilterProperties * prop,
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c: In function 'vivante_getInputDim':
../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c:538:56: error: unused parameter 'prop' [-Werror=unused-parameter]
  538 | vivante_getInputDim (const GstTensorFilterProperties * prop,
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c: In function 'vivante_getOutputDim':
../../../../../../workspace/sources/nnstreamer/ext/nnstreamer/tensor_filter/vivante/tensor_filter_subplugin.c:561:57: error: unused parameter 'prop' [-Werror=unused-parameter]
  561 | vivante_getOutputDim (const GstTensorFilterProperties * prop,
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
cc1: all warnings being treated as errors

Signed-off-by: Xavier Roumegue <xavier.roumegue@nxp.com>
3 years ago[tools/pbtxt/py] fix warning
Jaeyun [Thu, 19 Aug 2021 07:07:43 +0000 (16:07 +0900)]
[tools/pbtxt/py] fix warning

Fix warning - undefined variables.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Query] Support flexible tensors format
Gichan Jang [Thu, 12 Aug 2021 09:55:37 +0000 (18:55 +0900)]
[Query] Support flexible tensors format

Support flexible tensors format for tensor query.

Test pipeline
server:
 gst-launch-1.0 tensor_query_serversrc host=127.0.0.1 ! other/tensors,format=flexible ! tensor_query_serversink host=127.0.0.1
client:
 gst-launch-1.0 v4l2src ! videoconvert ! videoscale !  video/x-raw,width=320,height=240,format=RGB,framerate=30/1 ! tensor_converter ! other/tensors,format=flexible ! tensor_query_client src-host=127.0.0.1 sink-host=127.0.0.1 ! tensor_converter input-dim=3:320:240 input-type=uint8 ! tensor_decoder mode=direct_video ! videoconvert ! ximagesink

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[SAM/CodeClean/Py] fix pylint and syntax error
Jaeyun [Tue, 17 Aug 2021 03:19:52 +0000 (12:19 +0900)]
[SAM/CodeClean/Py] fix pylint and syntax error

Code clean, fix pylint warning and syntax error.
- indent with 4 spaces
- function name rule: lowercase
- 2 blank lines between class and function

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[LICENSE] Add SPDX reference in LICENSE file.
gichan [Tue, 17 Aug 2021 07:10:14 +0000 (16:10 +0900)]
[LICENSE] Add SPDX reference in LICENSE file.

Add SPDX license identifier reference in LICENSE file.

Signed-off-by: gichan <gichan2.jang@samsung.com>
3 years ago[tensor_query] Fix double free in tensor_query_server
Yongjoo Ahn [Wed, 18 Aug 2021 04:53:51 +0000 (13:53 +0900)]
[tensor_query] Fix double free in tensor_query_server

- Assign NULL value after call `query_server_data_free` to  prevent double free
- Remove some trailing spaces

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Query] Change GLib types to standard types.
gichan [Tue, 17 Aug 2021 02:13:52 +0000 (11:13 +0900)]
[Query] Change GLib types to standard types.

 - Change type of the port from uint32 to uint16.
 - Change Glib types to standard types.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Query] Add address resolver for server
gichan [Fri, 13 Aug 2021 07:13:42 +0000 (16:13 +0900)]
[Query] Add address resolver for server

Add address resolver for server.

Signed-off-by: gichan <gichan2.jang@samsung.com>
3 years ago[Filter/Sub] unnecessary log to get subplugin from ini
Jaeyun [Tue, 17 Aug 2021 09:56:46 +0000 (18:56 +0900)]
[Filter/Sub] unnecessary log to get subplugin from ini

Remove unnecessary log while loading sub-plugins from conf file.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Query] Fix resource leak
Gichan Jang [Wed, 18 Aug 2021 01:59:19 +0000 (10:59 +0900)]
[Query] Fix resource leak

Fix resource leaks reported by coverity.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Build] Set 'filter-aliases' option for trix-engine
Sangjung Woo [Wed, 11 Aug 2021 07:40:25 +0000 (16:40 +0900)]
[Build] Set 'filter-aliases' option for trix-engine

The sub-plugin name of SRNPU is changed to trix-engine. So this patch
add 'trix-engine = srnpu' option in 'filter-aliases' field to provide
backward compatibility.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
3 years ago[Filter/Sub] Support 'filter-aliases' option
Sangjung Woo [Wed, 11 Aug 2021 07:36:46 +0000 (16:36 +0900)]
[Filter/Sub] Support 'filter-aliases' option

This patch supports the 'filter-aliases' option for searching the
sub-plugin. For example, if 'tf = tensorflow' option is given,
application developers can use 'framework = tf' in pipeline description
to use 'tensorflow' sub-plugin.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
3 years ago[fix/build] Fix build error unused vars
Yongjoo Ahn [Tue, 17 Aug 2021 04:59:26 +0000 (13:59 +0900)]
[fix/build] Fix build error unused vars

- Fix unused var build error in tensorrt related codes

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Query] res leak
Jaeyun [Fri, 13 Aug 2021 05:41:06 +0000 (14:41 +0900)]
[Query] res leak

Code clean, fix possible res leak and invalid param.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Query] Update server elements
Junhwan Kim [Tue, 10 Aug 2021 13:07:06 +0000 (22:07 +0900)]
[Query] Update server elements

Update query serversrc, serversink & meta-query
Src accepts connection from clients receiving messages such as
- Request Info : send back to client w/ src tensor config
- Start : indicates beginning of data transfer
- Data : contains tensor data
- End : ends transfer

Sink can identify client by meta-query, which contains host address
Sink sends transformed tensor by same policy

Example pipeline
```
gst-launch-1.0 tensor_query_serversrc host=127.0.0.1 ! other/tensors,num_tensors=1,dimensions=3:300:300:1,types=uint8,framerate=30/1 ! tensor_query_serversink host=127.0.0.1

gst-launch-1.0 v4l2src ! videoconvert ! videoscale ! video/x-raw,width=300,height=300,format=RGB,framerate=30/1 ! tensor_converter ! tensor_query_client src-host=127.0.0.1 sink-host=127.0.0.1 ! tensor_decoder mode=direct_video ! videoconvert ! ximagesink
```

Signed-off-by: Junhwan Kim <jejudo.kim@samsung.com>
3 years ago[Query/common] Update server to handle multi-clients
Junhwan Kim [Tue, 10 Aug 2021 12:56:39 +0000 (21:56 +0900)]
[Query/common] Update server to handle multi-clients

Query server should be capable of serving multi-clients
Update asynchronous handler to accept async connection

Signed-off-by: Junhwan Kim <jejudo.kim@samsung.com>
3 years ago[Query] Implement tensor query client
Gichan Jang [Wed, 11 Aug 2021 01:03:55 +0000 (10:03 +0900)]
[Query] Implement tensor query client

Implement tensor query client.
todo: support various protocols, error handling

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Repo] remove meta
Jaeyun [Mon, 9 Aug 2021 09:03:21 +0000 (18:03 +0900)]
[Repo] remove meta

Gstreamer-meta in tensor repo only handles pad caps. Move caps into repo-data and remove repo-meta info.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Query] Implement common utils for TCP
Junhwan Kim [Tue, 3 Aug 2021 08:32:17 +0000 (17:32 +0900)]
[Query] Implement common utils for TCP

Common API functions used for both client and server elements
Currently based on TCP connections

TODO
- Enable timeout

Signed-off-by: Junhwan Kim <jejudo.kim@samsung.com>
3 years ago[Gst/Mqtt] Resolve compiler warnings
Gichan Jang [Mon, 9 Aug 2021 02:58:32 +0000 (11:58 +0900)]
[Gst/Mqtt] Resolve compiler warnings

Resolve compiler warnings.
 - Unused parameter
 - Different type comparison

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Filter] Rename srnpu to trix-engine accepted/tizen/unified/20210810.135401 submit/main/20210806.045326 submit/tizen/20210806.045403 submit/tizen/20210809.021120
Sangjung Woo [Wed, 4 Aug 2021 05:38:18 +0000 (14:38 +0900)]
[Filter] Rename srnpu to trix-engine

The patch update the name 'srnpu' to 'trix-engine'.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
3 years ago[Config/Format] tensor format in config
Jaeyun [Tue, 20 Jul 2021 10:00:37 +0000 (19:00 +0900)]
[Config/Format] tensor format in config

Set tensor format from caps struct.
tensor stream has single format, so format in tensor-info struct is unnecessary.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years agoTFLite: Allow to skip flatbuf dep check
MyungJoo Ham [Wed, 4 Aug 2021 02:26:43 +0000 (11:26 +0900)]
TFLite: Allow to skip flatbuf dep check

In Yocto build, it appears that flatbuf dep check
is not available:
https://github.com/nnstreamer/meta-neural-network/blob/master/recipes-nnstreamer/nnstreamer/files/0001-Disable-flatbuf-check-for-tf-lite-for-yocto-build.patch

@anyj0527 : Let's remove all *.patch files from
meta-neural-network by updating related nnstreamer/*.git
*.patch files in meta-neural-network are obvious
hazards.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years ago[filter/SNAP] Add TensorFlow Lite support
Yongjoo Ahn [Mon, 2 Aug 2021 11:13:54 +0000 (20:13 +0900)]
[filter/SNAP] Add TensorFlow Lite support

- SNAP v3.0 supports inference with TensorFlow Lite.
- Add the supported enum.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Subplugin/Py] prevent resizing the array length
Jaeyun [Mon, 2 Aug 2021 02:30:22 +0000 (11:30 +0900)]
[Subplugin/Py] prevent resizing the array length

In the sub-plugins for python, prevent resizing the array length when creating new array object.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Doc] Add serialized buffer description
gichan [Tue, 3 Aug 2021 01:15:42 +0000 (10:15 +0900)]
[Doc] Add serialized buffer description

Add serialized buffer description.(flatbuf, protobuf, flexbuf)

Signed-off-by: gichan <gichan2.jang@samsung.com>
3 years ago[Test/Ubuntu] add nnfw test
Jaeyun [Tue, 27 Jul 2021 06:20:52 +0000 (15:20 +0900)]
[Test/Ubuntu] add nnfw test

enable nnfw subplugin test in ubuntu build.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Converter/Py] mem size
Jaeyun [Thu, 29 Jul 2021 07:29:53 +0000 (16:29 +0900)]
[Converter/Py] mem size

set memory size from mapped info, not buffer size.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Build] fix build error
Jaeyun [Fri, 30 Jul 2021 11:07:32 +0000 (20:07 +0900)]
[Build] fix build error

Fix build error after changing warning level.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years agoDIST (rpm/deb): add nnstreamer-util.h
MyungJoo Ham [Wed, 28 Jul 2021 09:20:13 +0000 (18:20 +0900)]
DIST (rpm/deb): add nnstreamer-util.h

The newly introduced external header should be
included in devel package.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoStyle fix of gst-indent
MyungJoo Ham [Wed, 28 Jul 2021 08:21:01 +0000 (17:21 +0900)]
Style fix of gst-indent

With a lot of files modified by previous "warning fix" commit,
unrelated style fixes are required.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoIncrease warning level and resolve compiler warnings.
MyungJoo Ham [Tue, 27 Jul 2021 10:31:11 +0000 (19:31 +0900)]
Increase warning level and resolve compiler warnings.

1. Increase warning level of meson from 1 --> 2.
2. Resolve all warnings.

TODO: Increase warning level further.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoCommon: add a common util header.
MyungJoo Ham [Wed, 28 Jul 2021 08:18:01 +0000 (17:18 +0900)]
Common: add a common util header.

For nnstreamer developers including sub-plugin writers,
provide a common nnstreamer utility header that does not
depend on additional libraries.

TODO: migrate such functions from other external headers.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoTransform: ignore warnings from generated files.
MyungJoo Ham [Wed, 28 Jul 2021 01:18:22 +0000 (10:18 +0900)]
Transform: ignore warnings from generated files.

For the increased warning level, add a script to ignore
warnings from generated C files.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years ago[Test] fix res leak
Jaeyun [Thu, 29 Jul 2021 06:09:07 +0000 (15:09 +0900)]
[Test] fix res leak

fix res leak in tvm testcase.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years agoMove nnstreamer_example to tests/
MyungJoo Ham [Wed, 28 Jul 2021 09:17:23 +0000 (18:17 +0900)]
Move nnstreamer_example to tests/

With nnstreamer_example directory at the top,
some users are confused and thought that this directory
is the official nnstreamer example apps.

However, these are merely example codes for unit tests;
thus, they should be moved into tests to prevent
the confusion.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoCommon: refactor silent_debug() and make it common
MyungJoo Ham [Thu, 15 Jul 2021 07:44:28 +0000 (16:44 +0900)]
Common: refactor silent_debug() and make it common

1. Provide common macro of silent_debug and silent_debug_caps,
 which had been repeatedly defined in each plugin.
2. Refactor the two macros to get "object" as an argument
 so that it wouldn't use implicit argument exceot for "DBG".

The same macros are not touched in /ext directory
because they are not supposed to include "tensor_common.h",
which is an internal header.

@todo There are a few subplugins in /ext (not tensor-filter)
that uses "tensor_common.h". They should be refactored not to
use internal headers so that we can separate them to
independent repo anytime. Although we don't have such plans,
we need to keep them as appropriate examples for users.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years ago[Common] remove tensor-config struct
Jaeyun [Wed, 7 Jul 2021 08:40:16 +0000 (17:40 +0900)]
[Common] remove tensor-config struct

Remove tensor-config struct (for single tensor) and replace it to tensors-config.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Query] Define tensor query common data structures.
Gichan Jang [Thu, 22 Jul 2021 05:17:23 +0000 (14:17 +0900)]
[Query] Define tensor query common data structures.

Re-define tensor query common data structures.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[TVM/test] Add models for more architectures
Junhwan Kim [Fri, 16 Jul 2021 10:59:24 +0000 (19:59 +0900)]
[TVM/test] Add models for more architectures

Add tvm test models to support test on arm and aarch64

Signed-off-by: Junhwan Kim <jejudo.kim@samsung.com>
3 years ago[Test] update testcases about changed caps
Jaeyun [Mon, 5 Jul 2021 11:14:02 +0000 (20:14 +0900)]
[Test] update testcases about changed caps

Old mime type for flex-tensor is removed, and added format in caps string.
Fix all related testcases.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Caps/Format] add tensor format in caps
Jaeyun [Mon, 5 Jul 2021 11:05:16 +0000 (20:05 +0900)]
[Caps/Format] add tensor format in caps

Add tensor format in caps.
Fix pad template with flex tensor and remove old mimetype.
Now caps string for flex-tensor has framerate field.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[SparseTensor] Define SparseTensor and API
Yongjoo Ahn [Wed, 16 Jun 2021 04:27:00 +0000 (13:27 +0900)]
[SparseTensor] Define SparseTensor and API

- Define a tensor_format for SparseTensor
- Define a info structure for SparseTensor which has "length" of
  non-zero elements
- Add a internal header `tensor_sparse_util.h` for util functions that
  will be used in related elements
- Add a union in GstTensorMetaInfo for SparseTensor

SparseTensors could be more efficient on processing of tensors that
contain a lot of zero values.
I'll adopt the coordinate list (COO) format for encoding it, same as
other NN frameworks.

The COO encoding for sparse tensors is comprised of REF:
(https://www.tensorflow.org/guide/sparse_tensor):

values: A 1D tensor with shape [N] containing all nonzero values.
indices: A 2D tensor with shape [N, rank], containing the indices of the
nonzero values.
dense_shape: A 1D tensor with shape [rank], specifying the shape of the
tensor.

For example a Tensor
```
[[1, 0, 0, 0]
 [0, 0, 2, 0]
 [0, 0, 0, 0]]
```
can be encoded as
```
SparseTensor(values=[1, 2], indices=[[0, 0], [1, 2]], dense_shape=[3, 4])
```

In our project, a SparseTensor should be encoded with these information:
```cpp
tensor_type   data_type;
tensor_dim    dense_shape;
unsigned int  nnz; /* the number of non-zero elements */
data_type     values[nnz];
unsigned int  indices[nnz][RANK_LIMIT];
```

Since data_type and dense_shape are could be represented in `GstTensorMetaInfo`,
Add a `GstSparseTensorInfo`, and let it have the `nnz` (number of non-zeros).
The values and indices are stored in a single memory chunk, and the
`nnz` information would be used for parsing the buffer.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[Build/Deb] dependency to NNFW
Jaeyun [Tue, 20 Jul 2021 10:57:09 +0000 (19:57 +0900)]
[Build/Deb] dependency to NNFW

Add new pkg for NNFW (ONE) in debian build.

Related issue: https://github.com/Samsung/ONE/issues/7196

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years agoPaho-mqtt: enable to use paho-mqtt w/o pkgconfig submit/tizen/20210723.070532
MyungJoo Ham [Fri, 9 Jul 2021 06:46:04 +0000 (15:46 +0900)]
Paho-mqtt: enable to use paho-mqtt w/o pkgconfig

In case pkgconfig is not available for paho-mqtt,
prepare hardcoded library dependencies for paho-mqtt.

However, using this hardcoded dependency is not recommended
and using pkgconfig files is already recommended.

paho-mqtt build is force-enabled for Debian, too.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoDebian: add debian release changelog for Sid
MyungJoo Ham [Wed, 7 Jul 2021 10:53:39 +0000 (19:53 +0900)]
Debian: add debian release changelog for Sid

Add Debian Sid as debian release target.
Sid is the "devel" version of Debian.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoDebian: enable armnn in Sid.
MyungJoo Ham [Mon, 5 Jul 2021 06:55:59 +0000 (15:55 +0900)]
Debian: enable armnn in Sid.

Debian-Sid has armnn without pkgconfig.
Allow to use armnn without pkgconfig file.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoMeson: use flatbuf if it's >= 2.0.0
MyungJoo Ham [Mon, 5 Jul 2021 05:19:29 +0000 (14:19 +0900)]
Meson: use flatbuf if it's >= 2.0.0

Restrict flatbuf version to 2.0.0 or higher.
Older flatbuf incurs test case errors.
Disable related test cases, too.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoUbuntu: Xenial build fail with pdebuild fixed.
MyungJoo Ham [Mon, 5 Jul 2021 03:30:30 +0000 (12:30 +0900)]
Ubuntu: Xenial build fail with pdebuild fixed.

Xenial appears to identify build-deps before dh_clean.
Keep Ubuntu-Xenial control file as default for this issue.

In Ubuntu-Bionic or Debian-Sid, there is no such issues.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoDebian: disable edge-tpu and openvino.
MyungJoo Ham [Mon, 5 Jul 2021 03:06:53 +0000 (12:06 +0900)]
Debian: disable edge-tpu and openvino.

Debian does not have edge-tpu or openvino ready, yet.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoDebian: skip SSAT for Debian
MyungJoo Ham [Mon, 5 Jul 2021 02:50:09 +0000 (11:50 +0900)]
Debian: skip SSAT for Debian

We have not duploaded SSAT for Debian.
Skip SSAT for Debian.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoDebian: draft Debian distro build files.
MyungJoo Ham [Thu, 1 Jul 2021 02:00:51 +0000 (11:00 +0900)]
Debian: draft Debian distro build files.

Provided packages are a bit different between Ubuntu and Debian.
Provide a different control file for Debian builds.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoDebian: multiple control files for different distros.
MyungJoo Ham [Wed, 30 Jun 2021 09:35:20 +0000 (18:35 +0900)]
Debian: multiple control files for different distros.

Build-deps cannot be dynamically replaced per distro.
Thus, we need to prepare multiple control files and
slap in appropriate control files with rules.

This allow to prepare Debian and Ubuntu simultaneously.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years ago[Coverity/MQTT/Sink] Fix a critical Coverity defect (WGID 1238814)
Wook Song [Thu, 22 Jul 2021 04:29:11 +0000 (13:29 +0900)]
[Coverity/MQTT/Sink] Fix a critical Coverity defect (WGID 1238814)

This patch fixes a critical Coverity defect (WGID 1238814), which is
tagged as FORWARD_NULL, in the GstMQTTSink plugin.

Signed-off-by: Wook Song <wook16.song@samsung.com>