diff options
-rw-r--r-- | CMakeLists.txt | 27 | ||||
-rw-r--r-- | packaging/capi-media-vision.spec | 30 | ||||
-rw-r--r-- | src/mv_barcode.c | 237 | ||||
-rw-r--r-- | src/mv_common.c | 377 | ||||
-rw-r--r-- | src/mv_face.c | 744 | ||||
-rw-r--r-- | src/mv_image.c | 525 | ||||
-rw-r--r-- | src/mv_inference.c | 315 | ||||
-rw-r--r-- | src/mv_private.c | 261 | ||||
-rw-r--r-- | src/mv_surveillance.c | 373 |
9 files changed, 22 insertions, 2867 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b7fcd3fb..081aee20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,3 @@ - CMAKE_MINIMUM_REQUIRED(VERSION 2.6) SET(fw_name "capi-media-vision") @@ -155,26 +154,6 @@ ADD_SUBDIRECTORY(mv_face) ADD_SUBDIRECTORY(mv_surveillance) ADD_SUBDIRECTORY(mv_inference) -aux_source_directory(src SOURCES) -ADD_LIBRARY(${fw_name} SHARED ${SOURCES}) - -TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS} - ${MV_COMMON_LIB_NAME} - ${MV_BARCODE_DETECTOR_LIB_NAME} - ${MV_BARCODE_GENERATOR_LIB_NAME} - ${MV_IMAGE_LIB_NAME} - ${MV_FACE_LIB_NAME} - ${MV_SURVEILLANCE_LIB_NAME} - ${MV_INFERENCE_LIB_NAME}) - -SET_TARGET_PROPERTIES(${fw_name} - PROPERTIES - VERSION ${FULLVER} - SOVERSION ${MAJORVER} - CLEAN_DIRECT_OUTPUT 1 -) - -INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR}) INSTALL( DIRECTORY ${INC_DIR}/ DESTINATION include/media FILES_MATCHING @@ -183,8 +162,9 @@ INSTALL( ) SET(PC_NAME ${fw_name}) -SET(PC_REQUIRED ${pc_dependents}) -SET(PC_LDFLAGS -l${fw_name}) +SET(PC_REQUIRED "${fw_name}-barcode ${fw_name}-face ${fw_name}-image ${fw_name}-surveillance ${fw_name}-inference") +SET(PC_LDFLAGS "-l${MV_COMMON_LIB_NAME} -l${MV_BARCODE_DETECTOR_LIB_NAME} -l${MV_BARCODE_GENERATOR_LIB_NAME} \ +-l${MV_IMAGE_LIB_NAME} -l${MV_FACE_LIB_NAME} -l${MV_SURVEILLANCE_LIB_NAME} -l${MV_INFERENCE_LIB_NAME}") SET(PC_CFLAGS -I\${includedir}/media) CONFIGURE_FILE( @@ -195,6 +175,7 @@ CONFIGURE_FILE( INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) SET(PC_NAME ${fw_name}-common) +SET(PC_REQUIRED ${pc_dependents}) SET(PC_LDFLAGS "-l${MV_COMMON_LIB_NAME}") CONFIGURE_FILE( ${fw_name}.pc.in diff --git a/packaging/capi-media-vision.spec b/packaging/capi-media-vision.spec index 2fdf73f4..534cf8c7 100644 --- a/packaging/capi-media-vision.spec +++ b/packaging/capi-media-vision.spec @@ -29,6 +29,11 @@ BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(iniparser) BuildRequires: pkgconfig(ncurses) BuildRequires: pkgconfig(inference-engine-interface-common) +Requires: %{name}-barcode +Requires: %{name}-face +Requires: %{name}-image +Requires: %{name}-inference +Requires: %{name}-surveillance %description Media Vision library for Tizen Native API. Includes barcode detecting, barcode generating, face and image modules. @@ -37,6 +42,11 @@ Media Vision library for Tizen Native API. Includes barcode detecting, barcode g Summary: Multimedia Vision Library (DEV) Group: Multimedia/Framework Requires: %{name} = %{version}-%{release} +Requires: %{name}-barcode-devel +Requires: %{name}-face-devel +Requires: %{name}-image-devel +Requires: %{name}-inference-devel +Requires: %{name}-surveillance-devel %description devel Media Vision library for Tizen Native API (DEV). Includes barcode detecting, barcode generating, face and image modules. @@ -216,15 +226,9 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %files %manifest %{name}.manifest %license LICENSE.APLv2 -%{_datadir}/%{name}/media-vision-config.json -%{_libdir}/lib%{name}.so.* -%{_libdir}/libmv*.so %files devel -%{_includedir}/media/*.h -%{_libdir}/pkgconfig/*.pc -%{_libdir}/lib%{name}.so -%TZ_SYS_BIN/* +%{_libdir}/pkgconfig/%{name}.pc %files common %manifest %{name}.manifest @@ -237,6 +241,7 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_libdir}/pkgconfig/*common.pc %files barcode +%license LICENSE.APLv2 %{_libdir}/libmv_barcode*.so %files barcode-devel @@ -244,6 +249,7 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_libdir}/pkgconfig/*barcode.pc %files face +%license LICENSE.APLv2 %{_libdir}/libmv_face*.so %files face-devel @@ -251,6 +257,7 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_libdir}/pkgconfig/*face.pc %files image +%license LICENSE.APLv2 %{_libdir}/libmv_image.so %files image-devel @@ -258,6 +265,7 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_libdir}/pkgconfig/*image.pc %files surveillance +%license LICENSE.APLv2 %{_libdir}/libmv_surveillance*.so %files surveillance-devel @@ -265,6 +273,7 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_libdir}/pkgconfig/*surveillance.pc %files inference +%license LICENSE.APLv2 %{_libdir}/libmv_inference*.so %files inference-devel @@ -272,13 +281,10 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj %{_libdir}/pkgconfig/*inference.pc %files testsuite +%license LICENSE.APLv2 %{_libdir}/libmv_*helper.so %{_libdir}/libmv_testsuite*.so -%TZ_SYS_BIN/mv_barcode* -%TZ_SYS_BIN/mv_face* -%TZ_SYS_BIN/mv_image* -%TZ_SYS_BIN/mv_surveillance* -%TZ_SYS_BIN/mv_infer* +%TZ_SYS_BIN/mv_* %if 0%{?gcov:1} %files gcov diff --git a/src/mv_barcode.c b/src/mv_barcode.c deleted file mode 100644 index 460c6243..00000000 --- a/src/mv_barcode.c +++ /dev/null @@ -1,237 +0,0 @@ -/** - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <system_info.h> - -#include "mv_private.h" -#include "mv_barcode_detect.h" -#include "mv_barcode_generate.h" - -#ifdef MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT - -/* Include headers of licensed barcode detect module here. */ -#include "mv_barcode_detect_lic.h" - -#else - -/* Include headers of open barcode detect module here. */ -#include "mv_barcode_detect_open.h" - -#endif /* MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT */ - -#ifdef MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT - -/* Include headers of licensed barcode generate module here. */ -#include "mv_barcode_generate_lic.h" - -#else - -/* Include headers of open barcode generate module here. */ -#include "mv_barcode_generate_open.h" - -#endif /* MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT */ - -/** - * @file mv_barcode.c - * @brief This file contains the porting layer for Media Vision barcode module. - */ - -int mv_barcode_detect( - mv_source_h source, - mv_engine_config_h engine_cfg, - mv_rectangle_s roi, - mv_barcode_detected_cb detect_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_barcode_detect_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(detect_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - unsigned int src_w = 0; - unsigned int src_h = 0; - - ret = mv_source_get_width(source, &src_w); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("mv_source_get_width fail"); - return ret; - } - - ret = mv_source_get_height(source, &src_h); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("mv_source_get_height fail"); - return ret; - } - - if (roi.point.x < 0 || roi.point.y < 0 || - (roi.point.x + roi.width) > src_w || - (roi.point.y + roi.height) > src_h) { - LOGE("roi is out of area on source"); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - -#ifdef MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT - - /* Use licensed barcode detect functionality here. */ - ret = mv_barcode_detect_lic( - source, engine_cfg, roi, detect_cb, user_data); - -#else - - /* Use open barcode detect functionality here. */ - ret = mv_barcode_detect_open( - source, engine_cfg, roi, detect_cb, user_data); - -#endif /* MEDIA_VISION_BARCODE_DETECTOR_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_barcode_generate_source( - mv_engine_config_h engine_cfg, - const char *message, - mv_barcode_type_e type, - mv_barcode_qr_mode_e qr_enc_mode, - mv_barcode_qr_ecc_e qr_ecc, - int qr_version, - mv_source_h image) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_barcode_generate_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(message); - MEDIA_VISION_INSTANCE_CHECK(image); - - MEDIA_VISION_FUNCTION_ENTER(); - - if (type < MV_BARCODE_QR || - type >= MV_BARCODE_UNDEFINED) { - LOGE("Not supported barcode type [%d]", type); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - - if (type == MV_BARCODE_QR) { - if (qr_enc_mode < MV_BARCODE_QR_MODE_NUMERIC || - qr_enc_mode >= MV_BARCODE_QR_MODE_UNAVAILABLE) { - LOGE("Not supported QR encoding mode[%d]", qr_enc_mode); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - - if (qr_ecc < MV_BARCODE_QR_ECC_LOW || - qr_ecc >= MV_BARCODE_QR_ECC_UNAVAILABLE) { - LOGE("Not supported QR ECC level [%d]", qr_ecc); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - - if (qr_version < 1 || qr_version > 40) { - LOGE("Not supported QR version [%d]", qr_version); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - } - -#ifdef MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT - - /* Use licensed barcode generate functionality here. */ - int ret = mv_barcode_generate_source_lic( - engine_cfg, message, type, qr_enc_mode, qr_ecc, qr_version, - image); - -#else - - /* Use open barcode generate functionality here. */ - int ret = mv_barcode_generate_source_open( - engine_cfg, message, type, qr_enc_mode, qr_ecc, qr_version, - image); - -#endif /* MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_barcode_generate_image( - mv_engine_config_h engine_cfg, - const char *message, - int image_width, - int image_height, - mv_barcode_type_e type, - mv_barcode_qr_mode_e qr_enc_mode, - mv_barcode_qr_ecc_e qr_ecc, - int qr_version, - const char *image_path, - mv_barcode_image_format_e image_format) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_barcode_generate_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(message); - - MEDIA_VISION_FUNCTION_ENTER(); - - if (image_path == NULL) { - LOGE("image_path is NULL"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - if (type < MV_BARCODE_QR || - type >= MV_BARCODE_UNDEFINED) { - LOGE("Not supported barcode type [%d]", type); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - - if (type == MV_BARCODE_QR) { - if (qr_enc_mode < MV_BARCODE_QR_MODE_NUMERIC || - qr_enc_mode >= MV_BARCODE_QR_MODE_UNAVAILABLE) { - LOGE("Not supported QR encoding mode[%d]", qr_enc_mode); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - - if (qr_ecc < MV_BARCODE_QR_ECC_LOW || - qr_ecc >= MV_BARCODE_QR_ECC_UNAVAILABLE) { - LOGE("Not supported QR ECC level [%d]", qr_ecc); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - - if (qr_version < 1 || qr_version > 40) { - LOGE("Not supported QR version [%d]", qr_version); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - } - - if (image_format < MV_BARCODE_IMAGE_FORMAT_BMP || - image_format >= MV_BARCODE_IMAGE_FORMAT_NUM) { - LOGE("Not supported image format [%d]", image_format); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - -#ifdef MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT - - /* Use licensed barcode generate functionality here. */ - int ret = mv_barcode_generate_image_lic( - engine_cfg, message, image_width, image_height, type, - qr_enc_mode, qr_ecc, qr_version, image_path, image_format); - -#else - - /* Use open barcode generate functionality here. */ - int ret = mv_barcode_generate_image_open( - engine_cfg, message, image_width, image_height, type, - qr_enc_mode, qr_ecc, qr_version, image_path, image_format); - -#endif /* MEDIA_VISION_BARCODE_GENERATOR_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} diff --git a/src/mv_common.c b/src/mv_common.c deleted file mode 100644 index c01536d0..00000000 --- a/src/mv_common.c +++ /dev/null @@ -1,377 +0,0 @@ -/** - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mv_private.h" -#include "mv_common.h" -#include "mv_common_c.h" - -int mv_create_source( - mv_source_h *source) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(source); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_create_source_c(source); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_destroy_source( - mv_source_h source) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_destroy_source_c(source); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_source_fill_by_media_packet( - mv_source_h source, - media_packet_h media_packet) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(media_packet); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_source_fill_by_media_packet_c(source, media_packet); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_source_fill_by_buffer( - mv_source_h source, - unsigned char *data_buffer, - unsigned int buffer_size, - unsigned int image_width, - unsigned int image_height, - mv_colorspace_e image_colorspace) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(data_buffer); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_source_fill_by_buffer_c( - source, data_buffer, buffer_size, image_width, image_height, - image_colorspace); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_source_clear( - mv_source_h source) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_source_clear_c(source); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_source_get_buffer( - mv_source_h source, - unsigned char **data_buffer, - unsigned int *buffer_size) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(data_buffer); - MEDIA_VISION_NULL_ARG_CHECK(buffer_size); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_source_get_buffer_c(source, data_buffer, buffer_size); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_source_get_height( - mv_source_h source, - unsigned int *image_height) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(image_height); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_source_get_height_c(source, image_height); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_source_get_width( - mv_source_h source, - unsigned int *image_width) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(image_width); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_source_get_width_c(source, image_width); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_source_get_colorspace( - mv_source_h source, - mv_colorspace_e *image_colorspace) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(image_colorspace); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_source_get_colorspace_c(source, image_colorspace); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_create_engine_config( - mv_engine_config_h *engine_cfg) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(engine_cfg); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_create_engine_config_c(engine_cfg); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_destroy_engine_config( - mv_engine_config_h engine_cfg) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_destroy_engine_config_c(engine_cfg); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_set_double_attribute( - mv_engine_config_h engine_cfg, - const char *name, - double value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_set_double_attribute_c( - engine_cfg, name, value); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_set_int_attribute( - mv_engine_config_h engine_cfg, - const char *name, - int value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_set_int_attribute_c( - engine_cfg, name, value); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_set_bool_attribute( - mv_engine_config_h engine_cfg, - const char *name, - bool value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_set_bool_attribute_c( - engine_cfg, name, value); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_set_string_attribute( - mv_engine_config_h engine_cfg, - const char *name, - const char *value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - MEDIA_VISION_NULL_ARG_CHECK(value); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_set_string_attribute_c( - engine_cfg, name, value); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_set_array_string_attribute( - mv_engine_config_h engine_cfg, - const char *name, - const char **values, - unsigned int size) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - MEDIA_VISION_NULL_ARG_CHECK(values); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = mv_engine_config_set_array_string_attribute_c( - engine_cfg, name, values, size); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_get_double_attribute( - mv_engine_config_h engine_cfg, - const char *name, - double *value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - MEDIA_VISION_NULL_ARG_CHECK(value); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_get_double_attribute_c( - engine_cfg, name, value); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_get_int_attribute( - mv_engine_config_h engine_cfg, - const char *name, - int *value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - MEDIA_VISION_NULL_ARG_CHECK(value); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_get_int_attribute_c( - engine_cfg, name, value); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_get_bool_attribute( - mv_engine_config_h engine_cfg, - const char *name, - bool *value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - MEDIA_VISION_NULL_ARG_CHECK(value); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_get_bool_attribute_c( - engine_cfg, name, value); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_get_string_attribute( - mv_engine_config_h engine_cfg, - const char *name, - char **value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - MEDIA_VISION_NULL_ARG_CHECK(value); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_get_string_attribute_c( - engine_cfg, name, value); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_get_array_string_attribute( - mv_engine_config_h engine_cfg, - const char *name, - char ***values, - int *size) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(engine_cfg); - MEDIA_VISION_NULL_ARG_CHECK(name); - MEDIA_VISION_NULL_ARG_CHECK(values); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_get_array_string_attribute_c( - engine_cfg, name, values, size); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_engine_config_foreach_supported_attribute( - mv_supported_attribute_cb callback, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(callback); - - MEDIA_VISION_FUNCTION_ENTER(); - int ret = mv_engine_config_foreach_supported_attribute_c( - callback, user_data); - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} diff --git a/src/mv_face.c b/src/mv_face.c deleted file mode 100644 index a8d28278..00000000 --- a/src/mv_face.c +++ /dev/null @@ -1,744 +0,0 @@ -/** - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mv_private.h" -#include "mv_face.h" - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - -/* Include headers of licensed face module here. */ -#include "mv_face_lic.h" - -#else - -/* Include headers of open face module here. */ -#include "mv_face_open.h" - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - -/** - * @file mv_face.c - * @brief This file contains the porting layer for Media Vision face module. - */ - -static int check_source_roi_quadrangle(mv_quadrangle_s *roi, mv_source_h source) -{ - int ret = MEDIA_VISION_ERROR_NONE; - - if (roi) { - int src_w = 0; - int src_h = 0; - - ret = mv_source_get_width(source, &src_w); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("mv_source_get_width fail"); - return ret; - } - - ret = mv_source_get_height(source, &src_h); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("mv_source_get_height fail"); - return ret; - } - - int idx = 0; - while (idx < 4) { - if (roi->points[idx].x < 0 || roi->points[idx].y < 0 || - roi->points[idx].x > src_w || roi->points[idx].y > src_h) { - LOGE("roi is out of area on source"); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - ++idx; - } - } - - return ret; -} - -static int check_source_roi(mv_rectangle_s *roi, mv_source_h source) -{ - int ret = MEDIA_VISION_ERROR_NONE; - - if (roi) { - int src_w = 0; - int src_h = 0; - - ret = mv_source_get_width(source, &src_w); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("mv_source_get_width fail"); - return ret; - } - - ret = mv_source_get_height(source, &src_h); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("mv_source_get_height fail"); - return ret; - } - - if (roi->width <= 0 || roi->height <= 0) { - LOGE("roi has negative width or height"); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - - if (roi->point.x < 0 || roi->point.y < 0 || - (roi->point.x + roi->width) > src_w || - (roi->point.y + roi->height) > src_h) { - LOGE("roi is out of area on source"); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - } - - return ret; -} - -int mv_face_detect( - mv_source_h source, - mv_engine_config_h engine_cfg, - mv_face_detected_cb detected_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(detected_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_detect_lic(source, engine_cfg, detected_cb, user_data); - -#else - - ret = mv_face_detect_open(source, engine_cfg, detected_cb, user_data); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognize( - mv_source_h source, - mv_face_recognition_model_h recognition_model, - mv_engine_config_h engine_cfg, - mv_rectangle_s *face_location, - mv_face_recognized_cb recognized_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(recognition_model); - MEDIA_VISION_NULL_ARG_CHECK(recognized_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = check_source_roi(face_location, source); - if (MEDIA_VISION_ERROR_NONE != ret) { - LOGE("Errors occured when check source and ROI"); - return ret; - } - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognize_lic( - source, - recognition_model, - engine_cfg, - face_location, - recognized_cb, - user_data); - -#else - - ret = mv_face_recognize_open( - source, - recognition_model, - engine_cfg, - face_location, - recognized_cb, - user_data); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_track( - mv_source_h source, - mv_face_tracking_model_h tracking_model, - mv_engine_config_h engine_cfg, - mv_face_tracked_cb tracked_cb, - bool do_learn, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(tracking_model); - MEDIA_VISION_NULL_ARG_CHECK(tracked_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_track_lic( - source, - tracking_model, - engine_cfg, - tracked_cb, - do_learn, - user_data); - -#else - - ret = mv_face_track_open( - source, - tracking_model, - engine_cfg, - tracked_cb, - do_learn, - user_data); - - #endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_eye_condition_recognize( - mv_source_h source, - mv_engine_config_h engine_cfg, - mv_rectangle_s face_location, - mv_face_eye_condition_recognized_cb eye_condition_recognized_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(eye_condition_recognized_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_eye_condition_recognize_lic( - source, - engine_cfg, - face_location, - eye_condition_recognized_cb, - user_data); - -#else - - ret = mv_face_eye_condition_recognize_open( - source, - engine_cfg, - face_location, - eye_condition_recognized_cb, - user_data); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - -MEDIA_VISION_FUNCTION_LEAVE(); -return ret; -} - -int mv_face_facial_expression_recognize( - mv_source_h source, - mv_engine_config_h engine_cfg, - mv_rectangle_s face_location, - mv_face_facial_expression_recognized_cb expression_recognized_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(expression_recognized_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = check_source_roi(&face_location, source); - if (MEDIA_VISION_ERROR_NONE != ret) { - LOGE("Errors occurred when check source and ROI"); - return ret; - } - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_facial_expression_recognize_lic( - source, - engine_cfg, - face_location, - expression_recognized_cb, - user_data); - -#else - - ret = mv_face_facial_expression_recognize_open( - source, - engine_cfg, - face_location, - expression_recognized_cb, - user_data); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognition_model_create( - mv_face_recognition_model_h *recognition_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(recognition_model); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_create_lic(recognition_model); - -#else - - ret = mv_face_recognition_model_create_open(recognition_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognition_model_destroy( - mv_face_recognition_model_h recognition_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(recognition_model); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_destroy_lic(recognition_model); - -#else - - ret = mv_face_recognition_model_destroy_open(recognition_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - -MEDIA_VISION_FUNCTION_LEAVE(); -return ret; -} - -int mv_face_recognition_model_clone( - mv_face_recognition_model_h src, - mv_face_recognition_model_h *dst) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(src); - MEDIA_VISION_NULL_ARG_CHECK(dst); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_clone_lic(src, dst); - -#else - - ret = mv_face_recognition_model_clone_open(src, dst); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognition_model_save( - const char *file_name, - mv_face_recognition_model_h recognition_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(recognition_model); - - if (file_name == NULL) { - LOGE("File name is NULL. The file name has to be specified"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_save_lic( - file_name, - recognition_model); - -#else - - ret = mv_face_recognition_model_save_open( - file_name, - recognition_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognition_model_load( - const char *file_name, - mv_face_recognition_model_h *recognition_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(recognition_model); - - if (file_name == NULL) { - LOGE("File name is NULL. The file name has to be specified"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_load_lic( - file_name, - recognition_model); - -#else - - ret = mv_face_recognition_model_load_open( - file_name, - recognition_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognition_model_add( - const mv_source_h source, - mv_face_recognition_model_h recognition_model, - const mv_rectangle_s *example_location, - int face_label) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(recognition_model); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = check_source_roi(example_location, source); - if (MEDIA_VISION_ERROR_NONE != ret) { - LOGE("Errors occured when check source and ROI"); - return ret; - } - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_add_lic( - source, - recognition_model, - example_location, - face_label); -#else - - ret = mv_face_recognition_model_add_open( - source, - recognition_model, - example_location, - face_label); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognition_model_reset( - mv_face_recognition_model_h recognition_model, - int *face_label) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(recognition_model); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_reset_lic( - recognition_model, - face_label); - -#else - - ret = mv_face_recognition_model_reset_open( - recognition_model, - face_label); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognition_model_learn( - mv_engine_config_h engine_cfg, - mv_face_recognition_model_h recognition_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(recognition_model); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_learn_lic(engine_cfg, recognition_model); - -#else - - ret = mv_face_recognition_model_learn_open(engine_cfg, recognition_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_recognition_model_query_labels( - mv_face_recognition_model_h recognition_model, - int **labels, - unsigned int *number_of_labels) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(recognition_model); - MEDIA_VISION_NULL_ARG_CHECK(labels); - MEDIA_VISION_NULL_ARG_CHECK(number_of_labels); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_recognition_model_query_labels_lic(recognition_model, labels, number_of_labels); - -#else - - ret = mv_face_recognition_model_query_labels_open(recognition_model, labels, number_of_labels); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_tracking_model_create( - mv_face_tracking_model_h *tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(tracking_model); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_tracking_model_create_lic(tracking_model); - -#else - - ret = mv_face_tracking_model_create_open(tracking_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_tracking_model_destroy( - mv_face_tracking_model_h tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(tracking_model); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_tracking_model_destroy_lic(tracking_model); - -#else - - ret = mv_face_tracking_model_destroy_open(tracking_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_tracking_model_prepare( - mv_face_tracking_model_h tracking_model, - mv_engine_config_h engine_cfg, - mv_source_h source, - mv_quadrangle_s *location) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(tracking_model); - MEDIA_VISION_INSTANCE_CHECK(source); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = check_source_roi_quadrangle(location, source); - if (MEDIA_VISION_ERROR_NONE != ret) { - LOGE("Errors occured when check source and tracking start location"); - return ret; - } - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_tracking_model_prepare_lic( - tracking_model, engine_cfg, source, location); - -#else - - ret = mv_face_tracking_model_prepare_open( - tracking_model, engine_cfg, source, location); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_tracking_model_clone( - mv_face_tracking_model_h src, - mv_face_tracking_model_h *dst) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(src); - MEDIA_VISION_NULL_ARG_CHECK(dst); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_tracking_model_clone_lic(src, dst); - -#else - - ret = mv_face_tracking_model_clone_open(src, dst); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_tracking_model_save( - const char *file_name, - mv_face_tracking_model_h tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(tracking_model); - - if (file_name == NULL) { - LOGE("File name is NULL. The file name has to be specified"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_tracking_model_save_lic( - file_name, - tracking_model); - -#else - - ret = mv_face_tracking_model_save_open( - file_name, - tracking_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_face_tracking_model_load( - const char *file_name, - mv_face_tracking_model_h *tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(tracking_model); - - if (file_name == NULL) { - LOGE("File name is NULL. The file name has to be specifiled"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_FACE_LICENSE_PORT - - ret = mv_face_tracking_model_load_lic( - file_name, - tracking_model); - -#else - - ret = mv_face_tracking_model_load_open( - file_name, - tracking_model); - -#endif /* MEDIA_VISION_FACE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} diff --git a/src/mv_image.c b/src/mv_image.c deleted file mode 100644 index 3b9a1c57..00000000 --- a/src/mv_image.c +++ /dev/null @@ -1,525 +0,0 @@ -/** - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mv_private.h" -#include "mv_image.h" - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - -/* Include headers of licensed image module here. */ -#include "mv_image_lic.h" - -#else - -/* Include headers of open image module here. */ -#include "mv_image_open.h" - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - -/** - * @file mv_image.c - * @brief This file contains the porting layer for Media Vision image module. - */ - -int mv_image_recognize( - mv_source_h source, - const mv_image_object_h *image_objects, - int number_of_objects, - mv_engine_config_h engine_cfg, - mv_image_recognized_cb recognized_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_NULL_ARG_CHECK(image_objects); - - int object_num = 0; - for (; object_num < number_of_objects; ++object_num) - MEDIA_VISION_INSTANCE_CHECK(image_objects[object_num]); - - MEDIA_VISION_NULL_ARG_CHECK(recognized_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_recognize_lic(source, image_objects, - number_of_objects, engine_cfg, recognized_cb, user_data); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_recognize_open(source, image_objects, - number_of_objects, engine_cfg, recognized_cb, user_data); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_track( - mv_source_h source, - mv_image_tracking_model_h image_tracking_model, - mv_engine_config_h engine_cfg, - mv_image_tracked_cb tracked_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(image_tracking_model); - MEDIA_VISION_NULL_ARG_CHECK(tracked_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_track_lic(source, image_tracking_model, engine_cfg, tracked_cb, user_data); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_track_open(source, image_tracking_model, engine_cfg, tracked_cb, user_data); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_create( - mv_image_object_h *image_object) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(image_object); - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_create_lic(image_object); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_create_open(image_object); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_destroy( - mv_image_object_h image_object) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_object); - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_destroy_lic(image_object); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_destroy_open(image_object); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_fill( - mv_image_object_h image_object, - mv_engine_config_h engine_cfg, - mv_source_h source, - mv_rectangle_s *location) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_object); - MEDIA_VISION_INSTANCE_CHECK(source); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_fill_lic(image_object, engine_cfg, source, location); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_fill_open(image_object, engine_cfg, source, location); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_get_recognition_rate( - mv_image_object_h image_object, - double *recognition_rate) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_object); - MEDIA_VISION_NULL_ARG_CHECK(recognition_rate); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_get_recognition_rate_lic(image_object, recognition_rate); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_get_recognition_rate_open(image_object, recognition_rate); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_set_label( - mv_image_object_h image_object, - int label) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_object); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_set_label_lic(image_object, label); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_set_label_open(image_object, label); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_get_label( - mv_image_object_h image_object, - int *label) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_object); - MEDIA_VISION_NULL_ARG_CHECK(label); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_get_label_lic(image_object, label); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_get_label_open(image_object, label); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_clone( - mv_image_object_h src, - mv_image_object_h *dst) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(src); - MEDIA_VISION_NULL_ARG_CHECK(dst); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_clone_lic(src, dst); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_clone_open(src, dst); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_save( - const char *file_name, mv_image_object_h image_object) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_object); - - if (file_name == NULL) { - LOGE("File name is NULL. The file name has to be specified"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_save_lic(file_name, image_object); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_save_open(file_name, image_object); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_object_load( - const char *file_name, mv_image_object_h *image_object) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(image_object); - - if (file_name == NULL) { - LOGE("file name is NULL. The file name has to be specified"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_object_load_lic(file_name, image_object); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_object_load_open(file_name, image_object); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_tracking_model_create( - mv_image_tracking_model_h *image_tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(image_tracking_model); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_tracking_model_create_lic(image_tracking_model); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_tracking_model_create_open(image_tracking_model); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_tracking_model_set_target( - mv_image_object_h image_object, - mv_image_tracking_model_h image_tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_tracking_model); - MEDIA_VISION_INSTANCE_CHECK(image_object); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_tracking_model_set_target_lic(image_object, image_tracking_model); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_tracking_model_set_target_open(image_object, image_tracking_model); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_tracking_model_destroy( - mv_image_tracking_model_h image_tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_tracking_model); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_tracking_model_destroy_lic(image_tracking_model); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_tracking_model_destroy_open(image_tracking_model); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_tracking_model_refresh( - mv_image_tracking_model_h image_tracking_model, - mv_engine_config_h engine_cfg) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_tracking_model); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_tracking_model_refresh_lic( - image_tracking_model, - engine_cfg); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_tracking_model_refresh_open( - image_tracking_model, - engine_cfg); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_tracking_model_clone( - mv_image_tracking_model_h src, - mv_image_tracking_model_h *dst) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(src); - MEDIA_VISION_NULL_ARG_CHECK(dst); - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_tracking_model_clone_lic(src, dst); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_tracking_model_clone_open(src, dst); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_tracking_model_save( - const char *file_name, mv_image_tracking_model_h image_tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(image_tracking_model); - - if (file_name == NULL) { - LOGE("File name is NULL. The file name has to be specified"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_tracking_model_save_lic(file_name, image_tracking_model); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_tracking_model_save_open(file_name, image_tracking_model); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_image_tracking_model_load( - const char *file_name, mv_image_tracking_model_h *image_tracking_model) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(image_tracking_model); - - if (file_name == NULL) { - LOGE("File name is NULL. The file name has to be specified"); - return MEDIA_VISION_ERROR_INVALID_PATH; - } - - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_IMAGE_LICENSE_PORT - - /* Use licensed image functionality here. */ - int ret = mv_image_tracking_model_load_lic(file_name, image_tracking_model); - -#else - - /* Use open image functionality here. */ - int ret = mv_image_tracking_model_load_open(file_name, image_tracking_model); - -#endif /* MEDIA_VISION_IMAGE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} diff --git a/src/mv_inference.c b/src/mv_inference.c deleted file mode 100644 index 580facc6..00000000 --- a/src/mv_inference.c +++ /dev/null @@ -1,315 +0,0 @@ -/** - * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mv_private.h" -#include "mv_inference.h" - -#ifdef MEDIA_VISION_INFERENCE_LICENSE_PORT - -/* Include headers of licensed inference module here. */ -//#include "mv_inference_lic.h" - -#else - -/* Include headers of open inference module here. */ -#include "mv_inference_open.h" - -#endif /* MEDIA_VISION_INFERENCE_LICENSE_PORT */ - -/** - * @file mv_inference.c - * @brief This file contains Media Vision inference module. - */ - -int mv_inference_create(mv_inference_h *infer) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(infer); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_INFERENCE_LICENSE_PORT - - //ret = mv_inference_create_lic(infer); - -#else - - ret = mv_inference_create_open(infer); - -#endif /* MEDIA_VISION_INFERENCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_inference_destroy(mv_inference_h infer) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(infer); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_INFERENCE_LICENSE_PORT - - //ret = mv_inference_destroy_lic(infer); - -#else - - ret = mv_inference_destroy_open(infer); - -#endif /* MEDIA_VISION_INFERENCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_inference_configure(mv_inference_h infer, mv_engine_config_h engine_config) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(infer); - MEDIA_VISION_INSTANCE_CHECK(engine_config); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_INFERENCE_LICENSE_PORT - - //ret = mv_inference_configure_lic(infer); - -#else - - ret = mv_inference_configure_engine_open(infer, engine_config); - if (ret != MEDIA_VISION_ERROR_NONE){ - LOGE("Fail to configure engine and target"); - return ret; - } - -#endif /* MEDIA_VISION_INFERENCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_inference_prepare(mv_inference_h infer) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(infer); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - - mv_engine_config_h engine_config = mv_inference_get_engine_config(infer); - -#ifdef MEDIA_VISION_INFERENCE_LICENSE_PORT - - //ret = mv_inference_prepare_lic(infer); - -#else - - ret = mv_inference_configure_model_open(infer, engine_config); - if (ret != MEDIA_VISION_ERROR_NONE){ - LOGE("Fail to configure model"); - return ret; - } - - // input tensor, input layer - ret = mv_inference_configure_input_info_open(infer, engine_config); - if (ret != MEDIA_VISION_ERROR_NONE){ - LOGE("Fail to configure input info"); - return ret; - } - - // output layer - ret = mv_inference_configure_output_info_open(infer, engine_config); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("Fail to configure output info"); - return ret; - } - - // maximum candidates, threshold - ret = mv_inference_configure_post_process_info_open(infer, engine_config); - if (ret != MEDIA_VISION_ERROR_NONE) { - LOGE("Fail to configure post process info"); - return ret; - } - - ret = mv_inference_prepare_open(infer); - -#endif /* MEDIA_VISION_INFERENCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_inference_foreach_supported_engine( - mv_inference_h infer, - mv_inference_supported_engine_cb callback, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(infer); - MEDIA_VISION_NULL_ARG_CHECK(callback); - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_INFERENCE_LICENCE_PORT - - // ret = mv_inference_foreach_supported_engine_lic(infer, callback, user_data); - -#else - - ret = mv_inference_foreach_supported_engine_open(infer, callback, user_data); - -#endif - - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - - -int mv_inference_image_classify( - mv_source_h source, - mv_inference_h infer, - mv_rectangle_s *roi, - mv_inference_image_classified_cb classified_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(infer); - MEDIA_VISION_NULL_ARG_CHECK(classified_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_INFERENCE_LICENSE_PORT - - /* - ret = mv_inference_image_classify_lic(source, infer, classified_cb, user_data); - */ - -#else - - ret = mv_inference_image_classify_open(source, infer, roi, classified_cb, user_data); - -#endif /* MEDIA_VISION_INFERENCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_inference_object_detect( - mv_source_h source, - mv_inference_h infer, - mv_inference_object_detected_cb detected_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(infer); - MEDIA_VISION_NULL_ARG_CHECK(detected_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_INFERENCE_LICENSE_PORT - - /* - ret = mv_inference_object_detect_lic(source, infer, classified_cb, user_data); - */ - -#else - - ret = mv_inference_object_detect_open(source, infer, detected_cb, user_data); - -#endif /* MEDIA_VISION_INFERENCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_inference_face_detect( - mv_source_h source, - mv_inference_h infer, - mv_inference_face_detected_cb detected_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(infer); - MEDIA_VISION_NULL_ARG_CHECK(detected_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_INFERENCE_LICENCE_PORT - /* - ret = mv_inference_face_detect_lic(source, infer, detected_cb, user_data); - */ -#else - - ret = mv_inference_face_detect_open(source, infer, detected_cb, user_data); - - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; - -#endif -} - -int mv_inference_facial_landmark_detect( - mv_source_h source, - mv_inference_h infer, - mv_rectangle_s *roi, - mv_inference_facial_landmark_detected_cb detected_cb, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_inference_face_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_INSTANCE_CHECK(infer); - MEDIA_VISION_NULL_ARG_CHECK(detected_cb); - - MEDIA_VISION_FUNCTION_ENTER(); - - int ret = MEDIA_VISION_ERROR_NONE; - -#ifdef MEDIA_VISION_INFERENCE_LICENCE_PORT - /* - ret = mv_inference_facial_landmark_detect_lic(source, infer, detected_cb, user_data); - */ -#else - - ret = mv_inference_facial_landmark_detect_open(source, infer, roi, detected_cb, user_data); - - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; - -#endif -} diff --git a/src/mv_private.c b/src/mv_private.c deleted file mode 100644 index 16ae6a41..00000000 --- a/src/mv_private.c +++ /dev/null @@ -1,261 +0,0 @@ -/** - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <system_info.h> - -#include "mv_private.h" - -bool __mv_check_system_info_feature_supported() -{ - bool isBarcodeDetectionSupported = false; - bool isBarcodeGenerationSupported = false; - bool isFaceRecognitionSupported = false; - bool isImageRecognitionSupported = false; - bool isInferenceImageSupported = false; - bool isInferenceFaceSupported = false; - - const int nRetVal1 = system_info_get_platform_bool( - "http://tizen.org/feature/vision.barcode_detection", - &isBarcodeDetectionSupported); - - if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection"); - return false; - } - - const int nRetVal2 = system_info_get_platform_bool( - "http://tizen.org/feature/vision.barcode_generation", - &isBarcodeGenerationSupported); - - if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation"); - return false; - } - - const int nRetVal3 = system_info_get_platform_bool( - "http://tizen.org/feature/vision.face_recognition", - &isFaceRecognitionSupported); - - if (nRetVal3 != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.face_recognition"); - return false; - } - - const int nRetVal4 = system_info_get_platform_bool( - "http://tizen.org/feature/vision.image_recognition", - &isImageRecognitionSupported); - - if (nRetVal4 != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.image_recognition"); - return false; - } - const int nRetVal5 = system_info_get_platform_bool( - "http://tizen.org/feature/vision.inference.image", - &isInferenceImageSupported); - - if (nRetVal5 != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.inference.image"); - return false; - } - - const int nRetVal6 = system_info_get_platform_bool( - "http://tizen.org/feature/vision.inference.face", - &isInferenceFaceSupported); - - if (nRetVal6 != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.inference.face"); - return false; - } - (isBarcodeDetectionSupported || isBarcodeGenerationSupported || - isFaceRecognitionSupported || isImageRecognitionSupported || - isInferenceImageSupported || isInferenceFaceSupported) ? - LOGI("system_info_get_platform_bool returned" - "Supported one feature among barcode detection, " - "barcode generation, face recognition, " - "image recognition, and inference capability\n") : - LOGE("system_info_get_platform_bool returned" - "Unsupported all features of barcode detection, " - "barcode generation, face recognition, " - "image recognition, inference capability\n") ; - - return (isBarcodeDetectionSupported || isBarcodeGenerationSupported || - isFaceRecognitionSupported || isImageRecognitionSupported || - isInferenceImageSupported || isInferenceFaceSupported); -} - -bool __mv_barcode_detect_check_system_info_feature_supported() -{ - bool isBarcodeDetectionSupported = false; - - const int nRetVal = system_info_get_platform_bool( - "http://tizen.org/feature/vision.barcode_detection", - &isBarcodeDetectionSupported); - - if (nRetVal != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.barcode_detection"); - return false; - } - - isBarcodeDetectionSupported ? - LOGI("system_info_get_platform_bool returned " - "Supported barcode detection feature capability\n") : - LOGE("system_info_get_platform_bool returned " - "Unsupported barcode detection feature capability\n"); - - return isBarcodeDetectionSupported; -} - -bool __mv_barcode_generate_check_system_info_feature_supported() -{ - bool isBarcodeGenerationSupported = false; - - const int nRetVal = system_info_get_platform_bool( - "http://tizen.org/feature/vision.barcode_generation", - &isBarcodeGenerationSupported); - - if (nRetVal != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.barcode_generation"); - return false; - } - - isBarcodeGenerationSupported ? - LOGI("system_info_get_platform_bool returned " - "Supported barcode generation feature capability\n") : - LOGE("system_info_get_platform_bool returned " - "Unsupported barcode generation feature capability\n"); - - return isBarcodeGenerationSupported; -} - -bool __mv_face_check_system_info_feature_supported() -{ - bool isFaceRecognitionSupported = false; - - const int nRetVal = system_info_get_platform_bool( - "http://tizen.org/feature/vision.face_recognition", - &isFaceRecognitionSupported); - - if (nRetVal != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.face_recognition"); - return false; - } - - isFaceRecognitionSupported ? - LOGI("system_info_get_platform_bool returned " - "Supported face recognition feature capability\n") : - LOGE("system_info_get_platform_bool returned " - "Unsupported face recognition feature capability\n"); - - return isFaceRecognitionSupported; -} - -bool __mv_image_check_system_info_feature_supported() -{ - bool isImageRecognitionSupported = false; - - const int nRetVal = system_info_get_platform_bool( - "http://tizen.org/feature/vision.image_recognition", - &isImageRecognitionSupported); - - if (nRetVal != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.image_recognition"); - return false; - } - - isImageRecognitionSupported ? - LOGI("system_info_get_platform_bool returned " - "Supported image recognition feature capability\n") : - LOGE("system_info_get_platform_bool returned " - "Unsupported image recognition feature capability\n"); - - return isImageRecognitionSupported; -} - -bool __mv_inference_check_system_info_feature_supported() -{ - bool isInferenceImageSupported = false; - bool isInferenceFaceSupported = false; - - const int nRetVal1 = system_info_get_platform_bool( - "http://tizen.org/feature/vision.inference.image", - &isInferenceImageSupported); - - if (nRetVal1 != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.inference.image"); - return false; - } - - const int nRetVal2 = system_info_get_platform_bool( - "http://tizen.org/feature/vision.inference.face", - &isInferenceFaceSupported); - - if (nRetVal2 != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.inference.face"); - return false; - } - - (isInferenceImageSupported || isInferenceFaceSupported) ? - LOGI("system_info_get_platform_bool returned " - "Supported inference feature capability\n") : - LOGE("system_info_get_platform_bool returned " - "Unsupported inference feature capability\n"); - - return (isInferenceImageSupported || isInferenceFaceSupported); -} - -bool __mv_inference_image_check_system_info_feature_supported() -{ - bool isInferenceImageSupported = false; - - const int nRetVal = system_info_get_platform_bool( - "http://tizen.org/feature/vision.inference.image", - &isInferenceImageSupported); - - if (nRetVal != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.inference.image"); - return false; - } - - isInferenceImageSupported ? - LOGI("system_info_get_platform_bool returned " - "Supported inference image feature capability\n") : - LOGE("system_info_get_platform_bool returned " - "Unsupported inference image feature capability\n"); - - return isInferenceImageSupported; -} - -bool __mv_inference_face_check_system_info_feature_supported() -{ - bool isInferenceFaceSupported = false; - - const int nRetVal = system_info_get_platform_bool( - "http://tizen.org/feature/vision.inference.face", - &isInferenceFaceSupported); - - if (nRetVal != SYSTEM_INFO_ERROR_NONE) { - LOGE("SYSTEM_INFO_ERROR: vision.inference.face"); - return false; - } - - isInferenceFaceSupported ? - LOGI("system_info_get_platform_bool returned " - "Supported inference face feature capability\n") : - LOGE("system_info_get_platform_bool returned " - "Unsupported inference face feature capability\n"); - - return isInferenceFaceSupported; -} diff --git a/src/mv_surveillance.c b/src/mv_surveillance.c deleted file mode 100644 index 48ebc82c..00000000 --- a/src/mv_surveillance.c +++ /dev/null @@ -1,373 +0,0 @@ -/** - * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "mv_surveillance.h" - -#include "mv_surveillance_private.h" -#include "mv_private.h" - -#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT - -/* Include headers of licensed surveillance module here. */ -#include "mv_surveillance_lic.h" - -#else - -/* Include headers of open surveillance module here. */ -#include "mv_surveillance_open.h" - -#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */ - -/** - * @file mv_surveillance.c - * @brief This file contains the porting layer for Media Vision surveillance module. - */ - -static size_t __mv_surveillance_id_counter = 0; - -int mv_surveillance_event_trigger_create( - const char *event_type, - mv_surveillance_event_trigger_h * trigger) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(event_type); - MEDIA_VISION_NULL_ARG_CHECK(trigger); - MEDIA_VISION_FUNCTION_ENTER(); - - mv_surveillance_event_trigger_s *handle = - (mv_surveillance_event_trigger_s *) malloc( - sizeof(mv_surveillance_event_trigger_s)); - if (NULL == handle) { - LOGE("[%s] malloc fail", __func__); - return MEDIA_VISION_ERROR_OUT_OF_MEMORY; - } - - memset(handle, 0, sizeof(mv_surveillance_event_trigger_s)); - - /* default values: */ - handle->trigger_id = ++__mv_surveillance_id_counter; - handle->event_type = strndup(event_type, 255); - handle->number_of_roi_points = 0; - handle->roi = NULL; - - *trigger = (mv_surveillance_event_trigger_h) handle; - - MEDIA_VISION_FUNCTION_LEAVE(); - return MEDIA_VISION_ERROR_NONE; -} - -int mv_surveillance_event_trigger_destroy( - mv_surveillance_event_trigger_h trigger) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(trigger); - MEDIA_VISION_FUNCTION_ENTER(); - - mv_surveillance_event_trigger_s *handle = - (mv_surveillance_event_trigger_s *) trigger; - free(handle->event_type); - free(handle->roi); - free((mv_surveillance_event_trigger_s *) trigger); - - MEDIA_VISION_FUNCTION_LEAVE(); - return MEDIA_VISION_ERROR_NONE; -} - -int mv_surveillance_get_event_trigger_type( - mv_surveillance_event_trigger_h trigger, - char **event_type) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(trigger); - MEDIA_VISION_NULL_ARG_CHECK(event_type); - MEDIA_VISION_FUNCTION_ENTER(); - - mv_surveillance_event_trigger_s *handle = - (mv_surveillance_event_trigger_s *)trigger; - *event_type = strndup(handle->event_type, 255); - - MEDIA_VISION_FUNCTION_LEAVE(); - return MEDIA_VISION_ERROR_NONE; -} - -int mv_surveillance_set_event_trigger_roi( - mv_surveillance_event_trigger_h trigger, - int number_of_points, - mv_point_s *roi) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(trigger); - MEDIA_VISION_NULL_ARG_CHECK(roi); - MEDIA_VISION_FUNCTION_ENTER(); - - if (number_of_points <= 0) { - LOGE("number of points shoulde be larger than zero"); - return MEDIA_VISION_ERROR_INVALID_PARAMETER; - } - - mv_surveillance_event_trigger_s *handle = - (mv_surveillance_event_trigger_s *)trigger; - - if (handle->roi) { - free(handle->roi); - handle->roi = NULL; - } - - handle->number_of_roi_points = number_of_points; - handle->roi = (mv_point_s*) malloc(sizeof(mv_point_s) * number_of_points); - - if (NULL == handle->roi) { - LOGE("[%s] malloc fail", __func__); - return MEDIA_VISION_ERROR_OUT_OF_MEMORY; - } - - int i = 0; - for (; i < number_of_points; ++i) { - handle->roi[i].x = roi[i].x; - handle->roi[i].y = roi[i].y; - } - - MEDIA_VISION_FUNCTION_LEAVE(); - return MEDIA_VISION_ERROR_NONE; -} - -int mv_surveillance_get_event_trigger_roi( - mv_surveillance_event_trigger_h trigger, - int *number_of_points, - mv_point_s ** roi) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(trigger); - MEDIA_VISION_NULL_ARG_CHECK(number_of_points); - MEDIA_VISION_NULL_ARG_CHECK(roi); - MEDIA_VISION_FUNCTION_ENTER(); - - mv_surveillance_event_trigger_s *handle = - (mv_surveillance_event_trigger_s *) trigger; - - *number_of_points = handle->number_of_roi_points; - if (0 == *number_of_points) { - MEDIA_VISION_FUNCTION_LEAVE(); - return MEDIA_VISION_ERROR_NONE; - } - - *roi = (mv_point_s *) malloc( - sizeof(mv_point_s) * handle->number_of_roi_points); - - int i = 0; - for (; i < handle->number_of_roi_points; ++i) { - (*roi)[i].x = handle->roi[i].x; - (*roi)[i].y = handle->roi[i].y; - } - - MEDIA_VISION_FUNCTION_LEAVE(); - return MEDIA_VISION_ERROR_NONE; -} - -int mv_surveillance_subscribe_event_trigger( - mv_surveillance_event_trigger_h event_trigger, - int video_stream_id, - mv_engine_config_h engine_cfg, - mv_surveillance_event_occurred_cb callback, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(event_trigger); - MEDIA_VISION_NULL_ARG_CHECK(callback); - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT - - /* Use licensed surveillance functionality here. */ - const int ret = mv_surveillance_subscribe_event_trigger_lic( - event_trigger, - video_stream_id, - engine_cfg, - callback, - user_data); - -#else - - /* Use open surveillance functionality here. */ - const int ret = mv_surveillance_subscribe_event_trigger_open( - event_trigger, - video_stream_id, - engine_cfg, - callback, - user_data); - -#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_surveillance_unsubscribe_event_trigger( - mv_surveillance_event_trigger_h event_trigger, - int video_stream_id) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(event_trigger); - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT - - /* Use licensed surveillance functionality here. */ - const int ret = mv_surveillance_unsubscribe_event_trigger_lic( - event_trigger, - video_stream_id); - -#else - - /* Use open surveillance functionality here. */ - const int ret = mv_surveillance_unsubscribe_event_trigger_open( - event_trigger, - video_stream_id); - -#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_surveillance_push_source( - mv_source_h source, - int video_stream_id) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(source); - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT - - /* Use licensed surveillance functionality here. */ - const int ret = mv_surveillance_push_source_lic(source, video_stream_id); - -#else - - /* Use open surveillance functionality here. */ - const int ret = mv_surveillance_push_source_open(source, video_stream_id); - -#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_surveillance_foreach_supported_event_type( - mv_surveillance_event_type_cb callback, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(callback); - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT - - /* Use licensed surveillance functionality here. */ - const int ret = mv_surveillance_foreach_event_type_lic( - callback, - user_data); - -#else - - /* Use open surveillance functionality here. */ - const int ret = mv_surveillance_foreach_event_type_open( - callback, - user_data); - -#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} - -int mv_surveillance_foreach_event_result_name( - const char *event_type, - mv_surveillance_event_result_name_cb callback, - void *user_data) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_NULL_ARG_CHECK(event_type); - MEDIA_VISION_NULL_ARG_CHECK(callback); - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT - - /* Use licensed surveillance functionality here. */ - const int ret = mv_surveillance_foreach_event_result_value_name_lic( - event_type, - callback, - user_data); - -#else - - /* Use open surveillance functionality here. */ - const int ret = mv_surveillance_foreach_event_result_value_name_open( - event_type, - callback, - user_data); - -#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - - return ret; -} - -int mv_surveillance_get_result_value( - mv_surveillance_result_h result, - const char *value_name, - void *value) -{ - MEDIA_VISION_SUPPORT_CHECK(__mv_face_check_system_info_feature_supported()); - MEDIA_VISION_SUPPORT_CHECK(__mv_image_check_system_info_feature_supported()); - MEDIA_VISION_INSTANCE_CHECK(result); - MEDIA_VISION_NULL_ARG_CHECK(value_name); - MEDIA_VISION_NULL_ARG_CHECK(value); - MEDIA_VISION_FUNCTION_ENTER(); - -#ifdef MEDIA_VISION_SURVEILLANCE_LICENSE_PORT - - /* Use licensed surveillance functionality here. */ - const int ret = mv_surveillance_get_result_value_lic( - result, - value_name, - value); - -#else - - /* Use open surveillance functionality here. */ - const int ret = mv_surveillance_get_result_value_open( - result, - value_name, - value); - -#endif /* MEDIA_VISION_SURVEILLANCE_LICENSE_PORT */ - - MEDIA_VISION_FUNCTION_LEAVE(); - return ret; -} |