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 /* ---- includes ----------------------------------------------------------- */
18
19 #include "b_BasicEm/Functions.h"
20 #include "b_APIEm/FaceFinder.h"
21 #include "b_APIEm/BFFaceFinder.h"
22
23 /* ------------------------------------------------------------------------- */
24
25 /* ========================================================================= */
26 /* */
27 /* ---- \ghd{ auxiliary functions } ---------------------------------------- */
28 /* */
29 /* ========================================================================= */
30
31 /* ------------------------------------------------------------------------- */
32
33 /* ========================================================================= */
34 /* */
35 /* ---- \ghd{ constructor / destructor } ----------------------------------- */
36 /* */
37 /* ========================================================================= */
38
39 /* ------------------------------------------------------------------------- */
40
bpi_FaceFinder_init(struct bbs_Context * cpA,struct bpi_FaceFinder * ptrA)41 void bpi_FaceFinder_init( struct bbs_Context* cpA,
42 struct bpi_FaceFinder* ptrA )
43 {
44 ptrA->typeE = 0;
45 ptrA->vpSetParamsE = NULL;
46 ptrA->vpSetRangeE = NULL;
47 ptrA->vpProcessE = NULL;
48 ptrA->vpPutDcrE = NULL;
49 ptrA->vpGetDcrE = NULL;
50 }
51
52 /* ------------------------------------------------------------------------- */
53
bpi_FaceFinder_exit(struct bbs_Context * cpA,struct bpi_FaceFinder * ptrA)54 void bpi_FaceFinder_exit( struct bbs_Context* cpA,
55 struct bpi_FaceFinder* ptrA )
56 {
57 ptrA->typeE = 0;
58 ptrA->vpSetParamsE = NULL;
59 ptrA->vpSetRangeE = NULL;
60 ptrA->vpProcessE = NULL;
61 ptrA->vpPutDcrE = NULL;
62 ptrA->vpGetDcrE = NULL;
63 }
64
65 /* ------------------------------------------------------------------------- */
66
67 /* ========================================================================= */
68 /* */
69 /* ---- \ghd{ operators } -------------------------------------------------- */
70 /* */
71 /* ========================================================================= */
72
73 /* ------------------------------------------------------------------------- */
74
bpi_FaceFinder_copy(struct bbs_Context * cpA,struct bpi_FaceFinder * ptrA,const struct bpi_FaceFinder * srcPtrA)75 void bpi_FaceFinder_copy( struct bbs_Context* cpA,
76 struct bpi_FaceFinder* ptrA,
77 const struct bpi_FaceFinder* srcPtrA )
78 {
79 ptrA->typeE = srcPtrA->typeE;
80 ptrA->vpSetParamsE = srcPtrA->vpSetParamsE;
81 ptrA->vpSetRangeE = srcPtrA->vpSetRangeE;
82 ptrA->vpProcessE = srcPtrA->vpProcessE;
83 ptrA->vpPutDcrE = srcPtrA->vpPutDcrE;
84 ptrA->vpGetDcrE = srcPtrA->vpGetDcrE;
85 }
86
87 /* ------------------------------------------------------------------------- */
88
bpi_FaceFinder_equal(struct bbs_Context * cpA,const struct bpi_FaceFinder * ptrA,const struct bpi_FaceFinder * srcPtrA)89 flag bpi_FaceFinder_equal( struct bbs_Context* cpA,
90 const struct bpi_FaceFinder* ptrA,
91 const struct bpi_FaceFinder* srcPtrA )
92 {
93
94 if( ptrA->typeE != srcPtrA->typeE ) return FALSE;
95 if( ptrA->vpSetParamsE != srcPtrA->vpSetParamsE ) return FALSE;
96 if( ptrA->vpSetRangeE != srcPtrA->vpSetRangeE ) return FALSE;
97 if( ptrA->vpProcessE != srcPtrA->vpProcessE ) return FALSE;
98 if( ptrA->vpPutDcrE != srcPtrA->vpPutDcrE ) return FALSE;
99 if( ptrA->vpGetDcrE != srcPtrA->vpGetDcrE ) return FALSE;
100 return TRUE;
101 }
102
103 /* ------------------------------------------------------------------------- */
104
105 /* ========================================================================= */
106 /* */
107 /* ---- \ghd{ query functions } -------------------------------------------- */
108 /* */
109 /* ========================================================================= */
110
111 /* ------------------------------------------------------------------------- */
112
113 /* ========================================================================= */
114 /* */
115 /* ---- \ghd{ modify functions } ------------------------------------------- */
116 /* */
117 /* ========================================================================= */
118
119 /* ------------------------------------------------------------------------- */
120
121 /* ========================================================================= */
122 /* */
123 /* ---- \ghd{ I/O } -------------------------------------------------------- */
124 /* */
125 /* ========================================================================= */
126
127 /* ------------------------------------------------------------------------- */
128
bpi_FaceFinder_memSize(struct bbs_Context * cpA,const struct bpi_FaceFinder * ptrA)129 uint32 bpi_FaceFinder_memSize( struct bbs_Context* cpA,
130 const struct bpi_FaceFinder* ptrA )
131 {
132 uint32 memSizeL = 0;
133 memSizeL += bbs_SIZEOF16( ptrA->typeE );
134 return memSizeL;
135 }
136
137 /* ------------------------------------------------------------------------- */
138
bpi_FaceFinder_memWrite(struct bbs_Context * cpA,const struct bpi_FaceFinder * ptrA,uint16 * memPtrA)139 uint32 bpi_FaceFinder_memWrite( struct bbs_Context* cpA,
140 const struct bpi_FaceFinder* ptrA,
141 uint16* memPtrA )
142 {
143 uint32 memSizeL = bpi_FaceFinder_memSize( cpA, ptrA );
144 memPtrA += bbs_memWrite32( &ptrA->typeE, memPtrA );
145 return memSizeL;
146 }
147
148 /* ------------------------------------------------------------------------- */
149
bpi_FaceFinder_memRead(struct bbs_Context * cpA,struct bpi_FaceFinder * ptrA,const uint16 * memPtrA)150 uint32 bpi_FaceFinder_memRead( struct bbs_Context* cpA,
151 struct bpi_FaceFinder* ptrA,
152 const uint16* memPtrA )
153 {
154 bbs_DEF_fNameL( "uint32 bpi_FaceFinder_memRead( struct bbs_Context* cpA, struct bpi_FaceFinder* ptrA, const uint16* memPtrA )" )
155 uint32 typeL;
156
157 if( bbs_Context_error( cpA ) ) return 0;
158 memPtrA += bbs_memRead32( &typeL, memPtrA );
159
160 if( typeL != ptrA->typeE )
161 {
162 bbs_ERROR1( "%s:\nObject type mismatch! Attempt to read an incorrect object.", fNameL );
163 return 0;
164 }
165
166 return bpi_FaceFinder_memSize( cpA, ptrA );
167 }
168
169 /* ------------------------------------------------------------------------- */
170
171 /* ========================================================================= */
172 /* */
173 /* ---- \ghd{ exec functions } --------------------------------------------- */
174 /* */
175 /* ========================================================================= */
176
177 /* ------------------------------------------------------------------------- */
178
bpi_faceFinderInit(struct bbs_Context * cpA,struct bpi_FaceFinder * ptrA,enum bpi_FaceFinderType typeA)179 void bpi_faceFinderInit( struct bbs_Context* cpA,
180 struct bpi_FaceFinder* ptrA,
181 enum bpi_FaceFinderType typeA )
182 {
183 switch( typeA )
184 {
185 case bpi_FF_BF_FACE_FINDER: bpi_BFFaceFinder_init( cpA, ( struct bpi_BFFaceFinder* )ptrA ); return;
186
187 default: bbs_ERROR0( "bpi_faceFinderInit: invalid type" );
188 }
189 }
190
191 /* ------------------------------------------------------------------------- */
192
bpi_faceFinderExit(struct bbs_Context * cpA,struct bpi_FaceFinder * ptrA)193 void bpi_faceFinderExit( struct bbs_Context* cpA,
194 struct bpi_FaceFinder* ptrA )
195 {
196 switch( ptrA->typeE )
197 {
198 case bpi_FF_BF_FACE_FINDER: bpi_BFFaceFinder_exit( cpA, ( struct bpi_BFFaceFinder* )ptrA ); return;
199
200 default: bbs_ERROR0( "bpi_faceFinderExit: invalid type" );
201 }
202 }
203
204 /* ------------------------------------------------------------------------- */
205
bpi_faceFinderMemSize(struct bbs_Context * cpA,const struct bpi_FaceFinder * ptrA)206 uint32 bpi_faceFinderMemSize( struct bbs_Context* cpA,
207 const struct bpi_FaceFinder* ptrA )
208 {
209 switch( ptrA->typeE )
210 {
211 case bpi_FF_BF_FACE_FINDER: return bpi_BFFaceFinder_memSize( cpA, ( struct bpi_BFFaceFinder* )ptrA );
212
213 default: bbs_ERROR0( "bpi_faceFinderExit: invalid type" );
214 }
215 return 0;
216 }
217
218 /* ------------------------------------------------------------------------- */
219
bpi_faceFinderMemWrite(struct bbs_Context * cpA,const struct bpi_FaceFinder * ptrA,uint16 * memPtrA)220 uint32 bpi_faceFinderMemWrite( struct bbs_Context* cpA,
221 const struct bpi_FaceFinder* ptrA, uint16* memPtrA )
222 {
223 switch( ptrA->typeE )
224 {
225 case bpi_FF_BF_FACE_FINDER: return bpi_BFFaceFinder_memWrite( cpA, ( struct bpi_BFFaceFinder* )ptrA, memPtrA );
226
227 default: bbs_ERROR0( "bpi_faceFinderMemWrite: invalid type" );
228 }
229 return 0;
230 }
231
232 /* ------------------------------------------------------------------------- */
233
bpi_faceFinderMemRead(struct bbs_Context * cpA,struct bpi_FaceFinder * ptrA,const uint16 * memPtrA,struct bbs_MemTbl * mtpA)234 uint32 bpi_faceFinderMemRead( struct bbs_Context* cpA,
235 struct bpi_FaceFinder* ptrA,
236 const uint16* memPtrA,
237 struct bbs_MemTbl* mtpA )
238 {
239 switch( ptrA->typeE )
240 {
241 case bpi_FF_BF_FACE_FINDER: return bpi_BFFaceFinder_memRead( cpA, ( struct bpi_BFFaceFinder* )ptrA, memPtrA, mtpA );
242
243 default: bbs_ERROR0( "bpi_faceFinderMemRead: invalid type" );
244 }
245 return 0;
246 }
247
248 /* ------------------------------------------------------------------------- */
249
bpi_faceFinderSizeOf16(struct bbs_Context * cpA,enum bpi_FaceFinderType typeA)250 uint32 bpi_faceFinderSizeOf16( struct bbs_Context* cpA, enum bpi_FaceFinderType typeA )
251 {
252 switch( typeA )
253 {
254 case bpi_FF_BF_FACE_FINDER: return bbs_SIZEOF16( struct bpi_BFFaceFinder );
255
256 default: bbs_ERROR0( "bpi_faceFinderSizeOf16: invalid type" );
257 }
258 return 0;
259 }
260
261 /* ------------------------------------------------------------------------- */
262
263 /* ========================================================================= */
264
265