platform/upstream/nnstreamer.git
5 years ago[Orc] remove unnecessary code
Jaeyun [Mon, 22 Apr 2019 10:09:13 +0000 (19:09 +0900)]
[Orc] remove unnecessary code

We don't need to init orc functions.
It will be called when creating new orc program.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Split] code clean
Jaeyun [Thu, 18 Apr 2019 03:51:34 +0000 (12:51 +0900)]
[Split] code clean

remove warning, change function and val names, and code clean.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Split] exception to get property
Jaeyun [Wed, 17 Apr 2019 11:46:21 +0000 (20:46 +0900)]
[Split] exception to get property

check null ptr to get the property tensorseg

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Test/Repo] remove unnecessary header
Jaeyun [Thu, 18 Apr 2019 08:31:48 +0000 (17:31 +0900)]
[Test/Repo] remove unnecessary header

1. In testcase of tensor-repo test, it does not need to include repo header.
2. Code clean tensor-repo src/sink

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Build] remove warning
Jaeyun [Thu, 18 Apr 2019 11:56:52 +0000 (20:56 +0900)]
[Build] remove warning

update changes to remove warning message

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[SVACE] Addressess memory leaks
Parichay Kapoor [Thu, 18 Apr 2019 07:31:34 +0000 (16:31 +0900)]
[SVACE] Addressess memory leaks

Resolved memory leaks given by svace for src_iio code as well as tests

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Coverity] Resolved negative returns issue
Parichay Kapoor [Thu, 18 Apr 2019 07:06:12 +0000 (16:06 +0900)]
[Coverity] Resolved negative returns issue

Negative returns: negative value used as argument to a function
expecting a postive value

Resolved with an assert

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Coverity] Resolved memory leaks
Parichay Kapoor [Thu, 18 Apr 2019 06:41:19 +0000 (15:41 +0900)]
[Coverity] Resolved memory leaks

Resource Leak : Leak of memory or pointers to system resources

Resolved with free data pointers

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Coverity] Resolved TOCTOU issuse from coverity
Parichay Kapoor [Thu, 18 Apr 2019 06:30:16 +0000 (15:30 +0900)]
[Coverity] Resolved TOCTOU issuse from coverity

TOCTOU issue : A check occurs on a file's attributes before the file
is used in a priveleged operation, but things may have changed.

Removed file test operation and using stat as a single check operation
as well as file size reading operation.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Tizen/API] Add testcase about src node
Sangjung Woo [Wed, 17 Apr 2019 05:22:43 +0000 (14:22 +0900)]
[Tizen/API] Add testcase about src node

In order to increase test coverage, this patch additionally adds some
test cases for src node.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
5 years ago[Tizen/API] Update the comment about nns_pipeline_src_puthandle()
Sangjung Woo [Wed, 17 Apr 2019 02:42:57 +0000 (11:42 +0900)]
[Tizen/API] Update the comment about nns_pipeline_src_puthandle()

This patch updates the header comment of nns_pipeline_src_puthandle()
API. Detailed items are as below.

* Add the omitted return value NNS_ERROR_TRY_AGAIN.
* Set policy as `in` parameter instead of `out` parameter.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
5 years ago[Transform/Orc] data ptr in orc function
Jaeyun [Mon, 15 Apr 2019 11:17:03 +0000 (20:17 +0900)]
[Transform/Orc] data ptr in orc function

For add,mul,div op in orc functions, use single array ptr to handle operator.

Orc generated functions have __restrict__ ptr, the pointers overlapping memory regions may cause an error.

To avoid this, pass single array ptr to handle each operator.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[IIO] Refactor sampling frequency handling
Parichay Kapoor [Fri, 12 Apr 2019 11:34:40 +0000 (20:34 +0900)]
[IIO] Refactor sampling frequency handling

1. Refactored handling sampling frequency
2. Added more cases for sampling frequency when files dont exist
3. Renamed functions for better understanding

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Tizen/API] Remove dependency 'tensor_typedef.h'
Sangjung Woo [Mon, 15 Apr 2019 03:55:11 +0000 (12:55 +0900)]
[Tizen/API] Remove dependency 'tensor_typedef.h'

In order to pass the ACR process, 'tensor_typedef.h' in tizen-api.h
should be removed and its related thing also be updated. This patch
handles that issue. Detailed modification are as below.

* Remove dependency for 'nnstreamer/tensor_typedef.h' header
* Add necessary constant and enum variables such as
  NNS_TENSOR_RANK_LIMIT and nns_tensors_info.
* Use nns_tensors_info structure instead of GstTensorsInfo

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
5 years ago[IIO] added more documentation
Parichay Kapoor [Fri, 12 Apr 2019 10:52:08 +0000 (19:52 +0900)]
[IIO] added more documentation

