Tizen 2.1 base
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:45:54 +0000 (01:45 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:45:54 +0000 (01:45 +0900)
43 files changed:
AUTHORS [new file with mode: 0755]
CMakeLists.txt [new file with mode: 0755]
LICENSE.APLv2 [new file with mode: 0755]
NOTICE [new file with mode: 0644]
TC/_export_env.sh [new file with mode: 0755]
TC/_export_target_env.sh [new file with mode: 0755]
TC/build.sh [new file with mode: 0755]
TC/clean.sh [new file with mode: 0755]
TC/config [new file with mode: 0755]
TC/execute.sh [new file with mode: 0755]
TC/testcase/Makefile [new file with mode: 0755]
TC/testcase/tslist [new file with mode: 0755]
TC/testcase/utc_uix_face_attr_negative.c [new file with mode: 0755]
TC/testcase/utc_uix_face_attr_positive.c [new file with mode: 0755]
TC/testcase/utc_uix_face_basic_negative.c [new file with mode: 0755]
TC/testcase/utc_uix_face_basic_positive.c [new file with mode: 0755]
TC/testcase/utc_uix_face_component_negative.c [new file with mode: 0755]
TC/testcase/utc_uix_face_component_positive.c [new file with mode: 0755]
TC/testcase/utc_uix_face_detect_image_negative.c [new file with mode: 0755]
TC/testcase/utc_uix_face_detect_image_positive.c [new file with mode: 0755]
TC/testcase/utc_uix_face_detect_video_negative.c [new file with mode: 0755]
TC/testcase/utc_uix_face_detect_video_positive.c [new file with mode: 0755]
TC/testcase/utc_uix_face_feature_negative.c [new file with mode: 0755]
TC/testcase/utc_uix_face_feature_positive.c [new file with mode: 0755]
TC/testcase/utc_uix_face_image_negative.c [new file with mode: 0755]
TC/testcase/utc_uix_face_image_positive.c [new file with mode: 0755]
TC/tet_scen [new file with mode: 0755]
TC/tetbuild.cfg [new file with mode: 0755]
TC/tetclean.cfg [new file with mode: 0755]
TC/tetexec.cfg [new file with mode: 0755]
capi-uix-face.manifest [new file with mode: 0755]
capi-uix-face.pc.in [new file with mode: 0755]
include/face.h [new file with mode: 0755]
packaging/capi-uix-face.spec [new file with mode: 0755]
src/face-debug.h [new file with mode: 0755]
src/face.c [new file with mode: 0755]
src/face_component.c [new file with mode: 0755]
src/face_feature.c [new file with mode: 0755]
src/face_image.c [new file with mode: 0755]
src/face_priv.c [new file with mode: 0755]
src/face_priv.h [new file with mode: 0755]
src/statistics.c [new file with mode: 0755]
src/statistics.h [new file with mode: 0755]

diff --git a/AUTHORS b/AUTHORS
new file mode 100755 (executable)
index 0000000..a228ba0
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+junghyuk park <junghyuk.park@samsung.com>
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..7f09c24
--- /dev/null
@@ -0,0 +1,102 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-uix-face")
+
+SET(VERSION 0.0.1)
+
+PROJECT(${fw_name} C)
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(
+        ${INC_DIR}
+        src
+)
+
+SET(dependents "face-engine dlog capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+
+FOREACH(flag ${${fw_name}_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+SET(SRCS
+       src/face.c
+       src/face_image.c
+       src/face_feature.c
+       src/face_priv.c
+       src/face_component.c
+)
+
+# ADD_DEFINITIONS("-DMEMWATCH -DMW_STDIO")
+# SET(SRCS ${SRCS} src/memwatch-2.71/memwatch.c)
+
+ADD_DEFINITIONS("-DEXPORT_API=__attribute__ \(\(visibility\(\"default\"\)\)\)")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+message("CFLAGS="${CMAKE_C_FLAGS})
+
+# SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+ADD_LIBRARY(${fw_name} SHARED ${SRCS})
+
+SET_TARGET_PROPERTIES(${fw_name} PROPERTIES SOVERSION ${VERSION} )
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(DIRECTORY ${INC_DIR}/ DESTINATION include/uix
+        FILES_MATCHING
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+)
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${dependents})
+SET(PC_LDFLAGS -lcapi-uix-face)
+SET(PC_CFLAGS -I\${includedir}/uix)
+
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+INSTALL(FILES LICENSE.APLv2 DESTINATION /usr/share/license RENAME ${fw_name})
+
+IF(UNIX)
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND( DEPENDS clean
+
+        COMMENT "distribution clean"
+        COMMAND find
+        ARGS    .
+        -not -name config.cmake -and \(
+        -name tester.c -or
+        -name Testing -or
+        -name CMakeFiles -or
+        -name cmake.depends -or
+        -name cmake.check_depends -or
+        -name CMakeCache.txt -or
+        -name cmake.check_cache -or
+        -name *.cmake -or
+        -name Makefile -or
+        -name core -or
+        -name core.* -or
+        -name gmon.out -or
+        -name install_manifest.txt -or
+        -name *.pc -or
+        -name *~ \)
+        | grep -v TC | xargs rm -rf
+        TARGET  distclean
+        VERBATIM )
+ENDIF(UNIX)
+
diff --git a/LICENSE.APLv2 b/LICENSE.APLv2
new file mode 100755 (executable)
index 0000000..d645695
--- /dev/null
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..1c1a4d0
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) 2012 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License, Version 2 terms and conditions.
diff --git a/TC/_export_env.sh b/TC/_export_env.sh
new file mode 100755 (executable)
index 0000000..72a11ec
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh
new file mode 100755 (executable)
index 0000000..5ddaa53
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755 (executable)
index 0000000..72aad6c
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/clean.sh b/TC/clean.sh
new file mode 100755 (executable)
index 0000000..29743e0
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./                                # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
diff --git a/TC/config b/TC/config
new file mode 100755 (executable)
index 0000000..beb7a60
--- /dev/null
+++ b/TC/config
@@ -0,0 +1,2 @@
+TET_INSTALL_HOST_PATH=/home/rookie/slp_dts/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/slp_dts/TETware
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755 (executable)
index 0000000..a4f6095
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. ./_export_target_env.sh                    # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile
new file mode 100755 (executable)
index 0000000..b69c2cc
--- /dev/null
@@ -0,0 +1,30 @@
+CC = gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = dlog capi-uix-face
+
+#TET_ROOT = /home/idkiller/work/tetware/TETware/tetware-target
+
+ROOT_DIR = /mnt/nfs/slp2.0/api/face/TC/testcase
+
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+LDFLAGS += `pkg-config --libs $(PKGS)`
+
+CFLAGS += `pkg-config --cflags $(PKGS)`
+CFLAGS += -I.
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall -DDATADIR=\"$(ROOT_DIR)/images/\"
+
+#TARGETS = $(C_FILES:%.c=tc-%)
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+       rm -f $(TCS)
diff --git a/TC/testcase/tslist b/TC/testcase/tslist
new file mode 100755 (executable)
index 0000000..99874e5
--- /dev/null
@@ -0,0 +1,21 @@
+/testcase/utc_uix_face_basic_positive
+/testcase/utc_uix_face_basic_negative
+
+/testcase/utc_uix_face_attr_positive
+/testcase/utc_uix_face_attr_negative
+
+/testcase/utc_uix_face_component_positive
+/testcase/utc_uix_face_component_negative
+
+/testcase/utc_uix_face_feature_positive
+/testcase/utc_uix_face_feature_negative
+
+/testcase/utc_uix_face_detect_image_positive
+/testcase/utc_uix_face_detect_image_negative
+
+/testcase/utc_uix_face_detect_video_positive
+/testcase/utc_uix_face_detect_video_negative
+
+/testcase/utc_uix_face_image_positive
+/testcase/utc_uix_face_image_negative
+
diff --git a/TC/testcase/utc_uix_face_attr_negative.c b/TC/testcase/utc_uix_face_attr_negative.c
new file mode 100755 (executable)
index 0000000..d7dbe90
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+/*
+int face_attr_set_max_number_faces(face_h face, int max_faces);
+int face_attr_get_max_number_faces(face_h face, int *max_faces);
+
+int face_attr_set_scale_factor(face_h face, int scale_factor);
+int face_attr_get_scale_factor(face_h face, int *scale_factor);
+
+int face_attr_set_detect_inteval(face_h face, int detect_interval);
+int face_attr_get_detect_inteval(face_h face, int *detect_interval);
+*/
+static void utc_uix_face_attr_set_max_number_faces_negative_01(void)
+{
+       static const char szFunc[] = "face_attr_get_max_number_faces";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       err = face_attr_set_max_number_faces(face, -1);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+
+}
+
+
+static void utc_uix_face_attr_get_max_number_faces_negative_01(void)
+{
+       static const char szFunc[] = "face_attr_get_max_number_faces";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       int out;
+
+       err = face_attr_get_max_number_faces(face, NULL);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+
+}
+
+static void utc_uix_face_attr_set_scale_factor_negative_01(void)
+{
+       static const char szFunc[] = "face_attr_set_scale_factor";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       err = face_attr_set_scale_factor(face, 99);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+}
+
+
+static void utc_uix_face_attr_get_scale_factor_negative_01(void)
+{
+       static const char szFunc[] = "face_attr_set_scale_factor";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       int out;
+
+       err = face_attr_get_scale_factor(face, NULL);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+
+}
+
+static void utc_uix_face_attr_set_detect_inteval_negative_01(void)
+{
+       static const char szFunc[] = "face_attr_set_detect_inteval";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       err = face_attr_set_detect_inteval(face, 0);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+}
+
+static void utc_uix_face_attr_get_detect_inteval_negative_01(void)
+{
+       static const char szFunc[] = "face_attr_get_detect_inteval";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       int out;
+
+       err = face_attr_get_detect_inteval(face, NULL);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+
+}
+
+static void utc_uix_face_attr_get_prefered_colorspace_negative_01(void)
+{
+       static const char szFunc[] = "face_attr_get_prefered_colorspace";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       face_image_colorspace_e colorspace;
+
+       err = face_attr_get_prefered_colorspace(face, NULL);
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_attr_get_prefered_colorspace(NULL, &colorspace);
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+}
+
+
+
+struct tet_testlist tet_testlist[] = {
+       { utc_uix_face_attr_set_max_number_faces_negative_01, 1},
+       { utc_uix_face_attr_get_max_number_faces_negative_01, 2},
+       { utc_uix_face_attr_set_scale_factor_negative_01, 3},
+       { utc_uix_face_attr_get_scale_factor_negative_01, 4},
+       { utc_uix_face_attr_set_detect_inteval_negative_01, 5},
+       { utc_uix_face_attr_get_detect_inteval_negative_01, 6},
+       { utc_uix_face_attr_get_prefered_colorspace_negative_01, 7},
+       { NULL, 0},
+};
+
diff --git a/TC/testcase/utc_uix_face_attr_positive.c b/TC/testcase/utc_uix_face_attr_positive.c
new file mode 100755 (executable)
index 0000000..bd3bf68
--- /dev/null
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+
+
+/*
+int face_attr_set_max_number_faces(face_h face, int max_faces);
+int face_attr_get_max_number_faces(face_h face, int *max_faces);
+
+int face_attr_set_scale_factor(face_h face, int scale_factor);
+int face_attr_get_scale_factor(face_h face, int *scale_factor);
+
+int face_attr_set_detect_inteval(face_h face, int detect_interval);
+int face_attr_get_detect_inteval(face_h face, int *detect_interval);
+*/
+
+static void utc_uix_face_attr_set_max_number_faces_positive_01(void)
+{
+       static const char szFunc[] = "face_attr_get_max_number_faces";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_attr_set_max_number_faces(face, 3);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+
+}
+
+
+static void utc_uix_face_attr_get_max_number_faces_positive_01(void)
+{
+       static const char szFunc[] = "face_attr_get_max_number_faces";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       int out;
+
+       err = face_attr_get_max_number_faces(face, &out);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+
+}
+
+static void utc_uix_face_attr_set_scale_factor_positive_01(void)
+{
+       static const char szFunc[] = "face_attr_set_scale_factor";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_attr_set_scale_factor(face, 3);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+}
+
+
+static void utc_uix_face_attr_get_scale_factor_positive_01(void)
+{
+       static const char szFunc[] = "face_attr_set_scale_factor";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       int out;
+
+       err = face_attr_get_scale_factor(face, &out);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+
+}
+
+static void utc_uix_face_attr_set_detect_inteval_positive_01(void)
+{
+       static const char szFunc[] = "face_attr_set_detect_inteval";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_attr_set_detect_inteval(face, 3);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+}
+
+static void utc_uix_face_attr_get_detect_inteval_positive_01(void)
+{
+       static const char szFunc[] = "face_attr_get_detect_inteval";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       int out;
+
+       err = face_attr_get_detect_inteval(face, &out);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+
+}
+
+static void utc_uix_face_attr_get_prefered_colorspace_positive_01(void)
+{
+       static const char szFunc[] = "face_attr_get_prefered_colorspace";
+
+       face_h face = NULL;
+
+       int err = face_create(&face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_image_colorspace_e colorspace;
+
+       err = face_attr_get_prefered_colorspace(face, &colorspace);
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_destroy(face);
+}
+
+
+
+struct tet_testlist tet_testlist[] = {
+       { utc_uix_face_attr_set_max_number_faces_positive_01, 1},
+       { utc_uix_face_attr_get_max_number_faces_positive_01, 2},
+       { utc_uix_face_attr_set_scale_factor_positive_01, 3},
+       { utc_uix_face_attr_get_scale_factor_positive_01, 4},
+       { utc_uix_face_attr_set_detect_inteval_positive_01, 5},
+       { utc_uix_face_attr_get_detect_inteval_positive_01, 6},
+       { utc_uix_face_attr_get_prefered_colorspace_positive_01, 7},
+       { NULL, 0},
+};
+
+
+
+
diff --git a/TC/testcase/utc_uix_face_basic_negative.c b/TC/testcase/utc_uix_face_basic_negative.c
new file mode 100755 (executable)
index 0000000..46f43da
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+static void utc_uix_face_create_negative_01(void)
+{
+       static const char szFunc[] = "face_create";
+
+       int err = face_create(NULL);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+}
+
+static void utc_uix_face_destroy_negative_01(void)
+{
+       static const char szFunc[] = "face_destroy";
+
+       int err = face_destroy(NULL);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+}
+
+static void utc_uix_face_destroy_negative_02(void)
+{
+       static const char szFunc[] = "face_destroy";
+
+       face_h face;
+
+       int err = face_destroy(face);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+struct tet_testlist tet_testlist[] = {
+       { utc_uix_face_create_negative_01, 1},
+       { utc_uix_face_destroy_negative_01, 2},
+       { utc_uix_face_destroy_negative_02, 3},
+       { NULL, 0},
+};
+
+
diff --git a/TC/testcase/utc_uix_face_basic_positive.c b/TC/testcase/utc_uix_face_basic_positive.c
new file mode 100755 (executable)
index 0000000..3ffeb54
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+face_h face = NULL;
+
+static void utc_uix_face_create_positive_01(void)
+{
+       static const char szFunc[] = "face_create";
+       int err;
+
+    err = face_create(&face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+static void utc_uix_face_destroy_positive_01(void)
+{
+       static const char szFunc[] = "face_destroy";
+
+       face_h face;
+
+       int err = face_create(&face);
+
+       if ( err != FACE_ERROR_NONE)
+       {
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       err = face_destroy(face);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_create_positive_01, 1},
+       { utc_uix_face_destroy_positive_01, 1},
+       { NULL, 0},
+};
+
+
diff --git a/TC/testcase/utc_uix_face_component_negative.c b/TC/testcase/utc_uix_face_component_negative.c
new file mode 100755 (executable)
index 0000000..e906f2c
--- /dev/null
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+static void utc_uix_face_component_create_negative(void)
+{
+       static const char szFunc[] = "face_component_create";
+
+       int err = face_component_create(NULL);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+
+static void utc_uix_face_component_destroy_negative(void)
+{
+       static const char szFunc[] = "face_component_destroy";
+
+       int err;
+
+       err = face_component_destroy(NULL);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+
+}
+
+
+static void utc_uix_face_component_get_face_rect_negative(void)
+{
+       static const char szFunc[] = "face_component_get_face_rect";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       face_rect_s face;
+
+       err = face_component_get_face_rect(NULL, &face);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_component_destroy(face_component);
+}
+
+
+static void utc_uix_face_component_get_left_eye_point_negative(void)
+{
+       static const char szFunc[] = "face_component_get_left_eye_point";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       face_point_s point;
+
+       err = face_component_get_left_eye_point(NULL, &point);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_component_get_left_eye_point(face_component, NULL);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_component_destroy(face_component);
+}
+
+static void utc_uix_face_component_get_right_eye_point_negative(void)
+{
+       static const char szFunc[] = "face_component_get_right_eye_point";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       face_point_s point;
+
+       err = face_component_get_right_eye_point(NULL, &point);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_component_get_right_eye_point(face_component, NULL);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_component_destroy(face_component);
+}
+
+static void utc_uix_face_component_get_mouth_rect_negative(void)
+{
+       static const char szFunc[] = "face_component_get_mouth_rect";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       face_rect_s mouth;
+
+       err = face_component_get_mouth_rect(face_component, NULL);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_component_get_mouth_rect(NULL, &mouth);
+
+       dts_check_lt(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_component_destroy(face_component);
+}
+
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_component_create_negative, 1},
+       { utc_uix_face_component_destroy_negative, 2},
+       { utc_uix_face_component_get_face_rect_negative, 3},
+       { utc_uix_face_component_get_left_eye_point_negative, 4},
+       { utc_uix_face_component_get_right_eye_point_negative, 5},
+       { utc_uix_face_component_get_mouth_rect_negative, 6},
+       { NULL, 0},
+};
+
+
diff --git a/TC/testcase/utc_uix_face_component_positive.c b/TC/testcase/utc_uix_face_component_positive.c
new file mode 100755 (executable)
index 0000000..dc2709a
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+static void utc_uix_face_component_create_positive(void)
+{
+       static const char szFunc[] = "face_component_create";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+}
+
+static void utc_uix_face_component_destroy_positive(void)
+{
+       static const char szFunc[] = "face_component_destroy";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       err = face_component_destroy(face_component);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+}
+
+static void utc_uix_face_component_get_face_rect_positive(void)
+{
+       static const char szFunc[] = "face_component_get_face_rect";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       face_rect_s face;
+
+       err = face_component_get_face_rect(face_component, &face);
+
+    if(err == FACE_ERROR_NONE || err == FACE_ERROR_COMPONENT_NOT_FOUND)
+       {
+               dts_pass(szFunc);
+       }
+       else
+       {
+               dts_fail(szFunc);
+       }
+
+       err = face_component_destroy(face_component);
+}
+
+
+
+static void utc_uix_face_component_get_left_eye_point_positive(void)
+{
+       static const char szFunc[] = "face_component_get_left_eye_point";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       face_point_s point;
+
+       err = face_component_get_left_eye_point(face_component, &point);
+
+    if(err == FACE_ERROR_NONE || err == FACE_ERROR_COMPONENT_NOT_FOUND)
+       {
+               dts_pass(szFunc);
+       }
+       else
+       {
+               dts_fail(szFunc);
+       }
+
+       err = face_component_destroy(face_component);
+}
+
+
+static void utc_uix_face_component_get_right_eye_point_positive(void)
+{
+       static const char szFunc[] = "face_component_get_right_eye_point";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       face_point_s point;
+
+       err = face_component_get_right_eye_point(face_component, &point);
+
+    if(err == FACE_ERROR_NONE || err == FACE_ERROR_COMPONENT_NOT_FOUND)
+       {
+               dts_pass(szFunc);
+       }
+       else
+       {
+               dts_fail(szFunc);
+       }
+
+
+       err = face_component_destroy(face_component);
+}
+
+
+
+static void utc_uix_face_component_get_mouth_rect_positive(void)
+{
+       static const char szFunc[] = "face_component_get_mouth_rect";
+
+       int err;
+
+       face_component_h face_component;
+
+    err = face_component_create(&face_component);
+
+       face_rect_s mouth;
+
+       err = face_component_get_mouth_rect(face_component, &mouth);
+
+    if(err == FACE_ERROR_NONE || err == FACE_ERROR_COMPONENT_NOT_FOUND)
+       {
+               dts_pass(szFunc);
+       }
+       else
+       {
+               dts_fail(szFunc);
+       }
+
+       err = face_component_destroy(face_component);
+}
+
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_component_create_positive, 1},
+       { utc_uix_face_component_destroy_positive, 2},
+       { utc_uix_face_component_get_face_rect_positive, 3},
+       { utc_uix_face_component_get_left_eye_point_positive, 4},
+       { utc_uix_face_component_get_right_eye_point_positive, 5},
+       { utc_uix_face_component_get_mouth_rect_positive, 6},
+       { NULL, 0},
+};
+
+
diff --git a/TC/testcase/utc_uix_face_detect_image_negative.c b/TC/testcase/utc_uix_face_detect_image_negative.c
new file mode 100755 (executable)
index 0000000..9e716b5
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+#define TESTIMAGE_NAME (DATADIR"GroupPic.jpg_450x300.raw")
+#define TESTIMAGE_WIDTH (450)
+#define TESTIMAGE_HEIGHT (300)
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+static void _check_positive(int error, const char *api_name)
+{
+    if(error != 0)
+       {
+        dts_fail(api_name);
+    }
+    else
+       {
+        dts_pass(api_name);
+    }
+
+}
+
+static void _check_negative(int error, const char *api_name)
+{
+    if(error != 0)
+       {
+        dts_pass(api_name);
+    }
+    else
+       {
+        dts_fail(api_name);
+    }
+}
+
+static void utc_uix_face_detect_faces_from_still_image_negative_01(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_still_image";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, NULL, &rects, &nCount );
+
+
+       _check_negative(err, szFunc);
+
+       err = face_destroy(face);
+
+       fclose(fp);
+}
+
+
+static void utc_uix_face_detect_faces_from_still_image_negative_02(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_still_image";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_image_h image;
+
+       face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, image, &rects, NULL );
+
+       _check_negative(err, szFunc);
+
+       err = face_destroy(face);
+
+       fclose(fp);
+}
+
+
+static void utc_uix_face_detect_faces_from_still_image_negative_03(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_still_image";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+
+       face_image_h image;
+
+       face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, image, NULL, &nCount );
+
+       _check_negative(err, szFunc);
+
+       err = face_destroy(face);
+
+       fclose(fp);
+}
+
+static void utc_uix_face_detect_faces_from_still_image_negative_04(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_still_image";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+       err = face_destroy(face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_image_h image;
+
+       face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, image, &rects, &nCount );
+
+       _check_negative(err, szFunc);
+
+       fclose(fp);
+}
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_detect_faces_from_still_image_negative_01, 1},
+    { utc_uix_face_detect_faces_from_still_image_negative_02, 2},
+    { utc_uix_face_detect_faces_from_still_image_negative_03, 3},
+       { utc_uix_face_detect_faces_from_still_image_negative_04, 4},
+       { NULL, 0},
+};
+
+
diff --git a/TC/testcase/utc_uix_face_detect_image_positive.c b/TC/testcase/utc_uix_face_detect_image_positive.c
new file mode 100755 (executable)
index 0000000..e5e49ef
--- /dev/null
@@ -0,0 +1,416 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <unistd.h>
+
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+#define TESTIMAGE_NAME (DATADIR"GroupPic.jpg_450x300.raw")
+#define TESTIMAGE_WIDTH (450)
+#define TESTIMAGE_HEIGHT (300)
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+static void utc_uix_face_detect_faces_from_still_image_positive(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_still_image";
+
+       printf("Image path : %s\n", TESTIMAGE_NAME);
+       int err;
+
+       face_h face;
+    err = face_create(&face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot open image %s\n", filename);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       fclose(fp);
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_image_h image;
+
+       face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, image, &rects, &nCount );
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_destroy(face);
+
+}
+
+static void utc_uix_face_extract_component_positive(void)
+{
+       static const char szFunc[] = "face_extract_component";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot open image %s\n", TESTIMAGE_NAME);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       fclose(fp);
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+
+       face_image_h image;
+
+       face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, image, &rects, &nCount );
+
+       if ( err != FACE_ERROR_NONE )
+       {
+               tet_printf("Cannot detect faces. err=%d\n", err);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       if ( nCount == 0 )
+       {
+               tet_printf("None is detected.");
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_component_h component;
+
+       err = face_extract_component(face, image, &rects[0], &component);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       free(rects);
+       face_component_destroy(component);
+       err = face_destroy(face);
+
+}
+
+static void utc_uix_face_extract_feature_positive(void)
+{
+       static const char szFunc[] = "face_extract_feature";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot open image %s\n", TESTIMAGE_NAME);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       fclose(fp);
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_image_h image;
+
+       face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, image, &rects, &nCount );
+
+       if ( err != FACE_ERROR_NONE )
+       {
+               tet_printf("Cannot detect faces. err=%d\n", err);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       if ( nCount == 0 )
+       {
+               tet_printf("None is detected.");
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_component_h component;
+
+       err = face_extract_component(face, image, &rects[0], &component);
+
+       face_feature_h feature;
+
+       err = face_extract_feature(face, image, component, &feature);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_component_destroy(component);
+
+       face_feature_destroy(feature);
+
+       err = face_destroy(face);
+}
+
+
+static void utc_uix_face_recognize_blink_positive(void)
+{
+       static const char szFunc[] = "face_recognize_blink";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot open image %s\n", TESTIMAGE_NAME);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       fclose(fp);
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_image_h image;
+
+       face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, image, &rects, &nCount );
+
+       if ( err != FACE_ERROR_NONE )
+       {
+               tet_printf("Cannot detect faces. err=%d\n", err);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       if ( nCount == 0 )
+       {
+               tet_printf("None is detected.");
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_component_h component;
+
+       err = face_extract_component(face, image, &rects[0], &component);
+
+       face_eye_state_e lefteye, righteye;
+
+       err = face_recognize_blink(face, image, component, &lefteye,  &righteye);
+
+       face_component_destroy(component);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_destroy(face);
+}
+
+
+
+static void utc_uix_face_recognize_faceexpression_positive(void)
+{
+       static const char szFunc[] = "face_recognize_faceexpression";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTIMAGE_NAME;
+       int nW = TESTIMAGE_WIDTH;
+       int nH = TESTIMAGE_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot open image %s\n", TESTIMAGE_NAME);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       nRead = fread (YBuf, 1, nW * nH, fp );
+
+       fclose(fp);
+
+       if ( nRead != nW * nH )
+       {
+               // Error
+               tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+               tet_result(TET_UNRESOLVED);
+               return ;
+       }
+
+       face_image_h image;
+
+       face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       err = face_detect_faces(face, FACE_IMAGE_TYPE_SINGLE, image, &rects, &nCount );
+
+       face_component_h component;
+
+       err = face_extract_component(face, image, &rects[0], &component);
+
+
+       face_expression_e expr;
+
+       err = face_recognize_expression(face, image, component, &expr);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_destroy(face);
+
+
+}
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_detect_faces_from_still_image_positive, 1},
+    { utc_uix_face_extract_component_positive, 2},
+    { utc_uix_face_extract_feature_positive, 3},
+    { utc_uix_face_recognize_blink_positive, 4},
+    { utc_uix_face_recognize_faceexpression_positive, 5},
+       { NULL, 0},
+};
+
+
diff --git a/TC/testcase/utc_uix_face_detect_video_negative.c b/TC/testcase/utc_uix_face_detect_video_negative.c
new file mode 100755 (executable)
index 0000000..b70f074
--- /dev/null
@@ -0,0 +1,922 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+
+#define TESTVIDEO_NAME (DATADIR"suzie_qcif.yuv")
+#define TESTVIDEO_WIDTH (176)
+#define TESTVIDEO_HEIGHT (144)
+#define TESTVIDEO_FRAME (10)
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+static void utc_uix_face_detect_faces_from_video_stream_negative_01(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_video_stream";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       int i;
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, NULL, &nCount );
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+static void utc_uix_face_detect_faces_from_video_stream_negative_02(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_video_stream";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       int i;
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, NULL );
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+
+
+static void utc_uix_face_detect_faces_from_video_stream_negative_03(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_video_stream";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       int i;
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, NULL, &rects, &nCount );
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+
+static void utc_uix_face_extract_component_negative_01(void)
+{
+       static const char szFunc[] = "face_extract_component";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, NULL, &rects[0], &component);
+
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+
+               free(rects);
+
+               face_component_destroy(component);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+}
+
+
+static void utc_uix_face_extract_component_negative_02(void)
+{
+       static const char szFunc[] = "face_extract_component";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, NULL, &component);
+
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+
+               free(rects);
+
+               face_component_destroy(component);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+}
+
+
+
+static void utc_uix_face_extract_component_negative_03(void)
+{
+       static const char szFunc[] = "face_extract_component";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, NULL, &rects[0], &component);
+
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+
+               free(rects);
+
+               face_component_destroy(component);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+}
+
+
+static void utc_uix_face_extract_component_negative_04(void)
+{
+       static const char szFunc[] = "face_extract_component";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, &rects[0], NULL);
+
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+
+               free(rects);
+
+               face_component_destroy(component);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+}
+
+static void utc_uix_face_extract_feature_negative_01(void)
+{
+       static const char szFunc[] = "face_extract_feature";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+       face_feature_h feature;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, &rects[0], &component);
+
+               err = face_extract_feature(face, image, NULL, &feature);
+
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);             // Face feature func does not support continuous frame
+
+               free(rects);
+
+               face_image_destroy(image);
+
+               face_component_destroy(component);
+
+               if ( feature != NULL ) face_feature_destroy(feature);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+
+static void utc_uix_face_recognize_blink_negative_01(void)
+{
+       static const char szFunc[] = "face_recognize_blink";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+       face_eye_state_e lefteye, righteye;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, &rects[0], &component);
+
+               err = face_recognize_blink(face, NULL, component, &lefteye,  &righteye);
+
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+
+               free(rects);
+               face_component_destroy(component);
+
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+static void utc_uix_face_recognize_expression_negative_01(void)
+{
+       static const char szFunc[] = "face_recognize_expression";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+       face_expression_e expr;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, &rects[0], &component);
+
+               err = face_recognize_expression(face, image, NULL, &expr);
+
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(image);
+
+               free(rects);
+               face_component_destroy(component);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+static void utc_uix_face_get_movement_negative_01(void)
+{
+       static const char szFunc[] = "face_get_movement";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[2][TESTVIDEO_WIDTH*TESTVIDEO_HEIGHT];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+       face_image_h prev_image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       face_rect_s prev_rect;
+       face_rect_s cur_rect;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf[i%2], 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       fclose(fp);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf[i%2], nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       fclose(fp);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       // rects is NULL when count is 0
+                       continue;
+               }
+
+               if ( i == 0 )
+               {
+                       prev_image = image;
+                       prev_rect = rects[0];
+
+                       free(rects);
+                       continue;       // Skip first frame
+               }
+
+               err = face_get_movement(face, prev_image, NULL, NULL, &cur_rect);
+
+               dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(prev_image);
+
+               prev_rect = rects[0];
+               prev_image = image;
+
+               free(rects);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_detect_faces_from_video_stream_negative_01, 1},
+       { utc_uix_face_detect_faces_from_video_stream_negative_02, 1},
+    { utc_uix_face_detect_faces_from_video_stream_negative_03, 1},
+    { utc_uix_face_extract_component_negative_01, 2},
+    { utc_uix_face_extract_component_negative_02, 2},
+    { utc_uix_face_extract_component_negative_03, 2},
+    { utc_uix_face_extract_component_negative_04, 2},
+    { utc_uix_face_extract_feature_negative_01, 3},
+    { utc_uix_face_recognize_blink_negative_01, 4},
+    { utc_uix_face_recognize_expression_negative_01, 5},
+       { utc_uix_face_get_movement_negative_01, 6},
+       { NULL, 0},
+};
+
diff --git a/TC/testcase/utc_uix_face_detect_video_positive.c b/TC/testcase/utc_uix_face_detect_video_positive.c
new file mode 100755 (executable)
index 0000000..23bfb00
--- /dev/null
@@ -0,0 +1,552 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+#define TESTVIDEO_NAME (DATADIR"suzie_qcif.yuv")
+#define TESTVIDEO_WIDTH (176)
+#define TESTVIDEO_HEIGHT (144)
+#define TESTVIDEO_FRAME (10)
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+static void utc_uix_face_detect_faces_from_video_stream_positive(void)
+{
+       static const char szFunc[] = "face_detect_faces_from_video_stream";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       int i;
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+               free(rects);
+
+               face_image_destroy(image);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+static void utc_uix_face_extract_component_positive(void)
+{
+       static const char szFunc[] = "face_extract_component";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, &rects[0], &component);
+
+               dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+               free(rects);
+
+               face_image_destroy(image);
+               face_component_destroy(component);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+}
+
+static void utc_uix_face_extract_feature_positive(void)
+{
+       static const char szFunc[] = "face_extract_feature";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+       face_feature_h feature;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, &rects[0], &component);
+
+               err = face_extract_feature(face, image, component, &feature);
+
+               dts_check_eq(szFunc, err, FACE_ERROR_NONE);     
+
+               free(rects);
+
+               face_component_destroy(component);
+
+               face_image_destroy(image);
+
+               if ( feature != NULL ) face_feature_destroy(feature);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+
+static void utc_uix_face_recognize_blink_positive(void)
+{
+       static const char szFunc[] = "face_recognize_blink";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+       face_eye_state_e lefteye, righteye;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, &rects[0], &component);
+
+               err = face_recognize_blink(face, image, component, &lefteye,  &righteye);
+
+               dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+               free(rects);
+               face_component_destroy(component);
+
+               face_image_destroy(image);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+
+
+static void utc_uix_face_recognize_expression_positive(void)
+{
+       static const char szFunc[] = "face_recognize_expression";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[nW*nH];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+       face_component_h component;
+       face_expression_e expr;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf, 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf, nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       continue;
+               }
+
+               err = face_extract_component(face, image, &rects[0], &component);
+
+               err = face_recognize_expression(face, image, component, &expr);
+
+               dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+
+               face_image_destroy(image);
+
+               free(rects);
+               face_component_destroy(component);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+
+static void utc_uix_face_get_movement_positive(void)
+{
+       static const char szFunc[] = "face_get_movement";
+
+       int err;
+
+       face_h face;
+
+    err = face_create(&face);
+
+       char *filename = TESTVIDEO_NAME;
+       int nW = TESTVIDEO_WIDTH;
+       int nH = TESTVIDEO_HEIGHT;
+
+       unsigned char YBuf[2][TESTVIDEO_WIDTH*TESTVIDEO_HEIGHT];
+
+       FILE *fp;
+       int nRead;
+
+       fp = fopen(filename, "rb");
+       if ( fp == NULL )
+       {
+               tet_printf("Cannot load file. %s", filename);
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       face_image_h image;
+       face_image_h prev_image = NULL;
+
+       int nCount = 0;
+
+       face_rect_s *rects = NULL;
+
+       face_rect_s prev_rect;
+       face_rect_s cur_rect;
+
+       int i;
+
+       for ( i = 0; i < TESTVIDEO_FRAME; i++)
+       {
+               nRead = fread (YBuf[i%2], 1, nW * nH, fp );
+
+               if ( nRead != nW * nH )
+               {
+                       // Error
+                       tet_printf("Wanted %d bytes Read %d bytes\n", nW * nH, nRead);
+                       tet_result(TET_UNRESOLVED);
+                       fclose(fp);
+                       return ;
+               }
+
+               face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, YBuf[i%2], nW, nH, nW * nH, &image);
+
+               err = face_detect_faces(face, FACE_IMAGE_TYPE_CONTINUOUS, image, &rects, &nCount );
+
+               if ( err != FACE_ERROR_NONE )
+               {
+                       tet_printf("[F:%20s L%4d] Detect face Error! err=%d\n", __FUNCTION__, __LINE__, err);
+                       tet_result(TET_UNRESOLVED);
+                       fclose(fp);
+                       return ;
+               }
+
+               if ( nCount == 0 )
+               {
+                       // rects is NULL in here.
+                       continue;
+               }
+
+               if ( i == 0 )
+               {
+                       prev_image = image;
+                       prev_rect = rects[0];
+
+                       free(rects);
+                       continue;       // Skip first frame
+               }
+
+               err = face_get_movement(face, prev_image, image, &prev_rect, &cur_rect);
+
+               dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+               face_image_destroy(prev_image);
+
+               prev_rect = rects[0];
+               prev_image = image;
+
+               free(rects);
+       }
+
+       err = face_destroy(face);
+
+       fclose(fp);
+
+}
+
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_detect_faces_from_video_stream_positive, 1},
+    { utc_uix_face_extract_component_positive, 2},
+    { utc_uix_face_extract_feature_positive, 3},
+    { utc_uix_face_recognize_blink_positive, 4},
+    { utc_uix_face_recognize_expression_positive, 5},
+       { utc_uix_face_get_movement_positive, 6},
+       { NULL, 0},
+};
+
+
diff --git a/TC/testcase/utc_uix_face_feature_negative.c b/TC/testcase/utc_uix_face_feature_negative.c
new file mode 100755 (executable)
index 0000000..cd6a595
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+
+static unsigned char szfeature[] = "dsakerwi8fjfrjlfnvnew9384237jl49rfk4kjfnl3jj4";
+
+static void utc_uix_face_face_feature_create_negative_01(void)
+{
+       static const char szFunc[] = "face_feature_create";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(NULL);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+}
+
+static void utc_uix_face_feature_destroy_negative_01(void)
+{
+       static const char szFunc[] = "face_feature_create";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       err = face_feature_destroy(face_feature);
+
+       err = face_feature_destroy(face_feature);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+static void utc_uix_face_feature_destroy_negative_02(void)
+{
+       static const char szFunc[] = "face_feature_destroy";
+
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_destroy(NULL);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+static void utc_uix_face_face_feature_set_data_negative_01(void)
+{
+       static const char szFunc[] = "face_face_feature_set_data";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       int size = (int)strlen(szfeature);
+
+       err = face_feature_set_data(NULL, szfeature, size);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_feature_set_data(face_feature, NULL, size);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_feature_set_data(face_feature, szfeature, 0);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_feature_destroy(face_feature);
+}
+
+
+static void utc_uix_face_feature_get_data_negative_01(void)
+{
+       static const char szFunc[] = "face_feature_get_data";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       int size = (int)strlen(szfeature);
+
+       err = face_feature_set_data(face_feature, szfeature, size);
+
+
+       unsigned char *data;
+       int len;
+
+       err = face_feature_get_data(NULL, &data, &len);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_feature_get_data(face_feature, NULL, &len);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_feature_get_data(face_feature, &data, NULL);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+
+       face_feature_destroy(face_feature);
+
+}
+
+static void utc_uix_face_compare_feature_negative_01(void)
+{
+       static const char szFunc[] = "face_compare_feature";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       int size = (int)strlen(szfeature);
+
+       err = face_feature_set_data(face_feature, szfeature, size);
+
+       int similarity;
+
+       err = face_compare_feature(face_feature, NULL, &similarity);
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_compare_feature(NULL, NULL, &similarity);
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       err = face_compare_feature(NULL, NULL, NULL);
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_feature_destroy(face_feature);
+
+}
+
+
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_face_feature_create_negative_01, 1},
+       { utc_uix_face_feature_destroy_negative_01, 2},
+       { utc_uix_face_feature_destroy_negative_02, 2},
+       { utc_uix_face_face_feature_set_data_negative_01, 3},
+       { utc_uix_face_feature_get_data_negative_01, 4},
+       { utc_uix_face_compare_feature_negative_01, 5},
+       { NULL, 0},
+};
+
diff --git a/TC/testcase/utc_uix_face_feature_positive.c b/TC/testcase/utc_uix_face_feature_positive.c
new file mode 100755 (executable)
index 0000000..ec0294c
--- /dev/null
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+static unsigned char szfeature[] = "dsakerwi8fjfrjlfnvnew9384237jl49rfk4kjfnl3jj4";
+
+static void utc_uix_face_face_feature_create_positive(void)
+{
+       static const char szFunc[] = "face_feature_create";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+}
+
+static void utc_uix_face_feature_destroy_positive(void)
+{
+       static const char szFunc[] = "face_feature_destroy";
+
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       face_feature_destroy(face_feature);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+static void utc_uix_face_face_feature_set_data_positive(void)
+{
+       static const char szFunc[] = "face_face_feature_set_data";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       int size = (int)strlen(szfeature);
+
+       err = face_feature_set_data(face_feature, szfeature, size);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_feature_destroy(face_feature);
+}
+
+
+static void utc_uix_face_feature_get_data_positive(void)
+{
+       static const char szFunc[] = "face_feature_get_data";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       int size = (int)strlen(szfeature);
+
+       err = face_feature_set_data(face_feature, szfeature, size);
+
+       unsigned char *data;
+       int len;
+
+       err = face_feature_get_data(face_feature, &data, &len);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_feature_destroy(face_feature);
+
+}
+
+
+static void utc_uix_face_compare_feature_positive(void)
+{
+       static const char szFunc[] = "face_compare_feature";
+       int err;
+
+       face_feature_h face_feature;
+
+       err = face_feature_create(&face_feature);
+
+       int size = (int)strlen(szfeature);
+
+       err = face_feature_set_data(face_feature, szfeature, size);
+
+       int similarity;
+
+       err = face_compare_feature(face_feature, face_feature, &similarity);
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_feature_destroy(face_feature);
+
+}
+
+
+
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_face_feature_create_positive, 1},
+       { utc_uix_face_feature_destroy_positive, 2},
+       { utc_uix_face_face_feature_set_data_positive, 3},
+       { utc_uix_face_feature_get_data_positive, 4},
+       { utc_uix_face_compare_feature_positive, 5},
+       { NULL, 0},
+};
+
+
diff --git a/TC/testcase/utc_uix_face_image_negative.c b/TC/testcase/utc_uix_face_image_negative.c
new file mode 100755 (executable)
index 0000000..0a0dc1f
--- /dev/null
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+
+static void utc_uix_face_image_create_negative_01(void)
+{
+       static const char szFunc[] = "face_image_create";
+
+       unsigned char *dummy = (unsigned char *)calloc(1, 176 * 144);
+
+       if ( dummy == NULL )
+       {
+               tet_printf("Cannot allocated memory");
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       int err;
+
+       face_image_h face_image;
+
+       err = face_image_create((face_image_colorspace_e)99, dummy, 176, 144, 176 * 144, &face_image);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_image_destroy(face_image);
+
+       free(dummy);
+
+}
+
+static void utc_uix_face_image_create_negative_02(void)
+{
+       static const char szFunc[] = "face_image_create";
+
+       unsigned char *dummy = (unsigned char *)calloc(1, 176 * 144);
+
+       if ( dummy == NULL )
+       {
+               tet_printf("Cannot allocated memory");
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       int err;
+       face_image_h face_image;
+
+       err = face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, NULL, 176, 144, 176 * 144, &face_image);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_image_destroy(face_image);
+
+       free(dummy);
+
+}
+
+
+static void utc_uix_face_image_create_negative_03(void)
+{
+       static const char szFunc[] = "face_image_create";
+
+       unsigned char *dummy = (unsigned char *)calloc(1, 176 * 144);
+
+       if ( dummy == NULL )
+       {
+               tet_printf("Cannot allocated memory");
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       int err;
+       face_image_h face_image;
+
+       err = face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, dummy, -1, 144, 176 * 144, &face_image);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_image_destroy(face_image);
+
+       free(dummy);
+
+}
+
+
+
+
+static void utc_uix_face_image_create_negative_04(void)
+{
+       static const char szFunc[] = "face_image_create";
+
+       unsigned char *dummy = (unsigned char *)calloc(1, 176 * 144);
+
+       if ( dummy == NULL )
+       {
+               tet_printf("Cannot allocated memory");
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       int err;
+       face_image_h face_image;
+
+       err = face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, dummy, 176, -1, 176 * 144, &face_image);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_image_destroy(face_image);
+
+       free(dummy);
+
+}
+
+
+
+static void utc_uix_face_image_create_negative_05(void)
+{
+       static const char szFunc[] = "face_image_create";
+
+       unsigned char *dummy = (unsigned char *)calloc(1, 176 * 144);
+
+       if ( dummy == NULL )
+       {
+               tet_printf("Cannot allocated memory");
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       int err;
+       face_image_h face_image;
+
+       err = face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, dummy, 176, 144, 176 * 144, NULL);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+
+       face_image_destroy(face_image);
+
+       free(dummy);
+
+}
+
+
+static void utc_uix_face_image_destroy_negative_01(void)
+{
+       static const char szFunc[] = "face_image_destroy";
+
+       int err;
+
+       err = face_image_destroy(NULL);
+
+       dts_check_ne(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+
+
+struct tet_testlist tet_testlist[] = {
+       { utc_uix_face_image_create_negative_01, 1},
+       { utc_uix_face_image_create_negative_02, 1},
+       { utc_uix_face_image_create_negative_03, 1},
+       { utc_uix_face_image_create_negative_04, 1},
+       { utc_uix_face_image_create_negative_05, 1},
+       { utc_uix_face_image_destroy_negative_01, 2},
+       { NULL, 0},
+};
+
diff --git a/TC/testcase/utc_uix_face_image_positive.c b/TC/testcase/utc_uix_face_image_positive.c
new file mode 100755 (executable)
index 0000000..96be463
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <tet_api.h>
+
+#include <face.h>
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void startup(void)
+{
+// TODO : How to copy sample image????
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+static void utc_uix_face_image_create_positive(void)
+{
+       static const char szFunc[] = "face_image_create";
+
+       int err;
+
+       face_image_h face_image;
+
+       unsigned char *dummy = (unsigned char *)calloc(1, 176 * 144);
+
+       if ( dummy == NULL )
+       {
+               tet_printf("Cannot allocated memory");
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       err = face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, dummy, 176, 144, 176 * 144, &face_image);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+
+       face_image_destroy(face_image);
+
+}
+
+static void utc_uix_face_image_destroy_positive(void)
+{
+       static const char szFunc[] = "face_image_destroy";
+
+       int err;
+
+       face_image_h face_image;
+
+       unsigned char *dummy = (unsigned char *)calloc(1, 176 * 144);
+
+       if ( dummy == NULL )
+       {
+               tet_printf("Cannot allocated memory");
+               tet_result(TET_UNRESOLVED);
+               return;
+       }
+
+       err = face_image_create(FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY, dummy, 176, 144, 176 * 144, &face_image);
+
+       err = face_image_destroy(face_image);
+
+       dts_check_eq(szFunc, err, FACE_ERROR_NONE);
+}
+
+
+
+struct tet_testlist tet_testlist[] = {
+    { utc_uix_face_image_create_positive, 1},
+       { utc_uix_face_image_destroy_positive, 2},
+       { NULL, 0},
+};
+
+
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100755 (executable)
index 0000000..de0b6b0
--- /dev/null
@@ -0,0 +1,12 @@
+all
+       "Starting all scenario for capi-face"
+
+       ^TEST
+
+       "Done test for capi-face"
+
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+       :include:/testcase/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100755 (executable)
index 0000000..f7eda55
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100755 (executable)
index 0000000..02d7030
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage 
+TET_PASS_TC_NAME=True # showing name , passed TC
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100755 (executable)
index 0000000..ef3e452
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL=  # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE=   # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
diff --git a/capi-uix-face.manifest b/capi-uix-face.manifest
new file mode 100755 (executable)
index 0000000..a76fdba
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
diff --git a/capi-uix-face.pc.in b/capi-uix-face.pc.in
new file mode 100755 (executable)
index 0000000..917265a
--- /dev/null
@@ -0,0 +1,15 @@
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/uix
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@ 
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} @PC_CFLAGS@
+
diff --git a/include/face.h b/include/face.h
new file mode 100755 (executable)
index 0000000..7e4c754
--- /dev/null
@@ -0,0 +1,550 @@
+/*
+ * Copyright (c) 2011 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.
+ */
+#ifndef __TIZEN_UIX_FACE_H__
+#define __TIZEN_UIX_FACE_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup CAPI_UIX_FACE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Facial engine handle.
+ */
+typedef struct face_s *face_h;
+
+/**
+ * @brief Face image handle containing the input image data.
+ */
+typedef struct face_image_s *face_image_h;
+
+/**
+ * @brief Facial component handle.
+ */
+typedef struct face_component_s *face_component_h;
+
+/**
+ * @brief Facial feature handle.
+ */
+typedef struct face_feature_s *face_feature_h;
+
+/**
+ * @brief Enumerations of error codes for the Facial Engine API.
+ */
+typedef enum {
+       FACE_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+       FACE_ERROR_INVALID_PARAMTER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       FACE_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+       FACE_ERROR_ENGINE_NOT_FOUND = TIZEN_ERROR_UIX_CLASS | 0x41, /**< Facial engine not found */
+       FACE_ERROR_OPERATION_FAILED = TIZEN_ERROR_UIX_CLASS | 0x42, /**< Operation failed */
+       FACE_ERROR_COMPONENT_NOT_FOUND = TIZEN_ERROR_UIX_CLASS | 0x43, /**< Component not found */
+} face_error_e;
+
+/**
+ * @brief Enumerations of color spaces
+ * @see face_image_create()
+ * @see face_attr_get_prefered_colorspace()
+ *
+ */
+typedef enum {
+       FACE_IMAGE_COLORSPACE_YUV420,                   /**< Y:U:V = 4:2:0 */
+       FACE_IMAGE_COLORSPACE_RGB565,                   /**< RGB565, high-byte is Blue  */
+       FACE_IMAGE_COLORSPACE_BGRA8888,                 /**< BGRA8888, high-byte is Alpha */
+       FACE_IMAGE_COLORSPACE_RGBA8888,                 /**< RGBA8888, high-byte is Alpha */
+       FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY,           /**< luminance only image */
+} face_image_colorspace_e;
+
+/**
+ * @brief Enumerations of facial expressions
+ * @see face_recognize_expression()
+ */
+typedef enum {
+       FACE_EXPRESSION_UNKNOWN,                /**< Unknown expression */
+       FACE_EXPRESSION_NUETRAL,                /**< Normal expression */
+       FACE_EXPRESSION_ANGRY,          /**< Angry expression */
+       FACE_EXPRESSION_SMILE,                  /**< Cheerful expression */
+       FACE_EXPRESSION_SURPRISE,               /**< Suprised expression */
+} face_expression_e;
+
+/**
+ * @brief Enumerations of eye states
+ * @see face_recognize_blink()
+ */
+typedef enum {
+       FACE_EYE_STATE_UNKNOWN,         /**< The no eye state, when the eye detect fails */
+       FACE_EYE_STATE_OPENED,          /**< The state when eye is opened */
+       FACE_EYE_STATE_CLOSED,          /**< The state when eye is closed */
+} face_eye_state_e;
+
+/**
+ * @brief Enumerations of image types
+ * @see face_detect_faces()
+ */
+typedef enum {
+       FACE_IMAGE_TYPE_SINGLE, /**< still image */
+       FACE_IMAGE_TYPE_CONTINUOUS,     /**< video frame */
+} face_image_type_e;
+
+/**
+ * @brief Enumerations for face detection option.
+ * @see face_attr_set_detect_mode(), face_attr_get_detect_mode()
+ */
+typedef enum {
+       FACE_DETECT_MODE_FAST,  /**<  Mode to detect faces as fast as possible even if the accuracy is low  */
+       FACE_DETECT_MODE_ROBUST,        /**< Mode to detect faces as accurate as possible even if it takes more time */
+} face_detect_mode_e;
+
+/**
+ * @brief Represents a rectangular region in a coordinate space
+ */
+typedef struct {
+       int x;          /**< The x coordinate of the top-left corner of the rectangle  */
+       int y;          /**< The y coordinate of the top-left corner of the rectangle  */
+       int w;          /**< The width of the rectangle  */
+       int h;          /**< The height of the rectangle  */
+} face_rect_s;
+
+
+/**
+ * @brief Represents a location in a two-dimensional coordinate space
+ */
+typedef struct {
+       int x;          /**< The x-coordinate */
+       int y;          /**< The y-coordinate */
+} face_point_s;
+
+/**
+ * @brief Creates a facial feature handle.
+ * @details Creates a facial feature handle to represent a recognized face
+ * @remarks The @a face_feature must be released with face_feature_destroy() by you.
+ * @param[out] face_feature A facial feature handle to be newly created on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_OUT_OF_MEMORY   Out of memory
+ * @see face_feature_destroy()
+ */
+int face_feature_create(face_feature_h *face_feature);
+
+/**
+ * @brief Destroys the facial feature handle.
+ * @param[in] face_feature The facial feature handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @see face_feature_create()
+ */
+int face_feature_destroy(face_feature_h face_feature);
+
+/**
+ * @brief Sets the raw data to initialize the facial feature
+ * @remarks The @a data must be from face_feature_get_data()
+ * @param[in] face_feature The facial feature handle
+ * @param[in] data The data of facial feature
+ * @param[in] length The length of facial feature data
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_OUT_OF_MEMORY   Out of memory
+ * @see face_feature_get_data()
+ */
+int face_feature_set_data(face_feature_h face_feature, const unsigned char *data, int length);
+
+/**
+ * @brief Gets the raw data of the facial feature
+ * @remarks The @a data must be released with free() by you.
+ * @param[in] face_feature The facial feature handle
+ * @param[out] data The data of facial feature
+ * @param[out] length The length of facial feature data
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @see face_feature_set_data()
+ */
+int face_feature_get_data(face_feature_h face_feature, unsigned char **data, int *length);
+
+/**
+ * @brief Creates a face image handle containing the input image data
+ * @remarks The @a face_image must be released with face_image_destroy() by you.
+ * @remarks The @a buffer must not be released until @a face_image is released with face_image_destroy()
+ * @param[in] colorspace The colorspace of the image
+ * @param[in] buffer The buffer containing the image
+ * @param[in] width The width of the image
+ * @param[in] height The height of the image
+ * @param[in] size The size of the buffer
+ * @param[out] face_image The face image handle to be newly created on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_OUT_OF_MEMORY   Out of memory
+ *
+ * @see face_image_destroy()
+ */
+int face_image_create(face_image_colorspace_e colorspace, unsigned char *buffer, int width, int height, int size, face_image_h *face_image);
+
+/**
+ * @brief Destroys the face image handle
+ * @param[in] face_image The face image handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @see face_image_create()
+ */
+int face_image_destroy(face_image_h face_image);
+
+/**
+ * @brief Destroys the facial component handle
+ * @param[in] face_component The facial component handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @see face_extract_component()
+ */
+int face_component_destroy(face_component_h face_component);
+
+/**
+ * @brief Gets the position of the face.
+ * @param[in] face_component The facial component handle
+ * @param[out] face The position of the face
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_COMPONENT_NOT_FOUND Component not found
+ */
+int face_component_get_face_rect(face_component_h face_component, face_rect_s *face);
+
+/**
+ * @brief Gets the position of the left eye.
+ * @param[in] face_component The facial component handle
+ * @param[out] leye The position of the left eye
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_COMPONENT_NOT_FOUND Component not found
+ * @see face_component_get_right_eye_point()
+ */
+int face_component_get_left_eye_point(face_component_h face_component, face_point_s *leye);
+
+/**
+ * @brief Gets the position of the right eye.
+ * @param[in] face_component The facial component handle
+ * @param[out] reye The position of the right eye
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_COMPONENT_NOT_FOUND Component not found
+ * @see face_component_get_left_eye_point()
+ */
+int face_component_get_right_eye_point(face_component_h face_component, face_point_s *reye);
+
+/**
+ * @brief Gets the position of the mouth.
+ * @param[in] face_component The facial component handle
+ * @param[out] mouth The position of the mouth
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_COMPONENT_NOT_FOUND Component not found
+ */
+int face_component_get_mouth_rect(face_component_h face_component, face_rect_s *mouth);
+
+
+/**
+ * @brief Creates a handle to the facial engine.
+ * @remarks The @a face must be released with face_destroy() by you.
+ * @param[out] face A facial engine handle to be newly created on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_OUT_OF_MEMORY   Out of memory
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_destroy()
+ */
+int face_create(face_h *face);
+
+/**
+ * @brief Destroys the handle to the facial engine and releases all its resources.
+ * @param[in] face The facial engine handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_create()
+ */
+int face_destroy(face_h face);
+
+
+/**
+ * @brief Gets the preferred color space of the facial engine.
+ * @remarks The preferred color space depends on the facial engine.
+ * @param[in] face The facial engine handle
+ * @param[out] colorspace The preferred color space
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @see face_image_create()
+ */
+int face_attr_get_prefered_colorspace(face_h face, face_image_colorspace_e *colorspace);
+
+
+/**
+ * @brief Sets the maximum number of faces to detect from the image.
+ * @remarks The maximum number must be a positive number
+ * @param[in] face The facial engine handle
+ * @param[in] max_faces The maximum number of faces
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_attr_get_max_number_faces()
+ */
+int face_attr_set_max_number_faces(face_h face, int max_faces);
+
+/**
+ * @brief Gets the maximum number of faces to detect from the image
+ * @param[in] face The facial engine handle
+ * @param[out] max_faces The maximum number of faces
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_attr_set_max_number_faces()
+ */
+int face_attr_get_max_number_faces(face_h face, int *max_faces);
+
+/**
+ * @brief Sets the minimum ratio of detectable faces relative to the input image
+ * @remarks The range is from values 1 to 3, where the value 1 has the longest execution time and 3 has the shortest execution time.
+ * @param[in] face The facial engine handle
+ * @param[in] scale_factor The minimum ratio of detectable faces
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_attr_get_scale_factor()
+ */
+int face_attr_set_scale_factor(face_h face, int scale_factor);
+
+/**
+ * @brief Gets The minimum ratio of detectable faces relative to the input image
+ * @param[in] face The facial engine handle
+ * @param[out] scale_factor The minimum ratio of detectable faces
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_attr_set_scale_factor()
+ */
+int face_attr_get_scale_factor(face_h face, int *scale_factor);
+
+/**
+ * @brief Sets interval to detect faces at streaming data
+ * @details Sets interval to detect faces at streaming data
+ * @remarks Interval has to positive number
+ * @param[in] face The facial engine handle
+ * @param[in] detect_interval Detect interval
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_attr_get_detect_inteval()
+ */
+int face_attr_set_detect_inteval(face_h face, int detect_interval);
+
+/**
+ * @brief Gets interval to detect faces at streaming data
+ * @details Gets interval to detect faces at streaming data
+ * @param[in] face The facial engine handle
+ * @param[out] detect_interval Detect interval
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_attr_set_detect_inteval()
+ */
+int face_attr_get_detect_inteval(face_h face, int *detect_interval);
+
+
+/**
+ * @brief Sets detection mode for single image detection
+ * @details Sets detection mode for single image detection
+ * @remarks Interval has to positive number
+ * @param[in] face The facial engine handle
+ * @param[in] detect_mode Detection mode
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_attr_get_detect_mode()
+ */
+int face_attr_set_detect_mode(face_h face, face_detect_mode_e detect_mode);
+
+/**
+ * @brief Gets detection mode for single image detection
+ * @details Sets detection mode for single image detection
+ * @param[in] face The facial engine handle
+ * @param[out] detect_mode Detection mode
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE    Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_attr_set_detect_mode()
+ */
+int face_attr_get_detect_mode(face_h face, face_detect_mode_e *detect_mode);
+
+
+/**
+ * @brief Detects faces from the image data.
+ * @param[in] face The facial engine handle
+ * @param[in] image_type The type of the image
+ * @param[in] image The image handle to detect faces
+ * @param[out] face_rect The array of the detected face positions
+ * @param[out] count The number of the detected face positions
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_OUT_OF_MEMORY   Out of memory
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ */
+int face_detect_faces(face_h face, face_image_type_e image_type, const face_image_h image,  face_rect_s *face_rect[], int *count);
+
+
+/**
+ * @brief Gets a current position of the specific face detected from the previous image data
+ * @details This function can be used for tracking the face from a sequential image data
+ * @param[in] face The facial engine handle
+ * @param[in] prev_image The handle to previous image data
+ * @param[in] cur_image The handle to current image data
+ * @param[in] prev_rect The position of the detected face from face_detect_faces() with the previous image data
+ * @param[out] cur_rect The position of the detected face from face_detect_faces() with the current image data
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @retval #FACE_ERROR_OPERATION_FAILED Operation failed
+ */
+int face_get_movement(face_h face, const face_image_h prev_image, const face_image_h cur_image, const face_rect_s *prev_rect, face_rect_s *cur_rect);
+
+
+/**
+ * @brief Extracts a facial component from the detected face
+ * @remarks The @a component must be released with face_component_destroy() by you.
+ * @param[in] face The facial engine handle
+ * @param[in] image The face image handle
+ * @param[in] rect The face position to extract component from the image data
+ * @param[out] component The facial component handle to be created on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @see face_component_destroy()
+ * @see face_component_get_face_rect()
+ * @see face_component_get_left_eye_point()
+ * @see face_component_get_right_eye_point()
+ * @see face_component_get_mouth_rect()
+ */
+int face_extract_component(face_h face, const face_image_h image, const face_rect_s *rect, face_component_h *component);
+
+
+/**
+ * @brief Extracts a facial feature to represent a recognized face
+ * @remarks The @a feature must be released with face_feature_destroy() by you.
+ * @param[in] face The facial engine handle
+ * @param[in] image The face image handle
+ * @param[in] component The facial component handle from face_extract_component() with the given image data
+ * @param[out] feature The facial feature handle to be created on success
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_OUT_OF_MEMORY   Out of memory
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @retval #FACE_ERROR_OPERATION_FAILED Operation failed
+ * @see face_compare_feature()
+ */
+int face_extract_feature(face_h face, const face_image_h image, const face_component_h component, face_feature_h *feature);
+
+/**
+ * @brief Compares two faces using the facial features.
+ * @details This function compares two faces using the facial features and gets the similarity of two specified faces.
+ * @param[in] A The first facial feature handle to compare from face_extract_feature()
+ * @param[in] B The second facial feature handle to compare from face_extract_feature()
+ * @param[out] similarity The degree of similarity in percentage.\n
+ * The range is from 0 to 1.0. 1.0 means the face are the same, and 0 means there is no similarity at between the two faces.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @retval #FACE_ERROR_OPERATION_FAILED Operation failed
+ * @see face_extract_feature()
+ */
+int face_compare_feature(const face_feature_h A, const face_feature_h B, float *similarity);
+
+/**
+ * @brief Recognizes the facial expression
+ * @param[in] face The facial engine handle
+ * @param[in] image The face image handle
+ * @param[in] component The facial component handle from face_extract_component() with the given image data
+ * @param[out] expression The recognized facial expression
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_OPERATION_FAILED Failed to recognize the facial expression
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @retval #FACE_ERROR_OPERATION_FAILED Operation failed
+ * @see face_extract_component()
+ * @see face_expression_e
+ */
+int face_recognize_expression(face_h face, const face_image_h image , const face_component_h component, face_expression_e *expression);
+
+
+/**
+ * @brief Recognizes the eye states
+ * @param[in] face The facial engine handle
+ * @param[in] image The face image handle
+ * @param[in] component The facial component handle from face_extract_component() with the given image data
+ * @param[out] lefteye The state of left eye
+ * @param[out] righteye The state of right eye
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #FACE_ERROR_NONE Successful
+ * @retval #FACE_ERROR_INVALID_PARAMTER Invalid parameter
+ * @retval #FACE_ERROR_OPERATION_FAILED Failed to recognize the eye states
+ * @retval #FACE_ERROR_ENGINE_NOT_FOUND Facial engine not found
+ * @retval #FACE_ERROR_OPERATION_FAILED Operation failed
+ * @see face_extract_component()
+ * @see face_eye_state_e
+ */
+int face_recognize_blink(face_h face,  const face_image_h image, const face_component_h component, face_eye_state_e *lefteye,  face_eye_state_e *righteye);
+
+
+/**
+ * @}
+ */
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif         // __TIZEN_UIX_FACE_H__
+
diff --git a/packaging/capi-uix-face.spec b/packaging/capi-uix-face.spec
new file mode 100755 (executable)
index 0000000..9836f47
--- /dev/null
@@ -0,0 +1,52 @@
+Name:       capi-uix-face
+Summary:    Face detector & recognizer C-API v1.0
+Version:    0.1.42
+Release:    1
+Group:      misc
+License:    Apache
+Source0:    %{name}-%{version}.tar.gz
+
+BuildRequires:  cmake
+BuildRequires:  embryo-bin
+
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(face-engine)
+BuildRequires:  pkgconfig(capi-base-common)
+
+%description
+Face C-API v1.0. library
+
+%package devel
+Summary:   Face C-API development library (devel)
+Group:     Development/Libraries
+Requires:  %{name} = %{version}
+
+%description devel
+Face C-API development library
+
+%prep
+%setup -q
+
+%build
+
+cmake . -DCMAKE_INSTALL_PREFIX="/usr"
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+
+
+%files
+%manifest capi-uix-face.manifest
+%defattr(-,root,root,-)
+/usr/lib/libcapi-uix-face.so*
+/usr/share/license/%{name}
+
+#/usr/bin/*
+
+%files devel
+%defattr(-,root,root,-)
+/usr/lib/pkgconfig/*
+/usr/include/uix/*
diff --git a/src/face-debug.h b/src/face-debug.h
new file mode 100755 (executable)
index 0000000..e9ca255
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2011 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.
+ */
+#ifndef __FACE_DEBUG_H__
+#define __FACE_DEBUG_H__
+
+#include <dlog.h>
+#include "statistics.h"
+
+#define PERF_TIME
+
+#define LVL1 "  "
+#define LVL2 "    "
+#define LVL3 "      "
+#define LVL4 "        "
+#define LVL5 "          "
+#define LVL6 "            "
+
+#ifdef PERF_TIME
+
+// accum item handling
+#define PERF_CHECK_BEGIN(name)         mm_ta_accum_item_begin(name,false,__FILE__,__LINE__)
+#define PERF_CHECK_END(name)           mm_ta_accum_item_end(name,false,__FILE__,__LINE__)
+
+// Print out
+#define PERF_SHOW_RESULT(fp)           mm_ta_accum_show_result_fp(fp)
+
+#else
+
+#define PERF_CHECK_BEGIN(name)
+#define PERF_CHECK_END(name)
+
+// Print out
+#define PERF_SHOW_RESULT(fp)
+
+#endif         // PERF_TIME
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "TIZEN_N_FACE"
+
+#define LOG_INFO(fmt, ...)     LOGI("[F:%-16.16s L:%5d] " fmt, __func__, __LINE__ , ##__VA_ARGS__)
+#define LOG_ERROR(fmt, ...) LOGE("[F:%-16.16s L:%5d] " fmt, __func__, __LINE__ , ##__VA_ARGS__)
+#define LOG_FATAL(fmt, ...)    LOGE("[F:%-16.16s L:%5d] " fmt, __func__, __LINE__ , ##__VA_ARGS__)
+
+// #define LOG_DEBUG(fmt, ...) LOGD("[F:%-16.16s L:%5d] " fmt, __func__, __LINE__ , ##__VA_ARGS__)
+
+#define LOG_DEBUG(fmt, ...)
+
+
+#endif //__FACE_DEBUG_H__
diff --git a/src/face.c b/src/face.c
new file mode 100755 (executable)
index 0000000..8ffb6de
--- /dev/null
@@ -0,0 +1,1193 @@
+/*
+ * Copyright (c) 2011 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 <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#ifdef MEMWATCH
+#include "memwatch-2.71/memwatch.h"
+#endif
+
+#include "face-debug.h"
+#include "face.h"
+#include "face_priv.h"
+
+#include <face-engine.h>
+
+#define FACE_MAGIC_VALID       (0xFF993311)
+#define FACE_MAGIC_INVALID     (0x393A3B3C)
+
+typedef struct face_s
+{
+       face_engine_h fengine;
+
+       unsigned int magic;
+} FaceT;
+
+
+static face_error_e _convert_to_face_error_e(face_engine_error_e src)
+{
+       switch(src)
+       {
+               case FACE_ENGINE_ERROR_NONE:
+                       return FACE_ERROR_NONE;
+
+               case FACE_ENGINE_ERROR_INVALID_PARAMTER:
+                       return FACE_ERROR_INVALID_PARAMTER;
+
+               case FACE_ENGINE_ERROR_OUT_OF_MEMORY:
+                       return FACE_ERROR_OUT_OF_MEMORY;
+
+               case FACE_ENGINE_ERROR_OPERATION_FAILED:
+                       return FACE_ERROR_OPERATION_FAILED;
+
+               case FACE_ENGINE_ERROR_ENGINE_NOT_FOUND:
+                       return FACE_ERROR_ENGINE_NOT_FOUND;
+
+               case FACE_ENGINE_ERROR_FAILURE:
+                       return FACE_ERROR_OPERATION_FAILED;
+               default:
+                       LOG_ERROR("Unknown error : %d", src);
+                       break;
+       }
+
+       return FACE_ERROR_OPERATION_FAILED;
+}
+
+
+static bool _validate_face_image_h(const face_image_h image)
+{
+       if ( image == NULL )
+       {
+               LOG_ERROR("Image is NULL");
+               return false;
+       }
+
+       if ( image->magic != FACE_IMAGE_MAGIC )
+       {
+               LOG_ERROR("Invalid image magic. Magic=0x%08x!", image->magic);
+               return false;
+       }
+
+       if ( image->pixel == NULL || image->width <= 0 || image->height <= 0 )
+       {
+               LOG_ERROR("Invalid images. 0x%08x(%dx%d)", image->pixel, image->width, image->height);
+               return false;
+       }
+
+       return true;
+}
+
+static bool _validate_face_rect_t(const face_rect_s *rect)
+{
+       if ( rect == NULL )
+       {
+               LOG_ERROR("Rect is NULL");
+               return false;
+       }
+
+       if ( rect->x < 0 || rect->y < 0 || rect->w <= 0 || rect->h <= 0 )
+       {
+               LOG_ERROR("Invalid rect(%d,%d,%d,%d)", rect->x, rect->y, rect->w, rect->h);
+               return false;
+       }
+
+       return true;
+}
+
+static bool _is_inside(const face_rect_s *rect, const face_point_s *point)
+{
+//     true iff rect->x < point->x < rect->x + rect->w && rect->y < point->y < rect->y + rect->h
+
+       return ( rect->x <= point->x ) && ( point->x <= rect->x + rect->w ) &&
+                       ( rect->y <= point->y ) && ( point->y <= rect->y + rect->h ) ;
+
+}
+
+static bool _validate_face_component_h(const face_component_h component)
+{
+       if ( component == NULL )
+       {
+               LOG_ERROR("Component is NULL");
+               return false;
+       }
+
+       if ( component->magic != FACE_COMPONENT_MAGIC )
+       {
+               LOG_ERROR("Invalid component magic!");
+               return false;
+       }
+
+       if ( _validate_face_rect_t(&component->face) == false)
+       {
+               LOG_ERROR("Invalid Face rect.(%d,%d,%d,%d)", component->face.x, component->face.y, component->face.w, component->face.h);
+               return false;
+       }
+
+// If No eye position, not valid component.
+       if ( _is_inside(&component->face, &component->lefteye) == false )
+       {
+               LOG_ERROR("Invalid left Eye point. (%d,%d)", component->lefteye.x, component->lefteye.y);
+               return false;
+       }
+
+       if ( _is_inside(&component->face, &component->righteye) == false )
+       {
+               LOG_ERROR("Invalid right Eye point. (%d,%d)", component->righteye.x, component->righteye.y);
+               return false;
+       }
+
+       return true;
+
+}
+
+static bool _validate_face_feature_h(const face_feature_h feature)
+{
+       if ( feature == NULL )
+       {
+               LOG_ERROR("Component is NULL");
+               return false;
+       }
+
+       if ( feature->magic != FACE_FEATURE_MAGIC )
+       {
+               LOG_ERROR("Invalid feature magic!");
+               return false;
+       }
+
+       if ( feature->len == 0 )
+       {
+               LOG_ERROR("Invalid length");
+               return false;
+       }
+
+       if ( feature->data == NULL )
+       {
+               LOG_ERROR("Invalid buffer");
+               return false;
+       }
+
+       return true;
+}
+
+
+static bool _validate_face_h(const face_h handle)
+{
+       if ( handle == NULL )
+       {
+               LOG_ERROR("face_h cannot be NULL");
+               return false;
+       }
+
+       if ( handle->magic != FACE_MAGIC_VALID )
+       {
+               LOG_ERROR("Invalid Facial handle");
+               return false;
+       }
+
+       return true;
+}
+
+static void _copy_rect_face_to_facianengine(const face_rect_s *src, face_engine_rect_t *dst)
+{
+       dst->x = src->x;
+       dst->y = src->y;
+       dst->w = src->w;
+       dst->h = src->h;
+}
+
+static void _copy_rect_facianengine_to_face(const face_engine_rect_t *src, face_rect_s *dst)
+{
+       dst->x = src->x;
+       dst->y = src->y;
+       dst->w = src->w;
+       dst->h = src->h;
+}
+
+
+static void _copy_component_face_to_face_engine(const face_component_h src, face_engine_component_t *dst)
+{
+       dst->face.x = src->face.x;
+       dst->face.y = src->face.y;
+       dst->face.w = src->face.w;
+       dst->face.h = src->face.h;
+
+       dst->lefteye.x = src->lefteye.x;
+       dst->lefteye.y = src->lefteye.y;
+
+       dst->righteye.x = src->righteye.x;
+       dst->righteye.y = src->righteye.y;
+
+       dst->mouth.x = src->mouth.x;
+       dst->mouth.y = src->mouth.y;
+       dst->mouth.w = src->mouth.w;
+       dst->mouth.h = src->mouth.h;
+}
+
+static void _copy_component_face_engine_to_face(const  face_engine_component_t *src, face_component_h dst)
+{
+       dst->face.x = src->face.x;
+       dst->face.y = src->face.y;
+       dst->face.w = src->face.w;
+       dst->face.h = src->face.h;
+
+       dst->lefteye.x = src->lefteye.x;
+       dst->lefteye.y = src->lefteye.y;
+
+       dst->righteye.x = src->righteye.x;
+       dst->righteye.y = src->righteye.y;
+
+       dst->mouth.x = src->mouth.x;
+       dst->mouth.y = src->mouth.y;
+       dst->mouth.w = src->mouth.w;
+       dst->mouth.h = src->mouth.h;
+}
+
+
+static void _copy_feature_face_engine_to_face(const face_engine_feature_t *src, face_feature_h dst)
+{
+       dst->data = src->data;
+       dst->len = src->len;
+}
+
+static void _copy_feature_face_to_face_engine(const face_feature_h src, face_engine_feature_t *dst)
+{
+       dst->data = src->data;
+       dst->len =  src->len;
+}
+
+
+// Extern APIs
+EXPORT_API int face_create(__inout face_h *face)
+{
+       if ( face == NULL )
+       {
+               LOG_ERROR("[%s] Outparam is NULL", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       FaceT *pFace = (FaceT *)calloc(1, sizeof(FaceT));
+
+       if ( pFace == NULL )
+       {
+               LOG_ERROR("Cannot allocated memory. ");
+               return FACE_ERROR_OUT_OF_MEMORY;
+       }
+
+       face_engine_error_e ferr ;
+
+       ferr = face_engine_create(&(pFace->fengine));
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               pFace->magic = FACE_MAGIC_INVALID;
+               free(pFace);
+
+               *face = NULL;
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       pFace->magic = FACE_MAGIC_VALID;
+
+       *face = pFace;
+
+       LOG_INFO("face created. handle=0x%08x", *face);
+
+       return FACE_ERROR_NONE;
+
+}
+
+
+EXPORT_API int face_destroy(__in face_h face)
+{
+       LOG_INFO("face destroy. handle=0x%08x", face);
+
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+
+       ferr = face_engine_destroy(face->fengine);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       face->magic = FACE_MAGIC_INVALID;
+
+       free(face);
+
+       return FACE_ERROR_NONE;
+}
+
+EXPORT_API int face_detect_faces(      __in face_h face,
+                                                                       __in face_image_type_e image_type,
+                                                                       __in const face_image_h image,
+                                                                       __out face_rect_s *face_rect[],
+                                                                       __out int *count)
+{
+
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_image_h(image) == false )
+       {
+               LOG_ERROR("[%s] Invalid image", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( count == NULL || face_rect == NULL )
+       {
+               LOG_ERROR("Invalid param. &count=0x%08x &face_rect=0x%08x", count, face_rect);
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+
+       face_engine_image_t img;
+
+       img.colorspace = FACE_ENGINE_IMAGE_FORMAT_Y;            // Only Y image is supported
+       img.pixel = image->pixel;
+       img.width= image->width;
+       img.height = image->height;
+
+       face_engine_rect_t *frect = NULL;
+       int nCount = 0;
+
+       if ( image_type == FACE_IMAGE_TYPE_SINGLE )
+       {
+               ferr = face_engine_detect_faces(face->fengine, FACE_ENGINE_IMAGE_TYPE_SINGLE, &img , &frect, NULL, &nCount);
+       }
+       else if ( image_type == FACE_IMAGE_TYPE_CONTINUOUS )
+       {
+               ferr = face_engine_detect_faces(face->fengine, FACE_ENGINE_IMAGE_TYPE_CONTINUOUS, &img , &frect, NULL, &nCount);
+       }
+       else
+       {
+               LOG_ERROR("[%s]Invalid image type : %d", _face_convert_error(FACE_ERROR_INVALID_PARAMTER), image_type);
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( nCount == 0 )
+       {
+               *count = 0;
+               *face_rect = NULL;
+
+               LOG_INFO("No face is founded");
+
+               return FACE_ERROR_NONE;
+       }
+
+// Convet frect to rect.
+       face_rect_s *rect = (face_rect_s *)calloc(nCount, sizeof(face_rect_s));
+
+       if ( rect == NULL )
+       {
+               LOG_ERROR("[%s] Cannout allocate face_rect_s", _face_convert_error(FACE_ERROR_OUT_OF_MEMORY));
+               return FACE_ERROR_OUT_OF_MEMORY;
+       }
+
+       int i;
+
+       for ( i = 0; i < nCount ; i++)
+       {
+               rect[i].x = frect[i].x;
+               rect[i].y = frect[i].y;
+               rect[i].w = frect[i].w;
+               rect[i].h = frect[i].h;
+       }
+
+       free(frect);            // Remove frect memory
+
+       *count = nCount;
+       *face_rect = rect;
+
+       return FACE_ERROR_NONE;
+}
+
+
+EXPORT_API int face_get_movement(              __in face_h face,
+                                                                                       __in const face_image_h prev_image, __in const face_image_h cur_image,
+                                                                                       __in const face_rect_s *prev_rect,
+                                                                                       __inout face_rect_s *cur_rect)
+{
+// Check in param
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( prev_rect == NULL )
+       {
+               LOG_ERROR("[%s] Invalid prev rect", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( cur_rect == NULL )
+       {
+               LOG_ERROR("[%s] Invalid out rect", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_rect_t prev;
+       face_engine_rect_t cur;
+
+       _copy_rect_face_to_facianengine(prev_rect, &prev);
+
+       face_engine_error_e ferr;
+
+//     ferr = face_engine_track_faces(face->fengine, &prev ,&cur);
+
+       ferr = face_engine_track_faces1(face->fengine, prev_image->pixel, cur_image->pixel, prev_image->width, prev_image->height, &prev ,&cur);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               cur_rect->x = 0;
+               cur_rect->y = 0;
+               cur_rect->w = 0;
+               cur_rect->h = 0;
+
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       _copy_rect_facianengine_to_face(&cur, cur_rect);
+
+       return FACE_ERROR_NONE;
+}
+
+EXPORT_API int face_extract_component(__in face_h face, __in const face_image_h image, __in const face_rect_s *rect, __out face_component_h *component)
+{
+// Check in param
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_image_h(image) == false )
+       {
+               LOG_ERROR("[%s] Invalid image", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_rect_t(rect) == false )
+       {
+               LOG_ERROR("[%s] Invalid image", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check out param
+       if ( component == NULL )
+       {
+               LOG_ERROR("[%s] Invalid out component", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_image_t img;
+
+       img.colorspace = FACE_ENGINE_IMAGE_FORMAT_Y;            // Only Y image is supported
+       img.pixel = image->pixel;
+       img.width= image->width;
+       img.height = image->height;
+
+       face_engine_rect_t frect;
+
+       _copy_rect_face_to_facianengine(rect, &frect);
+
+       face_engine_error_e ferr;
+
+       face_engine_component_t fcomponent;
+
+       ferr = face_engine_extract_face_component(face->fengine, &img ,&frect, &fcomponent);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       int ret = face_component_create(component);
+
+       if ( ret != FACE_ERROR_NONE)
+       {
+               LOG_ERROR("Cannot create face component");
+               return ret;
+       }
+
+       _copy_component_face_engine_to_face(&fcomponent, *component);
+
+       return FACE_ERROR_NONE;
+}
+
+
+EXPORT_API int face_recognize_expression(__in face_h face, __in const face_image_h image, __in const face_component_h component, __out face_expression_e *expression)
+{
+// Check param
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_image_h(image) == false )
+       {
+               LOG_ERROR("[%s] Invalid image", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_component_h(component) == false )
+       {
+               LOG_ERROR("[%s] Invalid component", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check out param
+       if ( expression == NULL )
+       {
+               LOG_ERROR("[%s] Invalid out expression", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_image_t fimg;
+
+       fimg.colorspace = FACE_ENGINE_IMAGE_FORMAT_Y;           // Only Y image is supported
+       fimg.pixel = image->pixel;
+       fimg.width= image->width;
+       fimg.height = image->height;
+
+       face_engine_component_t fcomponent;
+
+       _copy_component_face_to_face_engine(component, &fcomponent);
+
+       face_engine_error_e ferr;
+
+       face_engine_expression_e fexpression;
+
+       ferr = face_engine_recognize_face_expression(face->fengine, &fimg, &fcomponent, &fexpression);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+// Convert to face
+       switch(fexpression)
+       {
+               case FACE_ENGINE_EXPRESSION_NUETRAL:
+                       *expression = FACE_EXPRESSION_NUETRAL;
+                       break;
+               case FACE_ENGINE_EXPRESSION_ANGRY:
+                       *expression = FACE_EXPRESSION_ANGRY;
+                       break;
+               case FACE_ENGINE_EXPRESSION_SMILE:
+                       *expression = FACE_EXPRESSION_SMILE;
+                       break;
+               case FACE_ENGINE_EXPRESSION_SURPRISE:
+                       *expression = FACE_EXPRESSION_SURPRISE;
+                       break;
+               case FACE_ENGINE_EXPRESSION_UNKNOWN:
+                       *expression = FACE_EXPRESSION_UNKNOWN;
+                       break;
+               default:
+                       LOG_ERROR("Unknow facialengine expression. %d", fexpression);
+                       *expression = FACE_EXPRESSION_UNKNOWN;
+                       break;
+       }
+
+       return FACE_ERROR_NONE;
+
+}
+
+
+EXPORT_API int face_recognize_blink(__in face_h face, __in const face_image_h image, __in const face_component_h component, __out face_eye_state_e *lefteye, __out face_eye_state_e *righteye)
+{
+
+// Check param
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_image_h(image) == false )
+       {
+               LOG_ERROR("[%s] Invalid image", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_component_h(component) == false )
+       {
+               LOG_ERROR("[%s] Invalid component", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check out param
+       if ( lefteye == NULL )
+       {
+               LOG_ERROR("[%s] Invalid out lefteye", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( righteye == NULL )
+       {
+               LOG_ERROR("[%s] Invalid out righteye", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_image_t fimg;
+
+       fimg.colorspace = FACE_ENGINE_IMAGE_FORMAT_Y;           // Only Y image is supported
+       fimg.pixel = image->pixel;
+       fimg.width= image->width;
+       fimg.height = image->height;
+
+       face_engine_component_t fcomponent;
+
+       _copy_component_face_to_face_engine(component, &fcomponent);
+
+       face_engine_error_e ferr;
+
+       face_engine_eye_e fleye, freye;
+
+       ferr = face_engine_recognize_blink(face->fengine, &fimg, &fcomponent, &fleye, &freye);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       switch(fleye)
+       {
+               case FACE_ENGINE_EYE_UNKNOWN:
+                       *lefteye = FACE_EYE_STATE_UNKNOWN;
+                       break;
+               case FACE_ENGINE_EYE_OPENED:
+                       *lefteye = FACE_EYE_STATE_OPENED;
+                       break;
+               case FACE_ENGINE_EYE_CLOSED:
+                       *lefteye = FACE_EYE_STATE_CLOSED;
+                       break;
+               default:
+                       LOG_ERROR("Unknow fleye. %d", fleye);
+                       *lefteye = FACE_EYE_STATE_UNKNOWN;
+                       *righteye = FACE_EYE_STATE_UNKNOWN;
+                       break;
+       }
+
+       switch(freye)
+       {
+               case FACE_ENGINE_EYE_UNKNOWN:
+                       *righteye = FACE_EYE_STATE_UNKNOWN;
+                       break;
+               case FACE_ENGINE_EYE_OPENED:
+                       *righteye = FACE_EYE_STATE_OPENED;
+                       break;
+               case FACE_ENGINE_EYE_CLOSED:
+                       *righteye = FACE_EYE_STATE_CLOSED;
+                       break;
+               default:
+                       LOG_ERROR("Unknow freye. %d", freye);
+                       *lefteye = FACE_EYE_STATE_UNKNOWN;
+                       *righteye = FACE_EYE_STATE_UNKNOWN;
+                       break;
+       }
+
+       return FACE_ERROR_NONE;
+}
+
+EXPORT_API int face_extract_feature(__in face_h face, __in const face_image_h image, __in const face_component_h component, __out face_feature_h *feature)
+{
+       int err;
+
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_image_h(image) == false )
+       {
+               LOG_ERROR("[%s] Invalid image", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_component_h(component) == false )
+       {
+               LOG_ERROR("[%s] Invalid component", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check out param
+       if ( feature == NULL )
+       {
+               LOG_ERROR("[%s] Invalid out righteye", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_image_t fimg;
+
+       fimg.colorspace = FACE_ENGINE_IMAGE_FORMAT_Y;           // Only Y image is supported
+       fimg.pixel = image->pixel;
+       fimg.width= image->width;
+       fimg.height = image->height;
+
+       face_engine_component_t fcomponent;
+
+       _copy_component_face_to_face_engine(component, &fcomponent);
+
+       face_engine_error_e ferr;
+
+       face_engine_feature_t ffeature;
+
+       ferr = face_engine_extract_face_feature(face->fengine, &fimg, &fcomponent, &ffeature);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               *feature = NULL;
+
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       err = face_feature_create(feature);
+
+       if ( err != FACE_ERROR_NONE)
+       {
+               LOG_ERROR("%s", _face_convert_error(err));
+
+               *feature = NULL;
+
+               return err;
+       }
+
+       _copy_feature_face_engine_to_face(&ffeature , *feature);
+
+       return FACE_ERROR_NONE;
+
+}
+
+EXPORT_API int face_compare_feature(__in const face_feature_h A, __in const face_feature_h B, __out float *similarity)
+{
+       if ( _validate_face_feature_h(A) == false )
+       {
+               LOG_ERROR("[%s] Invalid feature A", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( _validate_face_feature_h(B) == false )
+       {
+               LOG_ERROR("[%s] Invalid feature B", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( similarity == NULL )
+       {
+               LOG_ERROR("[%s] Invalid out similarity", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( A == B )
+       {
+               *similarity = 1.0f;
+               return FACE_ERROR_NONE;
+       }
+
+       face_engine_feature_t ffA, ffB;
+
+       _copy_feature_face_to_face_engine(A, &ffA);
+       _copy_feature_face_to_face_engine(B, &ffB);
+
+       face_engine_error_e ferr;
+
+       int nSimilarity;
+
+       ferr = face_engine_compare_face_feature(NULL,  &ffA, &ffB, &nSimilarity);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               *similarity = 0.0f;
+
+               LOG_ERROR("[%s] Cannot compare feature", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       *similarity = (float)nSimilarity/100.0;
+
+       return FACE_ERROR_NONE;
+
+}
+
+
+EXPORT_API int face_attr_get_prefered_colorspace(face_h face, face_image_colorspace_e *colorspace)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( colorspace == NULL )
+       {
+               LOG_ERROR("[%s] Invalid out similarity", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       *colorspace = FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY;
+       return FACE_ERROR_NONE;
+}
+
+
+
+EXPORT_API int face_attr_set_max_number_faces(face_h face, int max_faces)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check range.
+       if ( max_faces <= 0 )
+       {
+               LOG_ERROR("[%s] Invalid max faces : %d", _face_convert_error(FACE_ERROR_INVALID_PARAMTER), max_faces);
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+       face_engine_param_t param;
+
+       ferr = face_engine_get_param(face->fengine, &param);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       if ( param.nMaxFaceNum != max_faces)
+       {
+               param.nMaxFaceNum = max_faces;
+
+               ferr = face_engine_set_param(face->fengine, &param);
+
+               if ( ferr != FACE_ENGINE_ERROR_NONE )
+               {
+                       LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+                       return _convert_to_face_error_e(ferr);
+               }
+       }
+
+       return FACE_ERROR_NONE;
+
+
+}
+
+
+EXPORT_API int face_attr_get_max_number_faces(face_h face, int *max_faces)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( max_faces == NULL )
+       {
+               LOG_ERROR("[%s] out max_faces is null", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+       face_engine_param_t param;
+
+       ferr = face_engine_get_param(face->fengine, &param);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               *max_faces = 0;
+
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       *max_faces = param.nMaxFaceNum;
+
+       return FACE_ERROR_NONE;
+}
+
+EXPORT_API int face_attr_set_scale_factor(face_h face, int scale_factor)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check range.
+       if ( scale_factor < 1 || scale_factor > 3 )
+       {
+               LOG_ERROR("[%s] Invalid max faces : %d", _face_convert_error(FACE_ERROR_INVALID_PARAMTER), scale_factor);
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+       face_engine_param_t param;
+
+       ferr = face_engine_get_param(face->fengine, &param);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       if ( param.nScale != scale_factor)
+       {
+               param.nScale = scale_factor;
+
+               ferr = face_engine_set_param(face->fengine, &param);
+
+               if ( ferr != FACE_ENGINE_ERROR_NONE )
+               {
+                       LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+                       return _convert_to_face_error_e(ferr);
+               }
+       }
+
+       return FACE_ERROR_NONE;
+
+
+}
+
+
+EXPORT_API int face_attr_get_scale_factor(face_h face, int *scale_factor)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( scale_factor == NULL )
+       {
+               LOG_ERROR("[%s] out scale_factor is null", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+
+       face_engine_error_e ferr;
+       face_engine_param_t param;
+
+       ferr = face_engine_get_param(face->fengine, &param);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               *scale_factor = 0;
+
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       *scale_factor = param.nScale;
+
+       return FACE_ERROR_NONE;
+}
+
+EXPORT_API int face_attr_set_detect_inteval(face_h face, int detect_interval)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check range.
+       if ( detect_interval <= 0 )
+       {
+               LOG_ERROR("[%s] Invalid detect interval : %d", _face_convert_error(FACE_ERROR_INVALID_PARAMTER), detect_interval);
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+       face_engine_param_t param;
+
+       ferr = face_engine_get_param(face->fengine, &param);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       if ( param.nInterval != detect_interval)
+       {
+               param.nInterval = detect_interval;
+
+               ferr = face_engine_set_param(face->fengine, &param);
+
+               if ( ferr != FACE_ENGINE_ERROR_NONE )
+               {
+                       LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+                       return _convert_to_face_error_e(ferr);
+               }
+       }
+
+       return FACE_ERROR_NONE;
+}
+
+EXPORT_API int face_attr_get_detect_inteval(face_h face, int *detect_interval)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( detect_interval == NULL )
+       {
+               LOG_ERROR("[%s] out detect_interval is null", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+       face_engine_param_t param;
+
+       ferr = face_engine_get_param(face->fengine, &param);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               *detect_interval = 0;
+
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       *detect_interval = param.nInterval;
+
+       return FACE_ERROR_NONE;
+}
+
+
+
+EXPORT_API int face_attr_set_detect_mode(face_h face, face_detect_mode_e detect_mode)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check range.
+       if ( detect_mode != FACE_DETECT_MODE_FAST && detect_mode != FACE_DETECT_MODE_ROBUST )
+       {
+               LOG_ERROR("[%s] Invalid detect mode : %d", _face_convert_error(FACE_ERROR_INVALID_PARAMTER), detect_mode);
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+       face_engine_param_t param;
+
+       ferr = face_engine_get_param(face->fengine, &param);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       face_engine_detection_mode_e eMode;
+
+       if (detect_mode == FACE_DETECT_MODE_ROBUST)
+       {
+               eMode = FACE_ENGINE_DETECTION_MODE_ROBUST;
+       }
+       else
+       {
+               eMode = FACE_ENGINE_DETECTION_MODE_FAST;
+       }
+
+       if ( param.eMode != eMode)
+       {
+               param.eMode = eMode;
+
+               ferr = face_engine_set_param(face->fengine, &param);
+
+               if ( ferr != FACE_ENGINE_ERROR_NONE )
+               {
+                       LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+                       return _convert_to_face_error_e(ferr);
+               }
+       }
+
+       return FACE_ERROR_NONE;
+
+}
+
+
+EXPORT_API int face_attr_get_detect_mode(face_h face, face_detect_mode_e *detect_mode)
+{
+       if ( _validate_face_h(face) == false )
+       {
+               LOG_ERROR("[%s] Invalid face handle", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( detect_mode == NULL )
+       {
+               LOG_ERROR("[%s] out detect_mode is null", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_engine_error_e ferr;
+       face_engine_param_t param;
+
+       ferr = face_engine_get_param(face->fengine, &param);
+
+       if ( ferr != FACE_ENGINE_ERROR_NONE )
+       {
+               LOG_ERROR("%s", _face_convert_error(_convert_to_face_error_e(ferr)));
+               return _convert_to_face_error_e(ferr);
+       }
+
+       if ( param.eMode == FACE_ENGINE_DETECTION_MODE_ROBUST)
+       {
+               *detect_mode = FACE_DETECT_MODE_ROBUST;
+       }
+       else
+       {
+               *detect_mode = FACE_DETECT_MODE_FAST;
+       }
+
+       return FACE_ERROR_NONE;
+
+}
+
+
+
+
diff --git a/src/face_component.c b/src/face_component.c
new file mode 100755 (executable)
index 0000000..c6ee725
--- /dev/null
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2011 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 "face.h"
+#include "face_priv.h"
+
+#include <stdlib.h>
+
+static bool _validate_face_component_h(face_component_h face_component)
+{
+       if ( face_component == NULL )
+       {
+               return false;
+       }
+
+       if ( face_component->magic != FACE_COMPONENT_MAGIC )
+       {
+               return false;
+       }
+
+       return true;
+
+}
+
+
+EXPORT_API int face_component_create(face_component_h *face_component)
+{
+       if ( face_component == NULL )
+       {
+               LOG_ERROR("Out pointer is NULL. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       FaceComponent *facecomponent = NULL;
+
+       facecomponent = (FaceComponent *)calloc(1, sizeof(FaceComponent));
+
+       if ( facecomponent == NULL )
+       {
+               LOG_ERROR("Cannot allocate face component handle");
+               return FACE_ERROR_OUT_OF_MEMORY;
+       }
+
+       facecomponent->magic = FACE_COMPONENT_MAGIC;
+
+       *face_component = facecomponent;
+
+       return FACE_ERROR_NONE;
+
+}
+
+EXPORT_API int face_component_destroy(face_component_h face_component)
+{
+       if ( _validate_face_component_h(face_component) == false )
+       {
+               LOG_ERROR("Invalid face component. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_component->magic = FACE_INVALID_MAGIC;
+
+       free(face_component);
+
+       return FACE_ERROR_NONE;
+}
+
+
+EXPORT_API int face_component_get_face_rect(face_component_h face_component, face_rect_s *face)
+{
+       if ( _validate_face_component_h(face_component) == false )
+       {
+               LOG_ERROR("Invalid component handle. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( face == NULL )
+       {
+               LOG_ERROR("[%s] face is NULL", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( face_component->face.w <= 0 || face_component->face.h <= 0 )
+       {
+               LOG_ERROR("[%s] Face is not founded", _face_convert_error(FACE_ERROR_COMPONENT_NOT_FOUND));
+               return FACE_ERROR_COMPONENT_NOT_FOUND;
+       }
+
+       face->x = face_component->face.x;
+       face->y = face_component->face.y;
+       face->w = face_component->face.w;
+       face->h = face_component->face.h;
+
+       return FACE_ERROR_NONE;
+
+}
+
+EXPORT_API int face_component_get_left_eye_point(face_component_h face_component, face_point_s *leye)
+{
+       if ( _validate_face_component_h(face_component) == false )
+       {
+               LOG_ERROR("Invalid component handle. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( leye == NULL )
+       {
+               LOG_ERROR("[%s] leye is NULL", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( face_component->lefteye.x <= 0 || face_component->lefteye.y <= 0 )
+       {
+               LOG_ERROR("[%s] Left eye is not founded", _face_convert_error(FACE_ERROR_COMPONENT_NOT_FOUND));
+               return FACE_ERROR_COMPONENT_NOT_FOUND;
+       }
+
+       leye->x = face_component->lefteye.x;
+       leye->y = face_component->lefteye.y;
+
+
+       return FACE_ERROR_NONE;
+
+}
+
+EXPORT_API int face_component_get_right_eye_point(face_component_h face_component, face_point_s *reye)
+{
+       if ( _validate_face_component_h(face_component) == false )
+       {
+               LOG_ERROR("Invalid component handle. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( reye == NULL )
+       {
+               LOG_ERROR("[%s] leye is NULL", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( face_component->righteye.x <= 0 || face_component->righteye.y <= 0 )
+       {
+               LOG_ERROR("[%s] Right eye is not founded", _face_convert_error(FACE_ERROR_COMPONENT_NOT_FOUND));
+               return FACE_ERROR_COMPONENT_NOT_FOUND;
+       }
+
+       reye->x = face_component->righteye.x;
+       reye->y = face_component->righteye.y;
+
+       return FACE_ERROR_NONE;
+
+}
+
+EXPORT_API int face_component_get_mouth_rect(face_component_h face_component, face_rect_s *mouth)
+{
+       if ( _validate_face_component_h(face_component) == false )
+       {
+               LOG_ERROR("Invalid component handle. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( mouth == NULL )
+       {
+               LOG_ERROR("[%s] mouth is NULL", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( face_component->mouth.w <= 0 || face_component->mouth.h <= 0 )
+       {
+               LOG_ERROR("[%s] Mouse position is not founded", _face_convert_error(FACE_ERROR_COMPONENT_NOT_FOUND));
+               return FACE_ERROR_COMPONENT_NOT_FOUND;
+       }
+
+       mouth->x = face_component->mouth.x;
+       mouth->y = face_component->mouth.y;
+       mouth->w = face_component->mouth.w;
+       mouth->h = face_component->mouth.h;
+
+       return FACE_ERROR_NONE;
+}
+
diff --git a/src/face_feature.c b/src/face_feature.c
new file mode 100755 (executable)
index 0000000..b1eb463
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2011 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 "face.h"
+#include "face_priv.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+static bool _validate_face_feature_h(face_feature_h face_feature)
+{
+       if ( face_feature == NULL )
+       {
+               return false;
+       }
+
+       if ( face_feature->magic != FACE_FEATURE_MAGIC )
+       {
+               return false;
+       }
+
+       return true;
+
+}
+
+
+EXPORT_API int face_feature_create(__out face_feature_h *face_feature)
+{
+       if ( face_feature == NULL )
+       {
+               LOG_ERROR("Out pointer is NULL. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       *face_feature = (FaceFeature *)calloc(1, sizeof(FaceFeature));
+
+       if ( *face_feature == NULL )
+       {
+               LOG_ERROR("Cannot allocate face_image_h");
+               return FACE_ERROR_OUT_OF_MEMORY;
+       }
+
+       (*face_feature)->data= NULL;
+       (*face_feature)->len = 0;
+       (*face_feature)->magic = FACE_FEATURE_MAGIC;
+
+       return FACE_ERROR_NONE;
+}
+
+
+
+EXPORT_API int face_feature_destroy(__in face_feature_h face_feature)
+{
+       if ( _validate_face_feature_h(face_feature) == false )
+       {
+               LOG_ERROR("Invalid Face feature. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( face_feature->data != NULL )
+       {
+               free(face_feature->data);
+       }
+
+       face_feature->data = NULL;
+       face_feature->magic = FACE_INVALID_MAGIC;
+
+       free(face_feature);
+
+       return FACE_ERROR_NONE;
+}
+
+
+EXPORT_API int face_feature_set_data(face_feature_h face_feature, const unsigned char *data, int length)
+{
+       if ( _validate_face_feature_h(face_feature) == false )
+       {
+               LOG_ERROR("Invalid Face feature. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( data == NULL )
+       {
+               LOG_ERROR("Invalid feature buffer. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( length == 0 )
+       {
+               LOG_ERROR("Invalid feature len. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( face_feature->data )
+       {
+               // Free first.
+               free(face_feature->data);
+       }
+
+       face_feature->data = (unsigned char *)calloc(1, length);
+
+       if ( face_feature->data == NULL )
+       {
+               LOG_ERROR("Cannot allocate feature data. %s", _face_convert_error);
+               return FACE_ERROR_OUT_OF_MEMORY;
+       }
+
+       memcpy(face_feature->data, data, length);
+       face_feature->len = length;
+
+       return FACE_ERROR_NONE;
+
+}
+
+
+EXPORT_API int face_feature_get_data(face_feature_h face_feature, unsigned char **data, int *length)
+{
+       if ( _validate_face_feature_h(face_feature) == false )
+       {
+               LOG_ERROR("Invalid Face feature. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+// Check out param
+       if ( data == NULL )
+       {
+               LOG_ERROR("Out param - data is NULL. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( length == 0 )
+       {
+               LOG_ERROR("Out param - length is NULL. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       *data = face_feature->data;
+       *length = face_feature->len;
+
+       return FACE_ERROR_NONE;
+}
+
+
diff --git a/src/face_image.c b/src/face_image.c
new file mode 100755 (executable)
index 0000000..52dc80d
--- /dev/null
@@ -0,0 +1,303 @@
+/*
+ * Copyright (c) 2011 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 "face.h"
+#include "face_priv.h"
+
+#include <stdlib.h>
+
+
+
+static void convert_RGB565_to_Y(unsigned char* pBuf, unsigned char* pGrayBuf, int width, int height)
+{
+       unsigned char* pDst, * pEnd;
+       unsigned short* pSrc;
+
+       unsigned short R, G, B;
+       long lt;
+
+       pSrc = (unsigned short*) pBuf;
+       pDst = (unsigned char*) pGrayBuf;
+       pEnd = (unsigned char*) ((unsigned char*) pGrayBuf + height * width);
+
+       while (pDst < pEnd)
+       {
+               R = (unsigned char) ((*pSrc >> 11) << 3);            // R
+               G = (unsigned char) ((*pSrc & 0x07e0) >> 3);         // +G
+               B = (unsigned char) ((*pSrc++ & 0x001f) << 3);           // +B
+
+               // Y = 0.299 R + 0.587 G + 0.114 B
+               lt = (306L * (long) R + 601L * (long) G + 117L * (long) B);
+               *pDst++ = (unsigned char ) (lt >> 10);
+               //(BYTE)(((int)R+(int)G+(int)B) /3);
+       }
+}
+
+static void convert_BGRA8888_to_Y(unsigned char* pBuf, unsigned char* pGrayBuf, int width, int height)
+{
+       unsigned long* pSrc = (unsigned long*) pBuf;
+       unsigned char* pDSt = (unsigned char*) pGrayBuf;
+       unsigned char* pEnd = pDSt + height * width;
+
+       while (pDSt < pEnd)
+       {
+               unsigned long r = (*pSrc >> 16) & 0xFF;
+               unsigned long g = (*pSrc >> 8) & 0xFF;
+               unsigned long b = (*pSrc++) & 0xFF;
+
+               *pDSt++ = (308 * r + 600 * g + 116 * b) >> 10;
+       }
+}
+
+static void convert_RGBA8888_to_Y(unsigned char* pBuf, unsigned char* pGrayBuf, int width, int height)
+{
+       unsigned long* pSrc = (unsigned long*) pBuf;
+       unsigned char* pDSt = (unsigned char*) pGrayBuf;
+       unsigned char* pEnd = pDSt + height * width;
+
+       while (pDSt < pEnd)
+       {
+               unsigned long b = (*pSrc >> 16) & 0xFF;
+               unsigned long g = (*pSrc >> 8) & 0xFF;
+               unsigned long r = (*pSrc++) & 0xFF;
+
+               *pDSt++ = (308 * r + 600 * g + 116 * b) >> 10;
+       }
+}
+
+#define CLIP(a) ((a) > 255 ? 255 : (a) < 0 ? 0 : (a))
+
+#if 0
+static void convert_RGB888_to_Y(unsigned char* pBuf, unsigned char* pGrayBuf, int width, int height)
+{
+       unsigned char* pSrc = (unsigned char*) pBuf;
+       unsigned char* pDSt = (unsigned char*) pGrayBuf;
+
+       unsigned char* pEnd = pDSt + height * width;
+
+       while (pDSt < pEnd)
+       {
+               unsigned long r = *pSrc++;
+               unsigned long g = *pSrc++;
+               unsigned long b = *pSrc++;
+
+               *pDSt++ = (308 * r + 600 * g + 116 * b) >> 10;
+       }
+}
+#endif
+
+static bool _validate_face_image_h(face_image_h face_image)
+{
+       if ( face_image == NULL )
+       {
+               return false;
+       }
+
+       if ( face_image->magic != FACE_IMAGE_MAGIC )
+       {
+               return false;
+       }
+
+       return true;
+}
+
+
+EXPORT_API int face_image_create(__in face_image_colorspace_e colorspace, __in unsigned char *buffer, __in int width, __in int height, __in int size, __out face_image_h *face_image)
+{
+       if ( face_image == NULL )
+       {
+               LOG_ERROR("Out pointer is NULL. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( buffer == NULL )
+       {
+               LOG_ERROR("Buffer Cannot be NULL. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( width <= 0 || height  <= 0 )
+       {
+               LOG_ERROR("Invalid image size(%d,%d). %s", width, height, _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       unsigned char *YBuf = NULL;
+       unsigned char *YBufRef = NULL;
+
+       switch(colorspace)
+       {
+               case FACE_IMAGE_COLORSPACE_YUV420:
+                       YBuf = buffer;
+                       break;
+
+               case FACE_IMAGE_COLORSPACE_RGB565:
+                       YBufRef = YBuf = (unsigned char *)calloc(1, width * height);
+                       if ( YBuf == NULL )
+                       {
+                               LOG_ERROR("Cannot allocate FACE_IMAGE_COLORSPACE_RGB565 buffer");
+                               return FACE_ERROR_OUT_OF_MEMORY;
+                       }
+
+                       convert_RGB565_to_Y(buffer, YBuf, width, height);
+                       break;
+
+               case FACE_IMAGE_COLORSPACE_BGRA8888:
+                       YBufRef = YBuf = (unsigned char *)calloc(1, width * height);
+                       if ( YBuf == NULL )
+                       {
+                               LOG_ERROR("Cannot allocate FACE_IMAGE_COLORSPACE_BGRA8888 buffer");
+                               return FACE_ERROR_OUT_OF_MEMORY;
+                       }
+
+                       convert_BGRA8888_to_Y(buffer, YBuf, width, height);
+                       break;
+
+               case FACE_IMAGE_COLORSPACE_RGBA8888:
+                       YBufRef = YBuf = (unsigned char *)calloc(1, width * height);
+                       if ( YBuf == NULL )
+                       {
+                               LOG_ERROR("Cannot allocate FACE_IMAGE_COLORSPACE_RGBA8888 buffer");
+                               return FACE_ERROR_OUT_OF_MEMORY;
+                       }
+
+                       convert_RGBA8888_to_Y(buffer, YBuf, width, height);
+                       break;
+
+
+               case FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY:
+                       YBuf = buffer;
+                       break;
+               default:
+                       LOG_ERROR("Invalid colorspace(%d). %s", colorspace, _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+                       return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       *face_image = (FaceImage *)calloc(1, sizeof(FaceImage));
+
+       if ( *face_image == NULL )
+       {
+               LOG_ERROR("Cannot allocate face_image_h");
+               if ( YBufRef != NULL )
+               {
+                       free(YBufRef);
+               }
+               
+               return FACE_ERROR_OUT_OF_MEMORY;
+       }
+
+       (*face_image)->magic = FACE_IMAGE_MAGIC;
+
+       (*face_image)->pixel = YBuf;
+       (*face_image)->width = width;
+       (*face_image)->height = height;
+       (*face_image)->size = width * height;
+       (*face_image)->colorspace = colorspace;
+
+       return FACE_ERROR_NONE;
+}
+
+
+EXPORT_API int face_image_destroy(face_image_h face_image)
+{
+       if ( _validate_face_image_h(face_image) == false )
+       {
+               LOG_ERROR("Invalid image handle. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( face_image->colorspace == FACE_IMAGE_COLORSPACE_RGB565 || face_image->colorspace == FACE_IMAGE_COLORSPACE_BGRA8888 || face_image->colorspace == FACE_IMAGE_COLORSPACE_RGBA8888 )
+       {
+               free(face_image->pixel);        // Free user buffer
+       }
+
+       face_image->pixel = NULL;
+       face_image->magic = FACE_INVALID_MAGIC;
+
+       free(face_image);
+
+       return FACE_ERROR_NONE;
+}
+
+
+#if 0
+EXPORT_API int face_image_set_data( face_image_h face_image,
+                             face_image_colorspace_e colorspace, unsigned char *buffer, int width, int height, int size)
+{
+
+// Check Param.
+       if ( _validate_face_image_h(face_image) == false )
+       {
+               LOG_ERROR("Invalid image handle. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( buffer == NULL )
+       {
+               LOG_ERROR("Invalid image data. %s", width, height, _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( width <= 0 || height  <= 0 )
+       {
+               LOG_ERROR("Invalid image size(%d,%d). %s", width, height, _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( colorspace != FACE_IMAGE_COLORSPACE_LUMINANCE_ONLY)
+       {
+               LOG_ERROR("Invalid image format(%d). %s", colorspace , _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       face_image->pixel = buffer;
+       face_image->width = width;
+       face_image->height = height;
+       face_image->size = width * height;
+       face_image->colorspace = colorspace;
+
+       return FACE_ERROR_NONE;
+
+}
+
+
+
+EXPORT_API int face_image_get_data(face_image_h face_image,
+                            face_image_colorspace_e *colorspace, unsigned char **buffer, int *width, int *height, int *size)
+{
+       if ( _validate_face_image_h(face_image) == false )
+       {
+               LOG_ERROR("Invalid image handle. %s", _face_convert_error(FACE_ERROR_INVALID_PARAMTER));
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       if ( colorspace == NULL || buffer == NULL || width == NULL || height == NULL )
+       {
+               LOG_ERROR("Invalid param. 0x%08x 0x%08x 0x%08x 0x%08x", colorspace, buffer, width, height);
+               return FACE_ERROR_INVALID_PARAMTER;
+       }
+
+       *buffer = face_image->pixel;
+       *width = face_image->width;
+       *height = face_image->height;
+       *colorspace = face_image->colorspace;
+       *size = face_image->size;
+
+       return FACE_ERROR_NONE;
+}
+#endif
+
+
diff --git a/src/face_priv.c b/src/face_priv.c
new file mode 100755 (executable)
index 0000000..4361f82
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2011 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 "face.h"
+#include "face_priv.h"
+
+const char *_face_convert_error(int err)
+{
+#define STRINGFY(xx) #xx
+
+       struct _Error{
+               face_error_e nError;
+               const char *szError;
+       } ;
+
+       static struct _Error Error[] = {
+                       { FACE_ERROR_INVALID_PARAMTER, STRINGFY(FACE_ERROR_INVALID_PARAMTER) },
+                       { FACE_ERROR_OUT_OF_MEMORY, STRINGFY(FACE_ERROR_OUT_OF_MEMORY) },
+                       { FACE_ERROR_ENGINE_NOT_FOUND, STRINGFY(FACE_ERROR_ENGINE_NOT_FOUND) },
+                       { FACE_ERROR_OPERATION_FAILED, STRINGFY(FACE_ERROR_OPERATION_FAILED) },
+                       { FACE_ERROR_COMPONENT_NOT_FOUND, STRINGFY(FACE_ERROR_COMPONENT_NOT_FOUND) },
+                       { FACE_ERROR_NONE, NULL },      // End
+       };
+
+       int i = 0;
+       while(Error[i].szError != NULL)
+       {
+               if ( Error[i].nError == (face_error_e)err )
+               {
+                       return Error[i].szError;
+               }
+
+               i++;
+       }
+
+       static char error[128];
+       snprintf(error, sizeof(error)-1, "Unknow Error : %d(0x%08x)", err, err);
+       return error;
+
+}
+
+
+
diff --git a/src/face_priv.h b/src/face_priv.h
new file mode 100755 (executable)
index 0000000..8c86341
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2011 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.
+ */
+#ifndef __TIZEN_UIX_FACE_PRIV_H__
+#define __TIZEN_UIX_FACE_PRIV_H__
+
+#include "face-debug.h"
+
+#undef __in
+#define __in
+
+#undef __out
+#define __out
+
+#undef __inout
+#define __inout
+
+#define FACE_COMPONENT_MAGIC   (0x4e3f2e1f)
+#define FACE_FEATURE_MAGIC             (0x09090909)
+#define FACE_IMAGE_MAGIC               (0x1a2b3c4d)
+#define FACE_INVALID_MAGIC             (0xDEADBEAF)
+
+typedef struct face_component_s {
+       face_rect_s face;       // 16
+
+       face_point_s lefteye;   // 8
+       face_point_s righteye;  // 8
+
+       face_rect_s mouth;      // 16
+
+       bool valid;
+       unsigned int magic;
+} FaceComponent;
+
+typedef struct face_image_s {
+       unsigned char *pixel;            /**< pixel data */
+
+       int width;                                       /**< image data's width */
+       int height;                                      /**< image data's height */
+
+       unsigned int size;
+
+       face_image_colorspace_e colorspace;     /**< color space */
+
+       unsigned int magic;
+} FaceImage;
+
+typedef struct face_feature_s {
+       unsigned char *data;    /**< result data of face information */
+       unsigned int len;               /**< size of result data */// in byte unit
+
+       unsigned int magic;
+} FaceFeature;
+
+const char *_face_convert_error(int err);
+
+
+// Internal APIs
+int face_component_create(face_component_h *face_component);
+
+#endif // __TIZEN_UIX_FACE_PRIV_H__
+
diff --git a/src/statistics.c b/src/statistics.c
new file mode 100755 (executable)
index 0000000..4af4c22
--- /dev/null
@@ -0,0 +1,460 @@
+/*
+ * Copyright (c) 2011 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 <sys/time.h>  // gettimeofday
+
+#include <stdio.h>
+#include <malloc.h>
+#include <string.h>
+#include <assert.h>
+#include <time.h>
+
+#include "statistics.h"
+
+#ifdef STANDALONE
+#define EXPORT_API
+#endif
+
+#include <sys/time.h>
+#include <sys/utsname.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
+
+#include <stdarg.h>
+#include "statistics.h"
+
+#define MAX_UINT32 (0xFFFFFFFFL)
+#define MAX_UINT64 (0xFFFFFFFFFFFFFFFFLL)
+
+// defs.
+#define MM_TA_MAX_ACCUM                        100
+
+
+typedef struct _mm_ta_accum_item
+{
+       unsigned long long elapsed_accum;
+       unsigned long num_calls;
+       unsigned long long elapsed_min;
+       unsigned long long elapsed_max;
+       unsigned long long first_start;
+       unsigned long long last_end;
+
+       char* name;
+
+       unsigned long long timestamp;
+       int on_estimate;
+       int num_unpair;
+} mm_ta_accum_item;
+
+
+static void PrintLog(const char *file, int line, const char *msg, ...)
+{
+       va_list va;
+
+       va_start(va, msg);
+       fprintf(stderr ,"[STAT] %s:%d:",file, line);
+       vfprintf(stderr ,msg, va);
+       fprintf(stderr, "\n");
+       va_end(va);
+}
+
+#define MyPrintf(...)  PrintLog(__FILE__, __LINE__, ##__VA_ARGS__ )
+
+
+// internal func.
+static void __free_accums(void);
+static int __get_accum_index(const char* name);
+
+
+// global var.
+static mm_ta_accum_item ** g_accums = NULL;
+static int g_accum_index = 0;
+static int g_accum_longest_name = 0;
+static unsigned long long g_accum_first_time = MAX_UINT64;     // jmlee
+
+
+int PERF_INIT(void)
+{
+       if (g_accums)
+       {
+               return 0;
+       }
+
+       g_accums = (mm_ta_accum_item **) calloc (1, MM_TA_MAX_ACCUM * sizeof(mm_ta_accum_item *) );
+       if(!g_accums)
+       {
+               assert(0);
+               return -1;
+       }
+
+       g_accum_first_time = MAX_UINT64;
+
+       return 0;
+}
+
+int PERF_DEINIT(void)
+{
+       if ( ! g_accums )
+       {
+               return 0;
+       }
+
+       __free_accums();
+
+       g_accum_first_time = MAX_UINT64;
+
+       return 0;
+}
+
+
+static int __get_accum_index(const char* name)
+{
+       int i;
+
+       assert(name);
+
+       // find index
+       for ( i = 0; i < g_accum_index; i++ )
+       {
+               if ( strcmp( name, g_accums[i]->name ) == 0 )
+                       return i;
+       }
+
+       return -1;
+}
+
+static void __free_accums(void)
+{
+       int i = 0;
+
+       if ( ! g_accums )
+               return;
+
+       for ( i = 0; i < g_accum_index; i++ )
+       {
+               if ( g_accums[i] )
+               {
+                       if ( g_accums[i]->name )
+                               free ( g_accums[i]->name );
+
+                       free ( g_accums[i] );
+
+                       g_accums[i] = NULL;
+               }
+       }
+
+       g_accum_index = 0;
+       g_accum_longest_name = 0;
+
+       free ( g_accums );
+       g_accums = NULL;
+}
+
+
+
+int mm_ta_accum_item_begin(const char* name, bool show, const char* filename, int line)
+{
+       mm_ta_accum_item * accum = NULL;
+       int index = 0;
+       int name_len = 0;
+       struct timeval t;
+
+       if (!g_accums)
+               return 0;
+
+       if ( g_accum_index == MM_TA_MAX_ACCUM )
+               return -1;
+
+       if ( !name )
+               return -1;
+
+       name_len = strlen(name);
+       if( name_len == 0 )
+               return -1;
+
+       // if 'name' is new one. create new item.
+       if ( (index = __get_accum_index(name)) == -1 )
+       {
+               accum = ( mm_ta_accum_item * ) calloc(1, sizeof( mm_ta_accum_item ) );
+               if ( !accum )
+               {
+                       assert(0);
+                       return -1;
+               }
+
+               // clear first.
+               memset( accum, 0, sizeof (mm_ta_accum_item) );
+               accum->elapsed_min = MAX_UINT64;
+
+               accum->name = strdup(name);
+               // add it to list.
+               g_accums[g_accum_index] = accum;
+               g_accum_index++;
+
+               if ( g_accum_longest_name < name_len )
+                       g_accum_longest_name = name_len;
+
+       }
+       else
+       {
+               accum = g_accums[index];
+       }
+
+       // verify pairs of begin, end.
+       if (accum->on_estimate)
+       {
+               MyPrintf("[%s] is not 'end'ed!\n", accum->name);
+               accum->num_unpair ++;
+               return -1;
+       }
+
+       accum->on_estimate = 1;
+
+       // get timestamp
+       gettimeofday( &t, NULL );
+       accum->timestamp = t.tv_sec * 1000000UL + t.tv_usec;
+
+       if ( accum->first_start == 0 )
+       {       // assum that timestamp never could be zero.
+               accum->first_start = accum->timestamp;
+
+               if ( g_accum_first_time > accum->first_start )
+               {
+                       g_accum_first_time = accum->first_start ;
+               }
+       }
+
+       if ( show )
+               MyPrintf("[ACCUM BEGIN] %s : %ld ---(%s:%d)\n", name, accum->timestamp, filename, line );
+
+       accum->num_calls++;
+
+       return 0;
+}
+
+int mm_ta_accum_item_end(const char* name, bool show, const char* filename, int line)
+{
+       mm_ta_accum_item * accum = NULL;
+       unsigned long long tval = 0LL;
+       int index = 0;
+       struct timeval  t;
+
+       if (!g_accums)
+               return 0;
+
+       if ( g_accum_index == MM_TA_MAX_ACCUM )
+               return -1;
+
+       if ( !name )
+               return -1;
+
+       if( strlen ( name ) == 0 )
+               return -1;
+
+       // varify the 'name' is already exist.
+       if ( (index = __get_accum_index(name)) == -1 )
+       {
+               MyPrintf("[%s] is not added before!\n", name);
+               return -1;
+       }
+
+       accum = g_accums[index];
+
+       // verify pairs of begin, end.
+       if (!accum->on_estimate)
+       {
+               MyPrintf("[%s] is not 'begin' yet!\n", accum->name);
+               accum->num_unpair ++;
+               return -1;
+       }
+
+       // get time first for more accuracy.
+       gettimeofday( &t, NULL );
+       tval = t.tv_sec*1000000UL + t.tv_usec;
+
+       // update last_end
+       accum->last_end = tval;
+
+#if 0
+       if ( accum->first_start > accum->last_end )
+       {
+               MyPrintf("Invalied timestamp:%s. Start:%lu End=%lu\n", accum->name, accum->first_start , accum->last_end);
+       }
+#endif
+
+       // make get elapsed time.
+       tval = tval - accum->timestamp;
+
+       // update min/max
+       accum->elapsed_max = tval > accum->elapsed_max ? tval : accum->elapsed_max;
+       accum->elapsed_min = tval < accum->elapsed_min ? tval : accum->elapsed_min;
+
+       if ( show )
+               MyPrintf("[ACCUM END] %s : %llu + %llu ---(%s:%d)\n", name, accum->elapsed_accum, tval, filename, line );
+
+       // add elapsed time
+       accum->elapsed_accum = accum->elapsed_accum + tval;
+       accum->on_estimate = 0;
+
+       return 0;
+}
+
+void __print_some_info(FILE* fp)
+{
+       if (!fp)
+               return;
+
+       // General infomation
+       {
+               time_t t_val;
+               char hostname[256] = {'\0',};
+#ifdef LINUX
+               struct utsname uts;
+               struct rusage r_usage;
+#endif
+               fprintf(fp, "\n[[ General info ]]\n");
+
+               // time and date
+               time(&t_val);
+               fprintf(fp, "Date : %s", ctime(&t_val) );
+
+               // system
+               if ( gethostname(hostname, 255) == 0 )
+               {
+                       fprintf(fp, "Hostname : %s\n", hostname);
+               }
+#ifdef LINUX
+               if ( uname(&uts) >= 0 )
+               {
+                       fprintf(fp, "System : %s\n", uts.sysname);
+                       fprintf(fp, "Machine : %s\n", uts.machine);
+                       fprintf(fp, "Nodename : %s\n", uts.nodename);
+                       fprintf(fp, "Release : %s \n", uts.release);
+                       fprintf(fp, "Version : %s \n", uts.version);
+               }
+
+               // process info.
+               fprintf(fp, "Process priority : %d\n", getpriority(PRIO_PROCESS, getpid()) );
+
+               getrusage(RUSAGE_SELF, &r_usage);
+               fprintf(fp, "CPU usage : User = %ld.%06ld, System = %ld.%06ld\n",
+                               r_usage.ru_utime.tv_sec, r_usage.ru_utime.tv_usec,
+                               r_usage.ru_stime.tv_sec, r_usage.ru_stime.tv_usec );
+#endif
+
+       }
+
+       // host environment variables
+       {
+               extern char** environ;
+               char** env = environ;
+
+               fprintf(fp, "\n[[ Host environment variables ]]\n");
+               while(*env)
+               {
+                       fprintf(fp, "%s\n", *env);
+                       env++;
+               }
+       }
+
+       fprintf(fp, "g_accum_first_time = %llu\n", g_accum_first_time);
+
+       fprintf(fp, "\n\n");
+
+}
+
+
+void mm_ta_accum_show_result_fp(FILE *fp)
+{
+       int i = 0;
+       char format[256];
+
+//     __print_some_info(fp);
+
+
+       fprintf(fp, "============================ BEGIN RESULT ACCUM (usec) ====================\n");
+
+       snprintf(format, (size_t)sizeof(format), "[Idx] %%-%ds %%10s %%6s %%10s %%10s %%10s %%4s \n", g_accum_longest_name);
+
+       fprintf(fp, format, "Name", "avg", "hit", "total", "min", "max", "pair");
+
+       snprintf(format, (size_t)sizeof(format), "[%%3d] %%-%ds %%10llu %%6lu %%10llu %%10llu %%10llu %%4s \n", g_accum_longest_name);
+
+       for ( i = 0; i < g_accum_index; i++ )
+       {
+               // prevent 'devide by zero' error
+               if (g_accums[i]->num_calls == 0)
+                       g_accums[i]->num_calls = 1;
+
+               fprintf(fp,
+                       format,
+                       i,
+                       g_accums[i]->name,
+                       (g_accums[i]->elapsed_accum == 0)?0:(g_accums[i]->elapsed_accum / g_accums[i]->num_calls),  // Fix it! : devide by zero.
+                       g_accums[i]->num_calls,
+                       g_accums[i]->elapsed_accum,
+                       g_accums[i]->elapsed_min,
+                       g_accums[i]->elapsed_max,
+                       g_accums[i]->num_unpair == 1 ? "F" : "T" );
+       }
+
+       fprintf(fp, "============================ END RESULT ACCUM  ============================\n");
+
+       if ( fp != stdout && fp != stderr )
+       {
+               fclose(fp);
+       }
+}
+
+
+#define _CONSTRUCTOR __attribute__ ((constructor))
+#define _DESTRUCTOR __attribute__ ((destructor))
+
+static void _CONSTRUCTOR _DLLInit(void)
+{
+       PERF_INIT();
+}
+
+static void _DESTRUCTOR _DLLExit(void)
+{
+       PERF_DEINIT();
+
+}
+
+
+#ifdef STANDALONE
+int main(int argc, char* argv[])
+{
+       int a = 0, b = 0;
+
+
+       PERF_CHECK_BEGIN("Test 1");
+
+       for ( a = 0 ; a < 10; a++)
+       {
+               printf("AAA=%d\n", a);
+               usleep(1*10E6);
+       }
+
+       PERF_CHECK_END("Test 1");
+
+       printf("Test 111\n");
+       return 0;
+}
+#endif
+
+
+
diff --git a/src/statistics.h b/src/statistics.h
new file mode 100755 (executable)
index 0000000..4681f88
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2011 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.
+ */
+#ifndef __STATISTICS_H__
+#define __STATISTICS_H__
+
+#include <stdbool.h>
+#include <stdio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int mm_ta_accum_item_begin(const char* name, bool show, const char* filename, int line);
+int mm_ta_accum_item_end(const char* name, bool show, const char* filename, int line);
+void mm_ta_accum_show_result_fp(FILE *fp);
+
+int PERF_INIT();
+int PERF_DEINIT();
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __STATISTICS_H__ */
+