• 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 bbf_FEATURE_EM_H
18 #define bbf_FEATURE_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_BitFeatureEm/Functions.h"
26 
27 /* ---- related objects  --------------------------------------------------- */
28 
29 /* ---- typedefs ----------------------------------------------------------- */
30 
31 enum bbf_FeatureType
32 {
33 	bbf_FT_UNDEFINED = 0,
34 	bbf_FT_SEQUENCE,
35 	bbf_FT_I04_DNS_2X2_FTR,
36 	bbf_FT_I04_TLD_2X4_FTR,
37 	bbf_FT_I04_DNS_2X4_FTR,
38 	bbf_FT_L01_TLD_2X4_FTR,
39 	bbf_FT_L01_DNS_2X4_FTR,
40 	bbf_FT_L04_DNS_2X4_FTR,
41 	bbf_FT_L04_DNS_3X3_FTR,
42 	bbf_FT_L06_DNS_3X3_FTR,
43 	bbf_FT_L06_DNS_4X4_FTR,
44 	bbf_FT_L06_DNS_NX4X4_FTR,
45 
46 	bbf_FT_L01_TLD_1X1_FTR,
47 	bbf_FT_L04_TLD_2X4_FTR,
48 	bbf_FT_L04_DNS_2X2_FTR
49 };
50 
51 /* ---- constants ---------------------------------------------------------- */
52 
53 /* ---- object definition -------------------------------------------------- */
54 
55 /** base object for features (occurs as first element in all feature objects) */
56 struct bbf_Feature
57 {
58 	/* ---- private data --------------------------------------------------- */
59 
60 	/* ---- public data ---------------------------------------------------- */
61 
62 	/** feature type */
63 	uint32 typeE;
64 
65 	/** width of patch */
66 	uint32 patchWidthE;
67 
68 	/** height of patch */
69 	uint32 patchHeightE;
70 
71 	/* ---- virtual functions ---------------------------------------------- */
72 
73 	/** computes feature's activity (4.28) on the given patch */
74 	int32 ( *vpActivityE )( const struct bbf_Feature* ptrA, const uint32* patchA );
75 };
76 
77 /* ---- associated objects ------------------------------------------------- */
78 
79 /* ---- external functions ------------------------------------------------- */
80 
81 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
82 
83 /** initializes bbf_Feature  */
84 void bbf_Feature_init( struct bbs_Context* cpA,
85 					   struct bbf_Feature* ptrA );
86 
87 /** resets bbf_Feature  */
88 void bbf_Feature_exit( struct bbs_Context* cpA,
89 					   struct bbf_Feature* ptrA );
90 
91 /* ---- \ghd{ operators } -------------------------------------------------- */
92 
93 /** copy operator */
94 void bbf_Feature_copy( struct bbs_Context* cpA,
95 					   struct bbf_Feature* ptrA,
96 					   const struct bbf_Feature* srcPtrA );
97 
98 /** equal operator */
99 flag bbf_Feature_equal( struct bbs_Context* cpA,
100 						const struct bbf_Feature* ptrA,
101 						const struct bbf_Feature* srcPtrA );
102 
103 /* ---- \ghd{ query functions } -------------------------------------------- */
104 
105 /* ---- \ghd{ modify functions } ------------------------------------------- */
106 
107 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
108 
109 /** word size (16-bit) object needs when written to memory */
110 uint32 bbf_Feature_memSize( struct bbs_Context* cpA,
111 						    const struct bbf_Feature* ptrA );
112 
113 /** writes object to memory; returns number of words (16-bit) written */
114 uint32 bbf_Feature_memWrite( struct bbs_Context* cpA,
115 							 const struct bbf_Feature* ptrA, uint16* memPtrA );
116 
117 /** reads object from memory; returns number of words (16-bit) read */
118 uint32 bbf_Feature_memRead( struct bbs_Context* cpA,
119 							struct bbf_Feature* ptrA, const uint16* memPtrA );
120 
121 /* ---- \ghd{ exec functions } --------------------------------------------- */
122 
123 /** virtual init function  */
124 void bbf_featureInit( struct bbs_Context* cpA,
125 					  struct bbf_Feature* ptrA,
126 					  enum bbf_FeatureType typeA );
127 
128 /** virtual exit function */
129 void bbf_featureExit( struct bbs_Context* cpA,
130 					  struct bbf_Feature* ptrA );
131 
132 /** virtual mem size function */
133 uint32 bbf_featureMemSize( struct bbs_Context* cpA,
134 						   const struct bbf_Feature* ptrA );
135 
136 /** virtual mem write function */
137 uint32 bbf_featureMemWrite( struct bbs_Context* cpA,
138 						    const struct bbf_Feature* ptrA, uint16* memPtrA );
139 
140 /** virtual mem read function */
141 uint32 bbf_featureMemRead( struct bbs_Context* cpA,
142 						   struct bbf_Feature* ptrA,
143 						   const uint16* memPtrA,
144 						   struct bbs_MemTbl* mtpA );
145 
146 /** virtual sizeof operator for 16bit units */
147 uint32 bbf_featureSizeOf16( struct bbs_Context* cpA, enum bbf_FeatureType typeA );
148 
149 #endif /* bbf_FEATURE_EM_H */
150 
151