- Updated README.md
- Added section description for the element

V2:
supports -> support

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Build/C-Api] clean build script
Jaeyun [Fri, 12 Apr 2019 07:06:52 +0000 (16:06 +0900)]
[Build/C-Api] clean build script

remove unnecessary dep declare and fix typo

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[IIO] Custom channel index number as input
Parichay Kapoor [Wed, 10 Apr 2019 05:25:33 +0000 (14:25 +0900)]
[IIO] Custom channel index number as input

Added the option for user to specify custom channel number as input
to enable specific channels.
Added test case for custom channel index as well.

V2:
Using hash table for custom channel setting

V3:
Updated property description spec with better format

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[PythonFilter/Subplugin] Add a subplugin for Python custom filters
Dongju Chae [Thu, 11 Apr 2019 09:32:39 +0000 (18:32 +0900)]
[PythonFilter/Subplugin] Add a subplugin for Python custom filters

It's a nnstreamer subplugin for custom filters written in Python.
It supports both Python 2 and 3.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[CONF] remove unnecessary free
Parichay Kapoor [Fri, 12 Apr 2019 06:34:38 +0000 (15:34 +0900)]
[CONF] remove unnecessary free

Remove unnecessary free that caused error with valgrind

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] Using case insensitive string comparison
Parichay Kapoor [Fri, 12 Apr 2019 04:37:35 +0000 (13:37 +0900)]
[IIO] Using case insensitive string comparison

Using case insensitive string comparison for property decision

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] bugfixes related to errors from yocto run
Parichay Kapoor [Fri, 12 Apr 2019 02:13:00 +0000 (11:13 +0900)]
[IIO] bugfixes related to errors from yocto run

1. set base src as async, resolves the error of hanging
  without setting base_src as async, _start_complete gets called twice
2. initializing log_file to NULL
3. NULL check for variable before using it for remove/rmdir
4. remove _query function, was incomplete, and complete function
  was same as parent class function

resolve #1353

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[PythonFilter/API] Add a python module to provide NNS-related APIs
Dongju Chae [Thu, 11 Apr 2019 08:27:58 +0000 (17:27 +0900)]
[PythonFilter/API] Add a python module to provide NNS-related APIs

It's a python module which a user will import in a python script.
Currently, only 'TensorShape' type object is supported.
I am currently considering other useful APIs.

Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
5 years ago[IIO] Enable/Disable buffer at correct state
Parichay Kapoor [Tue, 9 Apr 2019 03:31:36 +0000 (12:31 +0900)]
[IIO] Enable/Disable buffer at correct state

Enabling/Disabling buffer when going from PAUSED to PLAYING state.
This might lead to higher latency but provides latest and correct data.
Enabling in READY to PAUSED can lead to accumulation of frames before playing
and result in unreal latency as well as old data.
This commit will also sync gst timing with iio device time.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] Added more test cases with corresponding bug fixes
Parichay Kapoor [Tue, 9 Apr 2019 02:59:54 +0000 (11:59 +0900)]
[IIO] Added more test cases with corresponding bug fixes

1. Added test cases for
  - caps verification
  - default restoration
  - setting trigger with number
  - using generic scan element type
  - auto enable channels
2. Corresponding bug fixes

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Tizen/API] TestCase add. "src"
MyungJoo Ham [Tue, 9 Apr 2019 08:06:39 +0000 (17:06 +0900)]
[Tizen/API] TestCase add. "src"

Add unit test cases for Tizen/C-API/Main/source

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Tizen/API] Fix pipeline-src implementation
MyungJoo Ham [Tue, 9 Apr 2019 08:04:24 +0000 (17:04 +0900)]
[Tizen/API] Fix pipeline-src implementation

- Return TensorsInfo with get-src-handle
- Fix src-inputdata with TensorsInfo caching mechanism

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Build/Android] add common definition
Jaeyun [Thu, 11 Apr 2019 06:10:48 +0000 (15:10 +0900)]
[Build/Android] add common definition

define common features to build nnstreamer library for android

TODO: update mk files in nnstreamer-example later

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[IIO] Added more test cases
Parichay Kapoor [Fri, 5 Apr 2019 05:30:10 +0000 (14:30 +0900)]
[IIO] Added more test cases

1. Added test cases when only some of the channels are enabled
2. Bug fix in test case for indexing when filling in data
3. Added test case for using device number and testing name-by-id

V2:
1. Unref the pipeline to invoke finalize()
2. Pipeline variable renamed from src_iio to src_iio_pipeline

V3:
- Integer divide precision updated

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] Added data validity testcases
Parichay Kapoor [Thu, 4 Apr 2019 08:19:00 +0000 (17:19 +0900)]
[IIO] Added data validity testcases

