auto import from //depot/cupcake/@135843
[android/platform/external/neven.git] / Embedded / common / src / b_APIEm / FaceFinder.h
1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef bpi_FACE_FINDER_EM_H
18 #define bpi_FACE_FINDER_EM_H
19
20 /* ---- includes ----------------------------------------------------------- */
21
22 #include "b_BasicEm/Context.h"
23 #include "b_BasicEm/Basic.h"
24 #include "b_BasicEm/MemTbl.h"
25 #include "b_TensorEm/Flt16Vec.h"
26 #include "b_TensorEm/IdCluster2D.h"
27 #include "b_APIEm/DCR.h"
28
29 /* ---- related objects  --------------------------------------------------- */
30
31 /* ---- typedefs ----------------------------------------------------------- */
32
33 /** Object Type */
34 enum bpi_FaceFinderType
35 {
36         bpi_FF_UNDEFINED = 0,
37         bpi_FF_BF_FACE_FINDER    /* bitfeature based faceFinder */
38 };
39
40 /* ---- constants ---------------------------------------------------------- */
41
42 /* ---- object definition -------------------------------------------------- */
43
44 /** base object for face finder modules (occurs as first element in all face finder objects) */
45 struct bpi_FaceFinder 
46 {
47         /* ---- private data --------------------------------------------------- */
48
49         /* ---- public data ---------------------------------------------------- */
50
51         /** object type */
52         uint32 typeE;
53
54         /* ---- virtual functions ---------------------------------------------- */
55
56         /** initializes some parameters prior to reading */ 
57         void ( *vpSetParamsE )( struct bbs_Context* cpA,
58                                                         struct bpi_FaceFinder* ptrA, 
59                                                         uint32 maxImageWidthA,
60                                                         uint32 maxImageHeightA );
61
62         /** sets detection range */ 
63         void ( *vpSetRangeE )( struct bbs_Context* cpA,
64                                                    struct bpi_FaceFinder* ptrA, 
65                                                    uint32 minEyeDistanceA,
66                                                    uint32 maxEyeDistanceA );
67
68         /** single face processing function; returns confidence (8.24) */ 
69         int32 ( *vpProcessE )( struct bbs_Context* cpA,
70                                                    const struct bpi_FaceFinder* ptrA, 
71                                                    struct bpi_DCR* dcrPtrA );
72
73         /** multiple face processing function; returns number of faces detected */ 
74         int32 ( *vpPutDcrE )( struct bbs_Context* cpA,
75                                                   const struct bpi_FaceFinder* ptrA, 
76                                                   struct bpi_DCR* dcrPtrA );
77
78         /** retrieves indexed face from face finder after calling PutDCR */ 
79         void ( *vpGetDcrE )( struct bbs_Context* cpA,
80                                                  const struct bpi_FaceFinder* ptrA, 
81                                                  uint32 indexA,
82                                                  struct bpi_DCR* dcrPtrA );
83
84 };
85
86 /* ---- associated objects ------------------------------------------------- */
87
88 /* ---- external functions ------------------------------------------------- */
89
90 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
91
92 /** initializes bpi_FaceFinder  */
93 void bpi_FaceFinder_init( struct bbs_Context* cpA,
94                                           struct bpi_FaceFinder* ptrA );
95
96 /** resets bpi_FaceFinder  */
97 void bpi_FaceFinder_exit( struct bbs_Context* cpA,
98                                           struct bpi_FaceFinder* ptrA );
99
100 /* ---- \ghd{ operators } -------------------------------------------------- */
101
102 /** copy operator */
103 void bpi_FaceFinder_copy( struct bbs_Context* cpA,
104                                               struct bpi_FaceFinder* ptrA, 
105                                               const struct bpi_FaceFinder* srcPtrA );
106
107 /** equal operator */
108 flag bpi_FaceFinder_equal( struct bbs_Context* cpA,
109                                                    const struct bpi_FaceFinder* ptrA, 
110                                                    const struct bpi_FaceFinder* srcPtrA );
111
112 /* ---- \ghd{ query functions } -------------------------------------------- */
113
114 /* ---- \ghd{ modify functions } ------------------------------------------- */
115
116 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
117
118 /** word size (16-bit) object needs when written to memory */
119 uint32 bpi_FaceFinder_memSize( struct bbs_Context* cpA,
120                                                        const struct bpi_FaceFinder* ptrA );
121
122 /** writes object to memory; returns number of words (16-bit) written */
123 uint32 bpi_FaceFinder_memWrite( struct bbs_Context* cpA,
124                                                             const struct bpi_FaceFinder* ptrA, uint16* memPtrA );
125
126 /** reads object from memory; returns number of words (16-bit) read */
127 uint32 bpi_FaceFinder_memRead( struct bbs_Context* cpA,
128                                                            struct bpi_FaceFinder* ptrA, const uint16* memPtrA );
129
130 /* ---- \ghd{ exec functions } --------------------------------------------- */
131
132 /** virtual init function  */
133 void bpi_faceFinderInit( struct bbs_Context* cpA,
134                                                  struct bpi_FaceFinder* ptrA,
135                                                  enum bpi_FaceFinderType typeA );
136
137 /** virtual exit function */
138 void bpi_faceFinderExit( struct bbs_Context* cpA, 
139                                                  struct bpi_FaceFinder* ptrA );
140
141 /** virtual mem size function */
142 uint32 bpi_faceFinderMemSize( struct bbs_Context* cpA, 
143                                                       const struct bpi_FaceFinder* ptrA );
144
145 /** virtual mem write function */
146 uint32 bpi_faceFinderMemWrite( struct bbs_Context* cpA, 
147                                                        const struct bpi_FaceFinder* ptrA, 
148                                                            uint16* memPtrA );
149
150 /** virtual mem read function */
151 uint32 bpi_faceFinderMemRead( struct bbs_Context* cpA,
152                                                           struct bpi_FaceFinder* ptrA, 
153                                                           const uint16* memPtrA,
154                                                           struct bbs_MemTbl* mtpA );
155
156 /** virtual sizeof operator for 16bit units */
157 uint32 bpi_faceFinderSizeOf16( struct bbs_Context* cpA, 
158                                                            enum bpi_FaceFinderType typeA );
159
160 #endif /* bpi_FACE_FINDER_EM_H */
161