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_I04_DNS_2X4_FTR_EM_H 18 #define bbf_I04_DNS_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_I04_DNS_2X4_FTR_VERSION 100 37 38 /* ---- object definition -------------------------------------------------- */ 39 40 /** discrete feature set */ 41 struct bbf_I04Dns2x4Ftr 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 /** look up table of weights */ 54 struct bbs_Int16Arr tableE; 55 56 /** factor to convert activity to proper range (.36) */ 57 int32 activityFactorE; 58 }; 59 60 /* ---- associated objects ------------------------------------------------- */ 61 62 /* ---- external functions ------------------------------------------------- */ 63 64 /* ---- \ghd{ constructor/destructor } ------------------------------------- */ 65 66 /** initializes bbf_I04Dns2x4Ftr */ 67 void bbf_I04Dns2x4Ftr_init( struct bbs_Context* cpA, 68 struct bbf_I04Dns2x4Ftr* ptrA ); 69 70 /** resets bbf_I04Dns2x4Ftr */ 71 void bbf_I04Dns2x4Ftr_exit( struct bbs_Context* cpA, 72 struct bbf_I04Dns2x4Ftr* ptrA ); 73 74 /* ---- \ghd{ operators } -------------------------------------------------- */ 75 76 /** copy operator */ 77 void bbf_I04Dns2x4Ftr_copy( struct bbs_Context* cpA, 78 struct bbf_I04Dns2x4Ftr* ptrA, 79 const struct bbf_I04Dns2x4Ftr* srcPtrA ); 80 81 /** equal operator */ 82 flag bbf_I04Dns2x4Ftr_equal( struct bbs_Context* cpA, 83 const struct bbf_I04Dns2x4Ftr* ptrA, 84 const struct bbf_I04Dns2x4Ftr* srcPtrA ); 85 86 /* ---- \ghd{ query functions } -------------------------------------------- */ 87 88 /* ---- \ghd{ modify functions } ------------------------------------------- */ 89 90 /* ---- \ghd{ memory I/O } ------------------------------------------------- */ 91 92 /** word size (16-bit) object needs when written to memory */ 93 uint32 bbf_I04Dns2x4Ftr_memSize( struct bbs_Context* cpA, 94 const struct bbf_I04Dns2x4Ftr* ptrA ); 95 96 /** writes object to memory; returns number of words (16-bit) written */ 97 uint32 bbf_I04Dns2x4Ftr_memWrite( struct bbs_Context* cpA, 98 const struct bbf_I04Dns2x4Ftr* ptrA, uint16* memPtrA ); 99 100 /** reads object from memory; returns number of words (16-bit) read */ 101 uint32 bbf_I04Dns2x4Ftr_memRead( struct bbs_Context* cpA, 102 struct bbf_I04Dns2x4Ftr* ptrA, 103 const uint16* memPtrA, 104 struct bbs_MemTbl* mtpA ); 105 106 /* ---- \ghd{ exec functions } --------------------------------------------- */ 107 108 /** computes feature's activity (4.28) on the given patch */ 109 int32 bbf_I04Dns2x4Ftr_activity( const struct bbf_Feature* ptrA, const uint32* patchA ); 110 111 #endif /* bbf_I04_DNS_2X4_FTR_EM_H */ 112 113