1. Added test case to check data validity for the element for various data bytes sizes
2. Added a property of timeout while reading file in non-blocking mode.
This allows looping while reading the file along with EAGAIN error.
3. Corrected mask generation
4. IIO dev file is replaced with fifo. Using threads to make these fifo as
opening it blocks unless both read and write mode are opened together.
5. Added test case to validate data with and without trigger.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Tizen/API] Update header file to comply with Tizen API rule
Sangjung Woo [Tue, 9 Apr 2019 04:48:57 +0000 (13:48 +0900)]
[Tizen/API] Update header file to comply with Tizen API rule

In order to comply with the checklist of Tizen API, this patch modifies
a user header file, which is actually included in the code. Detailed
items of modification are as below.

* Add a period "." at the end of @brief.
* Values NNS_ERROR_PIPELINE_FAIL and TIZEN_ERROR_STREAMS_PIPE have
  different suffixes.
* No description in enum variables.
* Enum names should end with '_e'.
* Please use @param[in], @param[out] or @param[in,out]

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
5 years ago[Filter/TF] refcount of tf-buffer
Jaeyun [Mon, 8 Apr 2019 04:56:49 +0000 (13:56 +0900)]
[Filter/TF] refcount of tf-buffer

With mem-optimized flag, always unref tf-buffer after making tensor with passed input data.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Demux] fix invalid pad index
Jaeyun [Mon, 8 Apr 2019 09:45:20 +0000 (18:45 +0900)]
[Demux] fix invalid pad index

1. fix invalid src pad index in tensor-demux
2. add simple testcase for the properties and tensorpick option

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Tizen/API] bugfix when passing a wrong pipeline command
Sangjung Woo [Mon, 8 Apr 2019 04:54:03 +0000 (13:54 +0900)]
[Tizen/API] bugfix when passing a wrong pipeline command

If passing a wrong pipeline command such as non-existent element or
erroneous pipeline, assertion failure occurs in
nns_pipeline_construct(). This is mainly because gst_parse_launch()
could return non-NULL even though the error is set. So this patch checks
both the return value and GError value.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
5 years ago[Test:Tizen/API] Add pipeline failure test
Sangjung Woo [Mon, 8 Apr 2019 04:44:08 +0000 (13:44 +0900)]
[Test:Tizen/API] Add pipeline failure test

This patch newly adds the pipeline failure tests when passing the wrong
pipeline command such as non-existent element or erroneous pipeline.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
5 years ago[Test] checking opencv availability at runtime
Parichay Kapoor [Fri, 5 Apr 2019 06:44:00 +0000 (15:44 +0900)]
[Test] checking opencv availability at runtime

Added option to check opencv availability at runtime.
This simplify meson.build in nnstreamer_example.
Also added verification of the model before running the test.

Resolves #1332

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] refactor _start()
Parichay Kapoor [Fri, 5 Apr 2019 07:36:48 +0000 (16:36 +0900)]
[IIO] refactor _start()

Refactored _start for code maintainability and understanding.
Resolves #1300

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Test/Coverage] update source path
Jaeyun [Fri, 5 Apr 2019 10:25:51 +0000 (19:25 +0900)]
[Test/Coverage] update source path

1. exclude tests directory in test coverage
2. set full path to get coverage report
3. print valid path while processing coverage report
4. remove unnecessary flag and clean meson script

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years agoBUILD: Support nodebug option for gbs build
Geunsik Lim [Tue, 2 Apr 2019 03:48:42 +0000 (12:48 +0900)]
BUILD: Support nodebug option for gbs build

Fixed issue #1314.

This commit is to support optional flag to skip the generation of debug packages
to speed up a build time and to save a storage cost. In case that developers
have to do a debugging the source code with gdb, they may change the value of
the 'skipdebug' from 1 to 0.

**Changes**
V2:
 - Added "--define '_skip_debug_rpm 1'"
   : https://github.com/nnsuite/TAOS-CI/blob/master/ci/taos/plugins-base/pr-audit-build-tizen.sh#L84

V1:
 - Added optional flag to do not generate debug package

Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
5 years ago[Converter] add option about supported media type
Jaeyun [Tue, 12 Mar 2019 07:58:33 +0000 (16:58 +0900)]
[Converter] add option about supported media type

1. add meson option to disable video support.
tensor-converter will not get the video if video-support disabled.
2. add macros for media format and info to disable audio/video stream.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Coverity 1050275] Unchecked return value Tizen5.5-M1-RC1 accepted/tizen/unified/20190405.015717 submit/tizen/20190404.070309
Parichay Kapoor [Thu, 4 Apr 2019 01:33:21 +0000 (10:33 +0900)]
[Coverity 1050275] Unchecked return value

