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