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_FLT16ALT2D_EM_H 18#define bts_FLT16ALT2D_EM_H 19 20/* ---- includes ----------------------------------------------------------- */ 21 22#include "b_BasicEm/Context.h" 23#include "b_BasicEm/Basic.h" 24#include "b_TensorEm/Flt16Mat2D.h" 25#include "b_TensorEm/Flt16Vec2D.h" 26 27/* ---- related objects --------------------------------------------------- */ 28 29/* ---- typedefs ----------------------------------------------------------- */ 30 31/* ---- constants ---------------------------------------------------------- */ 32 33/* ---- object definition -------------------------------------------------- */ 34 35/** 2d affine linear trafo */ 36struct bts_Flt16Alt2D 37{ 38 39 /* ---- private data --------------------------------------------------- */ 40 41 /* ---- public data ---------------------------------------------------- */ 42 43 /** matrix */ 44 struct bts_Flt16Mat2D matE; 45 46 /** vector */ 47 struct bts_Flt16Vec2D vecE; 48}; 49 50/* ---- associated objects ------------------------------------------------- */ 51 52/* ---- external functions ------------------------------------------------- */ 53 54/* ---- \ghd{ constructor/destructor } ------------------------------------- */ 55 56/** initializes alt */ 57void bts_Flt16Alt2D_init( struct bts_Flt16Alt2D* ptrA ); 58 59/** destroys alt */ 60void bts_Flt16Alt2D_exit( struct bts_Flt16Alt2D* ptrA ); 61 62/* ---- \ghd{ operators } -------------------------------------------------- */ 63 64/** copy operator */ 65void bts_Flt16Alt2D_copy( struct bts_Flt16Alt2D* ptrA, 66 const struct bts_Flt16Alt2D* srcPtrA ); 67 68/** equal operator */ 69flag bts_Flt16Alt2D_equal( const struct bts_Flt16Alt2D* ptrA, 70 const struct bts_Flt16Alt2D* srcPtrA ); 71 72/* ---- \ghd{ query functions } -------------------------------------------- */ 73 74/* ---- \ghd{ modify functions } ------------------------------------------- */ 75 76/* ---- \ghd{ memory I/O } ------------------------------------------------- */ 77 78/** size object needs when written to memory */ 79uint32 bts_Flt16Alt2D_memSize( struct bbs_Context* cpA, 80 const struct bts_Flt16Alt2D* ptrA ); 81 82/** writes object to memory; returns number of bytes written */ 83uint32 bts_Flt16Alt2D_memWrite( struct bbs_Context* cpA, 84 const struct bts_Flt16Alt2D* ptrA, 85 uint16* memPtrA ); 86 87/** reads object from memory; returns number of bytes read */ 88uint32 bts_Flt16Alt2D_memRead( struct bbs_Context* cpA, 89 struct bts_Flt16Alt2D* ptrA, 90 const uint16* memPtrA ); 91 92/* ---- \ghd{ exec functions } --------------------------------------------- */ 93 94/** inverts alt */ 95void bts_Flt16Alt2D_invert( struct bts_Flt16Alt2D* ptrA ); 96 97/** returns inverted alt */ 98struct bts_Flt16Alt2D bts_Flt16Alt2D_inverted( const struct bts_Flt16Alt2D* ptrA ); 99 100/** creates identity alt */ 101struct bts_Flt16Alt2D bts_Flt16Alt2D_createIdentity( void ); 102 103/** creates rotation alt */ 104struct bts_Flt16Alt2D bts_Flt16Alt2D_createRotation( phase16 angleA, 105 const struct bts_Flt16Vec2D* centerPtrA ); 106 107/** creates scale alt */ 108struct bts_Flt16Alt2D bts_Flt16Alt2D_createScale( int32 scaleA, 109 int32 scaleBbpA, 110 const struct bts_Flt16Vec2D* centerPtrA ); 111 112/** creates rigid alt (scale & rotation) */ 113struct bts_Flt16Alt2D bts_Flt16Alt2D_createRigid( phase16 angleA, 114 int32 scaleA, 115 int32 scaleBbpA, 116 const struct bts_Flt16Vec2D* centerPtrA ); 117 118/** creates rigid alt (scale & rotation) that mapps vecIn1 and vecIn2 to vecOut1 and vecOut2*/ 119struct bts_Flt16Alt2D bts_Flt16Alt2D_createRigidMap( struct bts_Flt16Vec2D vecIn1A, 120 struct bts_Flt16Vec2D vecIn2A, 121 struct bts_Flt16Vec2D vecOut1A, 122 struct bts_Flt16Vec2D vecOut2A ); 123 124/** creates alt from 16 bit values */ 125struct bts_Flt16Alt2D bts_Flt16Alt2D_create16( int16 xxA, 126 int16 xyA, 127 int16 yxA, 128 int16 yyA, 129 int16 matBbpA, 130 int16 xA, 131 int16 yA, 132 int16 vecBbpA ); 133 134/** creates alt from 32 bit values (automatic adjustment of bbp value) */ 135struct bts_Flt16Alt2D bts_Flt16Alt2D_create32( int32 xxA, 136 int32 xyA, 137 int32 yxA, 138 int32 yyA, 139 int32 matBbpA, 140 int32 xA, 141 int32 yA, 142 int32 vecBbpA ); 143 144/** Multiplies matrix with float vecA; returns resulting vector. 145 * bbp can get changed. 146 */ 147struct bts_Flt16Vec2D bts_Flt16Alt2D_mapFlt( const struct bts_Flt16Alt2D* matPtrA, 148 const struct bts_Flt16Vec2D* vecPtrA ); 149 150/** multiplies alt with altA returns resulting alt */ 151struct bts_Flt16Alt2D bts_Flt16Alt2D_mul( const struct bts_Flt16Alt2D* alt1PtrA, 152 const struct bts_Flt16Alt2D* alt2PtrA ); 153 154/** multiplies alt with matA; returns pointer to resulting alt */ 155struct bts_Flt16Alt2D* bts_Flt16Alt2D_mulTo( struct bts_Flt16Alt2D* alt1PtrA, 156 const struct bts_Flt16Alt2D* alt2PtrA ); 157 158#endif /* bts_FLT16ALT2D_EM_H */ 159 160