Home | History | Annotate | Download | only in b_TensorEm
      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_FLT16ALT3D_EM_H
     18 #define bts_FLT16ALT3D_EM_H
     19 
     20 /* ---- includes ----------------------------------------------------------- */
     21 
     22 #include "b_BasicEm/Context.h"
     23 #include "b_BasicEm/Basic.h"
     24 #include "b_TensorEm/Flt16Mat3D.h"
     25 #include "b_TensorEm/Flt16Vec3D.h"
     26 
     27 /* ---- related objects  --------------------------------------------------- */
     28 
     29 /* ---- typedefs ----------------------------------------------------------- */
     30 
     31 /* ---- constants ---------------------------------------------------------- */
     32 
     33 /* ---- object definition -------------------------------------------------- */
     34 
     35 /** 3d affine linear trafo */
     36 struct bts_Flt16Alt3D
     37 {
     38 
     39 	/* ---- private data --------------------------------------------------- */
     40 
     41 	/* ---- public data ---------------------------------------------------- */
     42 
     43 	/** matrix */
     44 	struct bts_Flt16Mat3D matE;
     45 
     46 	/** vector */
     47 	struct bts_Flt16Vec3D vecE;
     48 };
     49 
     50 /* ---- associated objects ------------------------------------------------- */
     51 
     52 /* ---- external functions ------------------------------------------------- */
     53 
     54 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
     55 
     56 /** initializes alt */
     57 void bts_Flt16Alt3D_init( struct bts_Flt16Alt3D* ptrA );
     58 
     59 /** destroys alt */
     60 void bts_Flt16Alt3D_exit( struct bts_Flt16Alt3D* ptrA );
     61 
     62 /* ---- \ghd{ operators } -------------------------------------------------- */
     63 
     64 /* ---- \ghd{ query functions } -------------------------------------------- */
     65 
     66 /* ---- \ghd{ modify functions } ------------------------------------------- */
     67 
     68 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
     69 
     70 /** size object needs when written to memory */
     71 uint32 bts_Flt16Alt3D_memSize( struct bbs_Context* cpA,
     72 							   const struct bts_Flt16Alt3D* ptrA );
     73 
     74 /** writes object to memory; returns number of bytes written */
     75 uint32 bts_Flt16Alt3D_memWrite( struct bbs_Context* cpA,
     76 							    const struct bts_Flt16Alt3D* ptrA,
     77 								uint16* memPtrA );
     78 
     79 /** reads object from memory; returns number of bytes read */
     80 uint32 bts_Flt16Alt3D_memRead( struct bbs_Context* cpA,
     81 							   struct bts_Flt16Alt3D* ptrA,
     82 							   const uint16* memPtrA );
     83 
     84 /* ---- \ghd{ exec functions } --------------------------------------------- */
     85 
     86 /** creates identity alt */
     87 struct bts_Flt16Alt3D bts_Flt16Alt3D_createIdentity( void );
     88 
     89 /** creates scale alt */
     90 struct bts_Flt16Alt3D bts_Flt16Alt3D_createScale( int32 scaleA,
     91 												  int32 scaleBbpA,
     92 												  const struct bts_Flt16Vec3D* centerPtrA );
     93 
     94 /** creates linear alt from matrix and center */
     95 struct bts_Flt16Alt3D bts_Flt16Alt3D_createLinear( const struct bts_Flt16Mat3D* matPtrA,
     96 												   const struct bts_Flt16Vec3D* centerPtrA );
     97 
     98 /** creates alt from 16 bit values */
     99 struct bts_Flt16Alt3D bts_Flt16Alt3D_create16( int16 xxA, int16 xyA, int16 xzA,
    100 											   int16 yxA, int16 yyA, int16 yzA,
    101 											   int16 zxA, int16 zyA, int16 zzA,
    102 											   int16 matBbpA,
    103 											   int16 xA, int16 yA, int16 zA,
    104 											   int16 vecBbpA );
    105 
    106 /** creates alt from 32 bit values (automatic adjustment of bbp value) */
    107 struct bts_Flt16Alt3D bts_Flt16Alt3D_create32( int32 xxA, int32 xyA, int32 xzA,
    108 											   int32 yxA, int32 yyA, int32 yzA,
    109 											   int32 zxA, int32 zyA, int32 zzA,
    110 											   int16 matBbpA,
    111 											   int32 xA, int32 yA, int32 zA,
    112 											   int16 vecBbpA );
    113 
    114 /** Multiplies matrix with float vecA; returns resulting vector */
    115 struct bts_Flt16Vec3D bts_Flt16Alt3D_mapFlt( const struct bts_Flt16Alt3D* matPtrA,
    116 								             const struct bts_Flt16Vec3D* vecPtrA );
    117 
    118 /** multiplies alt with altA returns resulting alt */
    119 struct bts_Flt16Alt3D bts_Flt16Alt3D_mul( const struct bts_Flt16Alt3D* mat1PtrA,
    120 								          const struct bts_Flt16Alt3D* mat2PtrA );
    121 
    122 /** multiplies alt with matA; returns pointer to resulting alt */
    123 struct bts_Flt16Alt3D* bts_Flt16Alt3D_mulTo( struct bts_Flt16Alt3D* mat1PtrA,
    124 				                             const struct bts_Flt16Alt3D* mat2PtrA );
    125 
    126 #endif /* bts_FLT16ALT3D_EM_H */
    127 
    128