This solves the unchecked return value issue in destory_dev_dir():
Value returned from a library is not checked for error before being used.

remove/rmdir will return with failure if the file/dir does not exist.
added safe_remove/rmdir to delete a file without checking for validity.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Test] fix coverity 1050278, 1035696
Jaeyun [Wed, 3 Apr 2019 06:48:47 +0000 (15:48 +0900)]
[Test] fix coverity 1050278, 1035696

check return result of mem map

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Test] add testcase for filter-properties
Jaeyun [Wed, 3 Apr 2019 04:45:21 +0000 (13:45 +0900)]
[Test] add testcase for filter-properties

add testcase to get tensor-filter properties

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[TEST/Decoder/BoundingBox] Add ssat unit test cases
MyungJoo Ham [Tue, 2 Apr 2019 10:11:37 +0000 (19:11 +0900)]
[TEST/Decoder/BoundingBox] Add ssat unit test cases

To increase code coverage of tensor-decoder extensions

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Filter/Test] add failure testcase
Jaeyun [Tue, 2 Apr 2019 09:40:33 +0000 (18:40 +0900)]
[Filter/Test] add failure testcase

add testcases for invalid tensor properties

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Filter] remove assertion
Jaeyun [Tue, 2 Apr 2019 09:39:22 +0000 (18:39 +0900)]
[Filter] remove assertion

remove assertion while loading model info and doing caps negotiation.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[IIO] Removing fileno() accepted/tizen/unified/20190404.022039 submit/tizen/20190403.111722
Parichay Kapoor [Mon, 1 Apr 2019 05:26:23 +0000 (14:26 +0900)]
[IIO] Removing fileno()

Removed usage of fileno to file descriptor to compile without error with C89
as fileno() requires _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE

Using open() from fcntl directly instead of fopen() and fileno() combined
Resolves issue #1293

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Coverity 1050026,1049988] Branch Past Initialization
Parichay Kapoor [Wed, 3 Apr 2019 03:42:14 +0000 (12:42 +0900)]
[Coverity 1050026,1049988] Branch Past Initialization

This fixes branch past initialization (transfer of control bypasses initialization) at two incidents

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Coverity 1049985,1049986] Branch Past Initialization
Parichay Kapoor [Wed, 3 Apr 2019 03:27:21 +0000 (12:27 +0900)]
[Coverity 1049985,1049986] Branch Past Initialization

This fixes branch past initialization (transfer of control bypasses initialization) at two incidents

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Unittest] add install unittest
jijoong.moon [Wed, 3 Apr 2019 02:13:27 +0000 (11:13 +0900)]
[Unittest] add install unittest

Add installation of ssat unittest cases according to install-test
option.

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
5 years ago[Common] Add other/tensors parsing rule.
MyungJoo Ham [Tue, 2 Apr 2019 10:06:40 +0000 (19:06 +0900)]
[Common] Add other/tensors parsing rule.

dimensions and types are not deliminated by both '.' and ','.
It is to support GstCap (CapsFilter) with other/tensors string
expressions.

Note that ... ! other/tensors,types=float32,int32 !...
is not supported. We need to use . instead in such cases.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Coverity 1049998/1050018] Fix useless keyword
MyungJoo Ham [Wed, 3 Apr 2019 00:56:23 +0000 (09:56 +0900)]
[Coverity 1049998/1050018] Fix useless keyword

const of const gboolean func() is useless.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Coverity 1050275] Unchecked return value
Parichay Kapoor [Wed, 3 Apr 2019 03:58:48 +0000 (12:58 +0900)]
[Coverity 1050275] Unchecked return value

This fixes the error of unchecked return value upon deletion of directory structure.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Coverity 1050274,1050277][SVACE/414964] Array out of bound
MyungJoo Ham [Wed, 3 Apr 2019 00:48:38 +0000 (09:48 +0900)]
[Coverity 1050274,1050277][SVACE/414964] Array out of bound

This fixes array out of bound access found by the three incidents.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Filter] remove ip mode vmethod submit/tizen/20190402.101945
Jaeyun [Tue, 2 Apr 2019 04:29:10 +0000 (13:29 +0900)]
[Filter] remove ip mode vmethod

In tensor-filter, ip-mode vmethod is unnecessary.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[IIO] restore iio device on _stop()
Parichay Kapoor [Thu, 28 Mar 2019 11:36:43 +0000 (20:36 +0900)]
[IIO] restore iio device on _stop()

restore the existing values of scan_channels_en, sampling_frequency,
buffer/length and current trigger (if exist) when stopping the element

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] Restriction on changing element properties
Parichay Kapoor [Mon, 1 Apr 2019 04:26:27 +0000 (13:26 +0900)]
[IIO] Restriction on changing element properties

