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_L04_TLD_2X4_FTR_EM_H
18 #define bbf_L04_TLD_2X4_FTR_EM_H
19 
20 /* ---- includes ----------------------------------------------------------- */
21 
22 #include "b_BasicEm/Context.h"
23 #include "b_BasicEm/Basic.h"
24 #include "b_BasicEm/UInt32Arr.h"
25 #include "b_BasicEm/Int16Arr.h"
26 #include "b_BasicEm/MemTbl.h"
27 #include "b_BitFeatureEm/Feature.h"
28 
29 /* ---- related objects  --------------------------------------------------- */
30 
31 /* ---- typedefs ----------------------------------------------------------- */
32 
33 /* ---- constants ---------------------------------------------------------- */
34 
35 /* data format version number */
36 #define bbf_L04_TLD_2X4_FTR_VERSION 100
37 
38 /* ---- object definition -------------------------------------------------- */
39 
40 /** discrete feature set */
41 struct bbf_L04Tld2x4Ftr
42 {
43 	/* ---- private data --------------------------------------------------- */
44 
45 	/* ---- public data ---------------------------------------------------- */
46 
47 	/** base element */
48 	struct bbf_Feature baseE;
49 
50 	/** data array */
51 	struct bbs_UInt32Arr dataArrE;
52 
53 	/** factor to convert activity to proper range (.36) */
54 	int32 activityFactorE;
55 };
56 
57 /* ---- associated objects ------------------------------------------------- */
58 
59 /* ---- external functions ------------------------------------------------- */
60 
61 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
62 
63 /** initializes bbf_L04Tld2x4Ftr  */
64 void bbf_L04Tld2x4Ftr_init( struct bbs_Context* cpA,
65 						    struct bbf_L04Tld2x4Ftr* ptrA );
66 
67 /** resets bbf_L04Tld2x4Ftr  */
68 void bbf_L04Tld2x4Ftr_exit( struct bbs_Context* cpA,
69 						    struct bbf_L04Tld2x4Ftr* ptrA );
70 
71 /* ---- \ghd{ operators } -------------------------------------------------- */
72 
73 /** copy operator */
74 void bbf_L04Tld2x4Ftr_copy( struct bbs_Context* cpA,
75 						    struct bbf_L04Tld2x4Ftr* ptrA,
76 						    const struct bbf_L04Tld2x4Ftr* srcPtrA );
77 
78 /** equal operator */
79 flag bbf_L04Tld2x4Ftr_equal( struct bbs_Context* cpA,
80 						     const struct bbf_L04Tld2x4Ftr* ptrA,
81 						     const struct bbf_L04Tld2x4Ftr* srcPtrA );
82 
83 /* ---- \ghd{ query functions } -------------------------------------------- */
84 
85 /* ---- \ghd{ modify functions } ------------------------------------------- */
86 
87 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
88 
89 /** word size (16-bit) object needs when written to memory */
90 uint32 bbf_L04Tld2x4Ftr_memSize( struct bbs_Context* cpA,
91 							     const struct bbf_L04Tld2x4Ftr* ptrA );
92 
93 /** writes object to memory; returns number of words (16-bit) written */
94 uint32 bbf_L04Tld2x4Ftr_memWrite( struct bbs_Context* cpA,
95 							      const struct bbf_L04Tld2x4Ftr* ptrA, uint16* memPtrA );
96 
97 /** reads object from memory; returns number of words (16-bit) read */
98 uint32 bbf_L04Tld2x4Ftr_memRead( struct bbs_Context* cpA,
99 							     struct bbf_L04Tld2x4Ftr* ptrA,
100 							     const uint16* memPtrA,
101 							     struct bbs_MemTbl* mtpA );
102 
103 /* ---- \ghd{ exec functions } --------------------------------------------- */
104 
105 /** computes feature's activity (4.28) on the given patch */
106 int32 bbf_L04Tld2x4Ftr_activity( const struct bbf_Feature* ptrA, const uint32* patchA );
107 
108 #endif /* bbf_L04_TLD_2X4_FTR_EM_H */
109 
110