auto import from //depot/cupcake/@135843
[android/platform/external/neven.git] / Embedded / common / src / b_TensorEm / Int16Vec2D.h
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_INT16VEC2D_EM_H
18 #define bts_INT16VEC2D_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
26 /* ---- related objects  --------------------------------------------------- */
27
28 /* ---- typedefs ----------------------------------------------------------- */
29
30 /* ---- constants ---------------------------------------------------------- */
31
32 /* ---- object definition -------------------------------------------------- */
33
34 /** 2d vector */
35 struct bts_Int16Vec2D 
36 {
37
38         /* ---- private data --------------------------------------------------- */
39
40         /* ---- public data ---------------------------------------------------- */
41
42         /** x component */
43         int16 xE;
44
45         /** y component */
46         int16 yE;
47 };
48
49 /* ---- associated objects ------------------------------------------------- */
50
51 /* ---- external functions ------------------------------------------------- */
52
53 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
54
55 /** initializes vector */
56 void bts_Int16Vec2D_init( struct bts_Int16Vec2D* ptrA );
57
58 /** destroys vector */
59 void bts_Int16Vec2D_exit( struct bts_Int16Vec2D* ptrA );
60
61 /* ---- \ghd{ operators } -------------------------------------------------- */
62
63 /* ---- \ghd{ query functions } -------------------------------------------- */
64
65 /* ---- \ghd{ modify functions } ------------------------------------------- */
66
67 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
68
69 /** size object needs when written to memory */
70 uint32 bts_Int16Vec2D_memSize( struct bbs_Context* cpA,
71                                                            const struct bts_Int16Vec2D* ptrA );
72
73 /** writes object to memory; returns number of bytes written */
74 uint32 bts_Int16Vec2D_memWrite( struct bbs_Context* cpA,
75                                                             const struct bts_Int16Vec2D* ptrA, 
76                                                                 uint16* memPtrA );
77
78 /** reads object from memory; returns number of bytes read */
79 uint32 bts_Int16Vec2D_memRead( struct bbs_Context* cpA,
80                                                            struct bts_Int16Vec2D* ptrA, 
81                                                            const uint16* memPtrA );
82
83 /* ---- \ghd{ exec functions } --------------------------------------------- */
84
85 /** dot product of vectors */
86 int32 bts_Int16Vec2D_dotPrd( const struct bts_Int16Vec2D* vec1PtrA, 
87                                                          const struct bts_Int16Vec2D* vec2PtrA );
88
89 /** returns square norm of vector */
90 uint32 bts_Int16Vec2D_norm2( const struct bts_Int16Vec2D* ptrA );
91
92 /** returns norm of vector */
93 uint16 bts_Int16Vec2D_norm( const struct bts_Int16Vec2D* ptrA );
94
95 /** normalizes vector; bbpA defines number of bits behind the point */
96 void bts_Int16Vec2D_normalize( struct bts_Int16Vec2D* ptrA, int32 bbpA );
97
98 /** returns normalized vector; bbpA defines number of bits behind the point */
99 struct bts_Int16Vec2D bts_Int16Vec2D_normalized( const struct bts_Int16Vec2D* ptrA, int32 bbpA );
100
101 /** computes angle between vector and x axis*/
102 phase16 bts_Int16Vec2D_angle( const struct bts_Int16Vec2D* vecPtrA );
103
104 /** computes angle between two vectors */
105 phase16 bts_Int16Vec2D_enclosedAngle( const struct bts_Int16Vec2D* vec1PtrA, 
106                                                                           const struct bts_Int16Vec2D* vec2PtrA );
107
108 #endif /* bts_INT16VEC2D_EM_H */
109