Element should be in state NULL or READY for the property of the device to be changed.
If the state is PAUSED/READY, properties cant be changed as the updated properties cannot
be reflected without the element going back to READY state.
Added freeing of properties before re-setting them.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] Support device number, filled _finalize()
Parichay Kapoor [Thu, 28 Mar 2019 04:45:01 +0000 (13:45 +0900)]
[IIO] Support device number, filled _finalize()

1. Support device/trigger number as input, added corresponding test case as well
2. Set proper max limit on buffer capacity and frequency
3. Filled _finalize()

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[SVACE/414949] Fix 65505047 Warning
jijoong.moon [Mon, 1 Apr 2019 08:07:40 +0000 (17:07 +0900)]
[SVACE/414949] Fix 65505047 Warning

Line 448 of unittest_common.cpp has svace warning:

WID:65505047 Return value of a function 'fopen64' is dereferenced at
unittest_common.cpp:448 without checking, but it is usually checked
for this function (8/9).

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
5 years ago[IIO] removed blocksize, merging with inner dimension
Parichay Kapoor [Thu, 28 Mar 2019 07:49:40 +0000 (16:49 +0900)]
[IIO] removed blocksize, merging with inner dimension

1. Removed blocksize (merging multiple buffers of data together). Use tensor_aggregator for this functionality
2. Merging of tensors is done with innermost dimension (merging on outermost dimension introduced reduntant dimensions)
3. Bugfix:
  - buffer size scaled by buffer_capacity
  - data rate_d set to buffer_capacity
4. Moved one-shot mode todo - no support for one-shot mode now

V2:
Added direction for merging the tensor

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[TENSORS] No need the tests/nnstreamer_tensors
jijoong.moon [Fri, 29 Mar 2019 04:36:15 +0000 (13:36 +0900)]
[TENSORS] No need the tests/nnstreamer_tensors

Test case, nnstreamer_tensors are not needed anymore. It was written
just for the temperal check of possibility of meta in the buffer.

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
5 years agotest cases for state change and corresponding bug fixes
Parichay Kapoor [Wed, 27 Mar 2019 06:35:51 +0000 (15:35 +0900)]
test cases for state change and corresponding bug fixes

1. Created virtual iio device to test against
2. Added test case to test state change from NULL to PLAYING and backwards
3. Bug fixes-
  3.1 setting of fixated caps moved to _fixating() from _start()
  3.2 channel property list memory issue resolved
  3.3 missing sampling frequency file while setting it is now a warning
      skip to default frequency if file is not present
  3.4 More minor bug fixes
4. IIO base directories moved to header file
  These directories are modified to temporary location when testing with simulated device

V2:
- BugFix:
  - updated condition check for sampling_frequency
  - updated freeing channel list while filtering enabled channels
  - declaration following C89
- Moved fixating of caps to _fixate(). This removes unnecessary storage of fixated_caps
  and calculating fixated caps in _fixate() makes code more readable

V3:
- replaced stdio.h with glib/gprintf.h

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[YOCTO] Modified unittest directory for installation & runn
jijoong.moon [Wed, 20 Mar 2019 06:58:58 +0000 (15:58 +0900)]
[YOCTO] Modified unittest directory for installation & runn

Because there are test cases incluiding absolute path for library, it
is hard to run unit testcases after installation. In this PR, these
testcases and nnstreamer_example libraries are installed
/usr/lib/nnstreamer/unittest. For the nnstreamer_example, libraries
are in /usr/lib/nnstreamer/unittest/nnstreamer_exampls, and For the
tests, they are installed in /usr/lib/nnstreamer/unittest/tests.
Some unittest executions (unittest_repo, unittest_sink,
unittest_common, unittest_plugins) are installed in
/usr/lib/nnstreamer/unittest.

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
5 years ago[SVACE/414634-5] Fix 65505041/2 Warning accepted/tizen/unified/20190402.071859 submit/tizen/20190401.105207
MyungJoo Ham [Mon, 1 Apr 2019 08:07:35 +0000 (17:07 +0900)]
[SVACE/414634-5] Fix 65505041/2 Warning

DEREF_OF_NULL.RET.ALLOC

Warning Message
Pointer '↦left[0]' returned from function 'g_strdup_printf' at tensor_filter.c:965 may be null, and it is dereferenced at tensor_filter.c:984.
Warning Message
Pointer '↦right[0]' returned from function 'g_strdup_printf' at tensor_filter.c:974 may be null, and it is dereferenced at tensor_filter.c:986.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[SVACE/414633] Check malloc return value
MyungJoo Ham [Mon, 1 Apr 2019 07:59:59 +0000 (16:59 +0900)]
[SVACE/414633] Check malloc return value

