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 bts_FLT16MAT3D_EM_H 18#define bts_FLT16MAT3D_EM_H 19 20/* ---- includes ----------------------------------------------------------- */ 21 22#include "b_BasicEm/Context.h" 23#include "b_BasicEm/Basic.h" 24#include "b_BasicEm/Phase.h" 25#include "b_TensorEm/Int16Vec3D.h" 26#include "b_TensorEm/Flt16Vec3D.h" 27 28/* ---- related objects --------------------------------------------------- */ 29 30/* ---- typedefs ----------------------------------------------------------- */ 31 32/* ---- constants ---------------------------------------------------------- */ 33 34/* ---- object definition -------------------------------------------------- */ 35 36/** 3d matrix with floating point */ 37struct bts_Flt16Mat3D 38{ 39 40 /* ---- private data --------------------------------------------------- */ 41 42 /* ---- public data ---------------------------------------------------- */ 43 44 /** xx component */ 45 int16 xxE; 46 47 /** xy component */ 48 int16 xyE; 49 50 /** xz component */ 51 int16 xzE; 52 53 /** yx component */ 54 int16 yxE; 55 56 /** yy component */ 57 int16 yyE; 58 59 /** yz component */ 60 int16 yzE; 61 62 /** zx component */ 63 int16 zxE; 64 65 /** zy component */ 66 int16 zyE; 67 68 /** zz component */ 69 int16 zzE; 70 71 /** point position */ 72 int16 bbpE; 73}; 74 75/* ---- associated objects ------------------------------------------------- */ 76 77/* ---- external functions ------------------------------------------------- */ 78 79/* ---- \ghd{ constructor/destructor } ------------------------------------- */ 80 81/** initializes matrix */ 82void bts_Flt16Mat3D_init( struct bts_Flt16Mat3D* ptrA ); 83 84/** destroys matrix */ 85void bts_Flt16Mat3D_exit( struct bts_Flt16Mat3D* ptrA ); 86 87/* ---- \ghd{ operators } -------------------------------------------------- */ 88 89/* ---- \ghd{ query functions } -------------------------------------------- */ 90 91/* ---- \ghd{ modify functions } ------------------------------------------- */ 92 93/* ---- \ghd{ memory I/O } ------------------------------------------------- */ 94 95/** size object needs when written to memory */ 96uint32 bts_Flt16Mat3D_memSize( struct bbs_Context* cpA, 97 const struct bts_Flt16Mat3D* ptrA ); 98 99/** writes object to memory; returns number of bytes written */ 100uint32 bts_Flt16Mat3D_memWrite( struct bbs_Context* cpA, 101 const struct bts_Flt16Mat3D* ptrA, 102 uint16* memPtrA ); 103 104/** reads object from memory; returns number of bytes read */ 105uint32 bts_Flt16Mat3D_memRead( struct bbs_Context* cpA, 106 struct bts_Flt16Mat3D* ptrA, 107 const uint16* memPtrA ); 108 109/* ---- \ghd{ exec functions } --------------------------------------------- */ 110 111/** creates identity matrix */ 112struct bts_Flt16Mat3D bts_Flt16Mat3D_createIdentity( void ); 113 114/** creates scale matrix */ 115struct bts_Flt16Mat3D bts_Flt16Mat3D_createScale( int32 scaleA, int32 scaleBbpA ); 116 117/** creates matrix from 16 bit values */ 118struct bts_Flt16Mat3D bts_Flt16Mat3D_create16( int16 xxA, int16 xyA, int16 xzA, 119 int16 yxA, int16 yyA, int16 yzA, 120 int16 zxA, int16 zyA, int16 zzA, 121 int16 bbpA ); 122 123/** creates matrix from 32 bit values (automatic adjustment of bbp value) */ 124struct bts_Flt16Mat3D bts_Flt16Mat3D_create32( int32 xxA, int32 xyA, int32 xzA, 125 int32 yxA, int32 yyA, int32 yzA, 126 int32 zxA, int32 zyA, int32 zzA, 127 int32 bbpA ); 128 129/** scales matrix by a factor */ 130void bts_Flt16Mat3D_scale( struct bts_Flt16Mat3D* ptrA, int32 scaleA, int32 scaleBbpA ); 131 132/** multiplies matrix with vecA; returns resulting vector */ 133#ifndef HW_EE /* causes internal compiler error in ee-gcc */ 134struct bts_Int16Vec3D bts_Flt16Mat3D_map( const struct bts_Flt16Mat3D* matPtrA, 135 const struct bts_Int16Vec3D* vecPtrA ); 136#endif 137/** Multiplies matrix with float vecA; returns resulting vector. 138 * The point position of returned vector is the same as of the input vector. 139 */ 140struct bts_Flt16Vec3D bts_Flt16Mat3D_mapFlt( const struct bts_Flt16Mat3D* matPtrA, 141 const struct bts_Flt16Vec3D* vecPtrA ); 142 143/** multiplies matrix with matA; returns resulting matrix */ 144struct bts_Flt16Mat3D bts_Flt16Mat3D_mul( const struct bts_Flt16Mat3D* mat1PtrA, 145 const struct bts_Flt16Mat3D* mat2PtrA ); 146 147/** multiplies matrix with matA; returns pointer to resulting matrix */ 148struct bts_Flt16Mat3D* bts_Flt16Mat3D_mulTo( struct bts_Flt16Mat3D* mat1PtrA, 149 const struct bts_Flt16Mat3D* mat2PtrA ); 150 151#endif /* bts_FLT16MAT3D_EM_H */ 152 153