17f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* 27f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Copyright (C) 2008 The Android Open Source Project 37f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 47f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 57f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * you may not use this file except in compliance with the License. 67f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * You may obtain a copy of the License at 77f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 87f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 97f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * 107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * Unless required by applicable law or agreed to in writing, software 117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * See the License for the specific language governing permissions and 147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project * limitations under the License. 157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project */ 167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#ifndef bbf_SEQUENCE_EM_H 187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbf_SEQUENCE_EM_H 197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- includes ----------------------------------------------------------- */ 217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Context.h" 237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Basic.h" 247f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/Int32Arr.h" 257f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/UInt16Arr.h" 267f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BasicEm/MemTbl.h" 277f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#include "b_BitFeatureEm/Feature.h" 287f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 297f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- related objects --------------------------------------------------- */ 307f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 317f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- typedefs ----------------------------------------------------------- */ 327f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 337f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- constants ---------------------------------------------------------- */ 347f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 357f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** data format version number */ 367f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbf_SEQUENCE_VERSION 101 377f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 387f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** maximum sequence size */ 397f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#define bbf_SEQUENCE_MAX_SIZE 16 407f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 417f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- object definition -------------------------------------------------- */ 427f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 437f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** inhomogenious sequence of features */ 447f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectstruct bbf_Sequence 457f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project{ 467f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* ---- public data ---------------------------------------------------- */ 477f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 487f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /** base element (must be first element) */ 497f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbf_Feature baseE; 507f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 517f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* ---- private data --------------------------------------------------- */ 527f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 537f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /** feature pointer arrray */ 547f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbf_Feature* ftrPtrArrE[ bbf_SEQUENCE_MAX_SIZE ]; 557f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 567f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /* ---- public data ---------------------------------------------------- */ 577f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 587f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /** sequence size */ 597f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project uint32 sizeE; 607f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 617f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /** array of thresholds (4.28) */ 627f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_Int32Arr thrArrE; 637f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 647f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /** array of weights (0.16); value 1.0 is saturated to 0xFFFF */ 657f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_UInt16Arr wgtArrE; 667f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 677f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project /** data array (contains feature elements) */ 687f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_UInt16Arr dataArrE; 697f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project}; 707f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 717f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- associated objects ------------------------------------------------- */ 727f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 737f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- external functions ------------------------------------------------- */ 747f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 757f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ constructor/destructor } ------------------------------------- */ 767f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 777f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** initializes bbf_Sequence */ 787f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbf_Sequence_init( struct bbs_Context* cpA, 797f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbf_Sequence* ptrA ); 807f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 817f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** resets bbf_Sequence */ 827f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbf_Sequence_exit( struct bbs_Context* cpA, 837f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbf_Sequence* ptrA ); 847f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 857f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ operators } -------------------------------------------------- */ 867f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 877f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** copy operator */ 887f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectvoid bbf_Sequence_copy( struct bbs_Context* cpA, 897f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbf_Sequence* ptrA, 907f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bbf_Sequence* srcPtrA ); 917f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 927f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** equal operator */ 937f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectflag bbf_Sequence_equal( struct bbs_Context* cpA, 947f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bbf_Sequence* ptrA, 957f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bbf_Sequence* srcPtrA ); 967f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 977f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ query functions } -------------------------------------------- */ 987f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 997f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ modify functions } ------------------------------------------- */ 1007f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1017f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ memory I/O } ------------------------------------------------- */ 1027f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1037f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** word size (16-bit) object needs when written to memory */ 1047f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbf_Sequence_memSize( struct bbs_Context* cpA, 1057f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bbf_Sequence* ptrA ); 1067f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1077f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** writes object to memory; returns number of words (16-bit) written */ 1087f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbf_Sequence_memWrite( struct bbs_Context* cpA, 1097f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const struct bbf_Sequence* ptrA, uint16* memPtrA ); 1107f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1117f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** reads object from memory; returns number of words (16-bit) read */ 1127f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectuint32 bbf_Sequence_memRead( struct bbs_Context* cpA, 1137f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbf_Sequence* ptrA, 1147f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project const uint16* memPtrA, 1157f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project struct bbs_MemTbl* mtpA ); 1167f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1177f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/* ---- \ghd{ exec functions } --------------------------------------------- */ 1187f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1197f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project/** computes feature's activity (4.28) on the given patch */ 1207f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Projectint32 bbf_Sequence_activity( const struct bbf_Feature* ptrA, const uint32* patchA ); 1217f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 1227f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project#endif /* bbf_SEQUENCE_EM_H */ 1237f81d9b6fa7f2ec161b682622db577a28c90b49fThe Android Open Source Project 124