Do not proceed if malloc returns null:
Warning Message
Pointer 'output[0].data' returned from function 'malloc' at nnstreamer_customfilter_example_scaler_allocator.c:159 may be null, and it is dereferenced at nnstreamer_customfilter_example_scaler_allocator.c:202.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[SVACE/414632] Check malloc return value
MyungJoo Ham [Mon, 1 Apr 2019 07:57:40 +0000 (16:57 +0900)]
[SVACE/414632] Check malloc return value

Do not proceed if malloc returns null:
Warning Message
Pointer 'data' returned from function 'malloc' at nnscustom_framecounter.c:96 may be null, and it is dereferenced at nnscustom_framecounter.c:98.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[SVACE/414631] Check malloc return value
MyungJoo Ham [Mon, 1 Apr 2019 07:55:04 +0000 (16:55 +0900)]
[SVACE/414631] Check malloc return value

Do not proceed if malloc returns null:
Warning Message
Pointer 'data' returned from function 'malloc' at nnstreamer_customfilter_example_scaler_allocator.c:65 may be null, and it is dereferenced at nnstreamer_customfilter_example_scaler_allocator.c:68.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[SVACE/414630] Check malloc return value
MyungJoo Ham [Mon, 1 Apr 2019 07:53:17 +0000 (16:53 +0900)]
[SVACE/414630] Check malloc return value

Do not proceed if malloc returns null:
Warning Message
Pointer 'data' returned from function 'malloc' at nnstreamer_customfilter_example_scaler.c:45 may be null, and it is dereferenced at nnstreamer_customfilter_example_scaler.c:48.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[SVACE/414629] Check malloc return value.
MyungJoo Ham [Mon, 1 Apr 2019 07:49:13 +0000 (16:49 +0900)]
[SVACE/414629] Check malloc return value.

If it's NULL, don't proceed:
Warning Message
Pointer 'data' returned from function 'malloc' at nnstreamer_customfilter_example_average.c:36 may be null, and it is dereferenced at nnstreamer_customfilter_example_average.c:38.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[SVACE/414609] Fix 65505016 Warning
MyungJoo Ham [Mon, 1 Apr 2019 07:25:22 +0000 (16:25 +0900)]
[SVACE/414609] Fix 65505016 Warning

Line 249 of tensordec-boundingbox.c has the following SVACE warning:

Warning Message
Possible integer underflow: left operand is tainted. An integer underflow may occur due to arithmetic operation (unsigned subtraction) between values { [0, 1073741823] } and '1', where the first value comes from the expression 'strlen(line)'

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[SVACE/414602] Fix 65505007 Warning
MyungJoo Ham [Mon, 1 Apr 2019 06:47:52 +0000 (15:47 +0900)]
[SVACE/414602] Fix 65505007 Warning

Fix: WID:65505007 Integer value 'width * height' obtained from untrusted source at bmp2png.c:239 by passing as 1st parameter to function 'fread' at bmp2png.c:232 without checking its lower bound is used in a trusted operation at bmp2png.c:254 by calling function 'calloc'.

Add lower limits for height/width.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[SVACE/414655] Fix 65505049 Warning
jijoong.moon [Mon, 1 Apr 2019 07:43:43 +0000 (16:43 +0900)]
[SVACE/414655] Fix 65505049 Warning

Line 343 of unittest_sink.cpp has svace warning:

WID:65505049 Use of vulnerable function 'sprintf' at
unittest_sink.cpp:343. For better security, VD recommends NOT to use
sprintf. Use snprintf instead.

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
5 years ago[Filter/TF-Lite] Enable NNAPI with configurations
MyungJoo Ham [Fri, 29 Mar 2019 01:45:41 +0000 (10:45 +0900)]
[Filter/TF-Lite] Enable NNAPI with configurations

This rephrases #1013 with nnstreamer configuration support.

Add TRUE or 1 or ON of "enable_nnapi" in .ini file or
Use NNSTREAMER_tensorflowlite_enable_nnapi=1 as an environmental
variable to enable NNAPI for tensorflow-lite.

CC: @daeinki
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[IIO] Change functions used for byte order conversion
Wook Song [Fri, 29 Mar 2019 00:08:30 +0000 (09:08 +0900)]
[IIO] Change functions used for byte order conversion

Without defining _BSD_SOURCE and __USE_BSD macros, the functions such as
be16toh, le16toh, be32toh, le32toh, be64toh and le64toh are not
compatible with c89. In order to fix this issue, this patch replaces
such functions with byte order macros from glib-2.0.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years ago[README] Add a badge for displaying status of code coverage
Wook Song [Thu, 28 Mar 2019 08:47:42 +0000 (17:47 +0900)]
[README] Add a badge for displaying status of code coverage

