• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 bts_NORMALIZER_EM_H
18 #define bts_NORMALIZER_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/VectorMap.h"
26 
27 /* ---- related objects  --------------------------------------------------- */
28 
29 /* ---- typedefs ----------------------------------------------------------- */
30 
31 /* ---- constants ---------------------------------------------------------- */
32 
33 /** data format version number */
34 #define bts_NORMALIZER_VERSION 100
35 
36 /* ---- object definition -------------------------------------------------- */
37 
38 /** applies euclidean normalization to vector */
39 struct bts_Normalizer
40 {
41 	/* ---- public data ---------------------------------------------------- */
42 
43 	/** base element (must be first element) */
44 	struct bts_VectorMap baseE;
45 
46 	/* ---- private data --------------------------------------------------- */
47 
48 	/* ---- public data ---------------------------------------------------- */
49 
50 };
51 
52 /* ---- associated objects ------------------------------------------------- */
53 
54 /* ---- external functions ------------------------------------------------- */
55 
56 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
57 
58 /** initializes bts_Normalizer  */
59 void bts_Normalizer_init( struct bbs_Context* cpA,
60 					       struct bts_Normalizer* ptrA );
61 
62 /** resets bts_Normalizer  */
63 void bts_Normalizer_exit( struct bbs_Context* cpA,
64 					       struct bts_Normalizer* ptrA );
65 
66 /* ---- \ghd{ operators } -------------------------------------------------- */
67 
68 /** copy operator */
69 void bts_Normalizer_copy( struct bbs_Context* cpA,
70  					       struct bts_Normalizer* ptrA,
71 					       const struct bts_Normalizer* srcPtrA );
72 
73 /** equal operator */
74 flag bts_Normalizer_equal( struct bbs_Context* cpA,
75 						    const struct bts_Normalizer* ptrA,
76 						    const struct bts_Normalizer* srcPtrA );
77 
78 /* ---- \ghd{ query functions } -------------------------------------------- */
79 
80 /* ---- \ghd{ modify functions } ------------------------------------------- */
81 
82 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
83 
84 /** word size (16-bit) object needs when written to memory */
85 uint32 bts_Normalizer_memSize( struct bbs_Context* cpA,
86 						        const struct bts_Normalizer* ptrA );
87 
88 /** writes object to memory; returns number of words (16-bit) written */
89 uint32 bts_Normalizer_memWrite( struct bbs_Context* cpA,
90 							     const struct bts_Normalizer* ptrA, uint16* memPtrA );
91 
92 /** reads object from memory; returns number of words (16-bit) read */
93 uint32 bts_Normalizer_memRead( struct bbs_Context* cpA,
94 							    struct bts_Normalizer* ptrA,
95 							    const uint16* memPtrA,
96 							    struct bbs_MemTbl* mtpA );
97 
98 /* ---- \ghd{ exec functions } --------------------------------------------- */
99 
100 /** Vector map operation.
101  *  Maps vector inVec to outVec (overflow-safe)
102  *  Memory areas of vectors may not overlap
103  */
104 void bts_Normalizer_map( struct bbs_Context* cpA,
105 						  const struct bts_VectorMap* ptrA,
106 						  const struct bts_Flt16Vec* inVecPtrA,
107 						  struct bts_Flt16Vec* outVecPtrA );
108 
109 #endif /* bts_NORMALIZER_EM_H */
110 
111