mv_machine_learning: change async API behavior
authorInki Dae <inki.dae@samsung.com>
Wed, 23 Aug 2023 01:53:51 +0000 (10:53 +0900)
committerKwanghoon Son <k.son@samsung.com>
Mon, 4 Sep 2023 04:57:02 +0000 (13:57 +0900)
commitfdbd84f1ff3b30c9f18598b65da777f65611e4cb
tree357334b18622d9dba4c5a4e332fb9a5f6a2b65b3
parentcd137aa10873b5f77961ae52ecd9cd9e01b44e56
mv_machine_learning: change async API behavior

[Issue type] : code refactoring

Change async API behavior of object detection task group.

In original version, async API created an internal thread which is
different from main thread because the callback function registered by
user was called by the new thread context created by the internal framework.

With this patch, user has to create a new thread for the use of async API.
Below is an simple example,
void thread_cb(...)
{
...
while (condition) {
...
mv_object_detection_get_result(handle, &number_of_objects, ...);
...

for (unsigned int idx = 0; idx < number_of_objects; ++idx) {
...
mv_object_detection_get_label(handle, idx, &label);
...
}
}
}

In addition, this patch drops the use of mutex for thread safety due to
dead lock issue. I will introduce a new thread safety solution with
more fine-grained lock approach later.

Change-Id: I7621097a7b08456d61af79ca2659546083e0ece0
Signed-off-by: Inki Dae <inki.dae@samsung.com>
include/mv_face_detection_internal.h
include/mv_object_detection_internal.h
mv_machine_learning/object_detection/include/object_detection.h
mv_machine_learning/object_detection/include/object_detection_type.h
mv_machine_learning/object_detection/src/mv_face_detection.cpp
mv_machine_learning/object_detection/src/mv_object_detection.cpp
mv_machine_learning/object_detection/src/object_detection.cpp
mv_machine_learning/object_detection/src/object_detection_adapter.cpp
test/testsuites/machine_learning/object_detection/CMakeLists.txt
test/testsuites/machine_learning/object_detection/test_object_detection.cpp
test/testsuites/machine_learning/object_detection/test_object_detection_async.cpp