This patch adds a badge that displays code coverage status to the main
page of github, i.e., README.md.

Signed-off-by: Wook Song <wook16.song@samsung.com>
5 years agoRemove tensor_save/load. It's unimplemented skeleton abandoned.
MyungJoo Ham [Thu, 28 Mar 2019 02:19:03 +0000 (11:19 +0900)]
Remove tensor_save/load. It's unimplemented skeleton abandoned.

It has been abandoned for too long time that has incorrect skeleton.
To promote better design, remove the whole skeleton.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[UNITTEST] Adding queue to prevent unexpected input drop
jijoong.moon [Wed, 27 Mar 2019 08:32:47 +0000 (17:32 +0900)]
[UNITTEST] Adding queue to prevent unexpected input drop

Add queue element in the test pipeline. For the slow hardware, there
are  unexpected input drop, which makes unittests inconsistent.

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
5 years ago[Conf/Testcase] Add UT cases for custom conf
MyungJoo Ham [Tue, 26 Mar 2019 08:24:58 +0000 (17:24 +0900)]
[Conf/Testcase] Add UT cases for custom conf

Added a few test cases for custom conf.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[TENSORREPO] Fix hanging while waiting pulled signal when eos.
jijoong.moon [Wed, 27 Mar 2019 09:54:04 +0000 (18:54 +0900)]
[TENSORREPO] Fix hanging while waiting pulled signal when eos.

There is hanging error when it is waiting pulled signal. In the case
of EOS(End of Stream), there is no pulling procedure but it is
required to get signal to get out the while loop.

**Self evaluation:**
1. Build test:   [X]Passed [ ]Failed [ ]Skipped
2. Run test:     [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
5 years ago[UNITTESTS] Fix binary write
jijoong.moon [Wed, 27 Mar 2019 01:48:49 +0000 (10:48 +0900)]
[UNITTESTS] Fix binary write

Some of test cases is not appropriate for python3. In this PR, these
are fixed. (wirte binary data in to string file write option)

**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: jijoong.moon <jijoong.moon@samsung.com>
5 years agolcov: Changed the default time zone from UTC to KST
Geunsik Lim [Wed, 27 Mar 2019 09:32:29 +0000 (18:32 +0900)]
lcov: Changed the default time zone from UTC to KST

Fixed the issue #1193 and #1275 finally.
https://github.com/nnsuite/nnstreamer/issues/1193#issuecomment-469635177
https://github.com/nnsuite/nnstreamer/issues/1275

This commit is to replace UTC with KST by default in order to display the date format
with Seoul time.  The 'lcov' generates the date format with UTC time zone by default.
So, let's replace UTC with KST.

Signed-off-by: Geunsik Lim <geunsik.lim@samsung.com>
5 years ago[Tizen] fix the typos in doc header
Sangjung Woo [Wed, 27 Mar 2019 08:01:30 +0000 (17:01 +0900)]
[Tizen] fix the typos in doc header

This patch fixes the minor typos in doc header file.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
5 years ago[Common] remove media type header
Jaeyun [Mon, 11 Mar 2019 08:23:23 +0000 (17:23 +0900)]
[Common] remove media type header

Only tensor-converter needs media format header.
Remove unnecessary header include in common files.

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Test/Unit-test-coverage] Add Tizen/API into unittest coverage
MyungJoo Ham [Fri, 22 Mar 2019 05:54:38 +0000 (14:54 +0900)]
[Test/Unit-test-coverage] Add Tizen/API into unittest coverage

Count test-coverage of Tizen/API.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Test:Tizen/API] Test "valve" control Tizen APIs
MyungJoo Ham [Fri, 22 Mar 2019 05:53:44 +0000 (14:53 +0900)]
[Test:Tizen/API] Test "valve" control Tizen APIs

Test if frames flow only when valve is opened.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Tizen/API] Bugfix on get_state
MyungJoo Ham [Fri, 22 Mar 2019 05:52:17 +0000 (14:52 +0900)]
[Tizen/API] Bugfix on get_state

gst_state should not wait indefinitely. Let's give 100us as the "deadline".

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[IIO] enable automated tests for src IIO
Parichay Kapoor [Tue, 26 Mar 2019 06:41:48 +0000 (15:41 +0900)]
[IIO] enable automated tests for src IIO

1. Added IIO test check in debian rules auto tests
2. Added IIO test in nnstreamer.spec unit tests

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] register iio source and add test cases
Parichay Kapoor [Mon, 25 Mar 2019 06:50:49 +0000 (15:50 +0900)]
[IIO] register iio source and add test cases

1. Register plugin as a nnstreamer plugin and initialize it
2. Add test case for setting/getting properties of tensor src iio
3. Bug fixes for the bugs found with the tests
Removed srcpad from properties as it is not needed

V2:
- include tensor source in nnstreamer for android build

V3:
- removed srcpad from properties as it is not needed

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Conf] Custom conf keys
MyungJoo Ham [Mon, 25 Mar 2019 06:01:51 +0000 (15:01 +0900)]
[Conf] Custom conf keys

Any subplugins (/ext/) may use this to make custom
configuration keys.

To support custom filters, the header should be exported.
However, for now, let's forget about the need from
custom filters.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years agoUse macro to shorten common codes.
MyungJoo Ham [Mon, 18 Mar 2019 09:51:07 +0000 (18:51 +0900)]
Use macro to shorten common codes.

Use macro for init/exit routines that are same in many functions.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years agoCode clean: use macro for dlog tag name
MyungJoo Ham [Mon, 18 Mar 2019 08:29:26 +0000 (17:29 +0900)]
Code clean: use macro for dlog tag name

Use DLOG_TAG instead of "nnstreamer-capi-pipeline".

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Filter/Tensorflow] fix bug of testcase accepted/tizen/unified/20190326.024547 submit/tizen/20190325.074521
Hyoung Joo Ahn [Mon, 25 Mar 2019 05:09:20 +0000 (14:09 +0900)]
[Filter/Tensorflow] fix bug of testcase

Since the STRING input tensor should be processed differently, the logic was fixed.

Signed-off-by: Hyoung Joo Ahn <hello.ahn@samsung.com>
5 years ago[Tizen/API] Implement src/sink/switch/valve handlers
MyungJoo Ham [Fri, 15 Mar 2019 00:44:54 +0000 (09:44 +0900)]
[Tizen/API] Implement src/sink/switch/valve handlers

Tizen-API implementation to handle
- tensor_sink
- app_src
- input_selector
- output_selector
- valve

Unit test cases and code clean/compaction commit will follow soon.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Filter/TFLite] refine the headers
Hyoung Joo Ahn [Mon, 25 Mar 2019 05:20:02 +0000 (14:20 +0900)]
[Filter/TFLite] refine the headers

relocate headers at proper position and remove useless headers

Signed-off-by: Hyoung Joo Ahn <hello.ahn@samsung.com>
5 years ago[IIO] minor bug fixes and changes
Parichay Kapoor [Thu, 21 Mar 2019 11:09:51 +0000 (20:09 +0900)]
[IIO] minor bug fixes and changes

1. using scale and offset
2. removed unused mutex
3. using GST_ERROR_OBJECT() instead of GST_ERROR()
4. using silent debug properly
5. bug fix for setting generic_name in channel properties
6. using G_UNLIKELY with updated cppcheck

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[Build] build warning
Jaeyun [Fri, 22 Mar 2019 11:41:53 +0000 (20:41 +0900)]
[Build] build warning

change incorrect header definition

Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
5 years ago[Tizen/API] Implement start/stop/getstate/destroy with testcases
MyungJoo Ham [Wed, 13 Mar 2019 08:11:37 +0000 (17:11 +0900)]
[Tizen/API] Implement start/stop/getstate/destroy with testcases

Implement Tizen-CAPI, "start/stop/getstate/destroy" for a nnstreamer pipeline.
Add testcases for them.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[Subplugin] Remove dlsym subplugin loader
MyungJoo Ham [Tue, 19 Mar 2019 02:36:38 +0000 (11:36 +0900)]
[Subplugin] Remove dlsym subplugin loader

We no longer need dlsym subplugin loader, which make it
incompatible with statically built subplugins.

Subplugins have been calling register_subplugin in its
init functions; thus removing dlsym routines is ok.

Fixes #1130

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
5 years ago[IIO] _create() creates the buffer
Parichay Kapoor [Tue, 19 Mar 2019 07:48:54 +0000 (16:48 +0900)]
[IIO] _create() creates the buffer

Create the buffer, allocate memory for the buffer
Enable setting the timestamp for the buffer by base src
Ignore timestamp channel for now - added in todo

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] scan data and fill buffer
Parichay Kapoor [Mon, 18 Mar 2019 07:47:48 +0000 (16:47 +0900)]
[IIO] scan data and fill buffer

1. Read the data from IIO device
2. Process the raw data
3. Fill the buffer with processed data
4. Fixing type for all channels data to float32

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
5 years ago[IIO] added scale and offset
Parichay Kapoor [Fri, 15 Mar 2019 11:23:16 +0000 (20:23 +0900)]
[IIO] added scale and offset

Added scale and offset to process raw data.
First get channel specific scale/offset, if available. Secondly, try
generic scale/offset, else use default values.

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>