auto import from //depot/cupcake/@135843
[android/platform/external/neven.git] / Embedded / common / src / b_ImageEm / APhImage.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 bim_APH_IMAGE_EM_H
18 #define bim_APH_IMAGE_EM_H
19
20 /* ---- includes ----------------------------------------------------------- */
21
22 #include "b_BasicEm/Context.h"
23 #include "b_BasicEm/APhArr.h"
24 #include "b_TensorEm/Int16Rect.h"
25 #include "b_TensorEm/Flt16Alt2D.h"
26
27 /* ---- related objects  --------------------------------------------------- */
28
29 struct bim_ComplexImage;
30
31 /* ---- typedefs ----------------------------------------------------------- */
32
33 /* ---- constants ---------------------------------------------------------- */
34
35 /* data format version number */
36 #define bim_APH_IMAGE_VERSION 100
37
38 /* ---- object definition -------------------------------------------------- */
39
40 /** image of complex values (abs-phase format) */
41 struct bim_APhImage 
42 {
43
44         /* ---- private data --------------------------------------------------- */
45
46         /* ---- public data ---------------------------------------------------- */
47
48         /** width of image */
49         uint32 widthE;
50
51         /** height of image */
52         uint32 heightE;
53
54         /** array of bytes */
55         struct bbs_APhArr arrE;
56 };
57
58 /* ---- associated objects ------------------------------------------------- */
59
60 /* ---- external functions ------------------------------------------------- */
61
62 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
63
64 /** initializes bim_APhImage  */
65 void bim_APhImage_init( struct bbs_Context* cpA,
66                                             struct bim_APhImage* ptrA );
67
68 /** creates bim_APhImage object */
69 void bim_APhImage_create( struct bbs_Context* cpA,
70                                                   struct bim_APhImage* ptrA, 
71                                                   uint32 widthA, 
72                                                   uint32 heightA,
73                                                   struct bbs_MemSeg* mspA );
74
75 /** frees bim_APhImage  */
76 void bim_APhImage_exit( struct bbs_Context* cpA,
77                                             struct bim_APhImage* ptrA );
78
79 /* ---- \ghd{ operators } -------------------------------------------------- */
80
81 /** copy operator */
82 void bim_APhImage_copy( struct bbs_Context* cpA,
83                                             struct bim_APhImage* ptrA, 
84                                                 const struct bim_APhImage* srcPtrA );
85
86 /** equal operator */
87 flag bim_APhImage_equal( struct bbs_Context* cpA,
88                                                  const struct bim_APhImage* ptrA, 
89                                                  const struct bim_APhImage* srcPtrA );
90
91 /* ---- \ghd{ query functions } -------------------------------------------- */
92
93 /* ---- \ghd{ modify functions } ------------------------------------------- */
94
95 /** sets image size */
96 void bim_APhImage_size( struct bbs_Context* cpA,
97                                             struct bim_APhImage* ptrA, 
98                                                 uint32 widthA, 
99                                                 uint32 heightA );
100
101 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
102
103 /** word size (16-bit) needs when written to memory */
104 uint32 bim_APhImage_memSize( struct bbs_Context* cpA,
105                                                          const struct bim_APhImage* ptrA );
106
107 /** writes object to memory; returns number of words (16-bit) written */
108 uint32 bim_APhImage_memWrite( struct bbs_Context* cpA,
109                                                           const struct bim_APhImage* ptrA, 
110                                                           uint16* memPtrA );
111
112 /** reads object from memory; returns number of words (16-bit) read */
113 uint32 bim_APhImage_memRead( struct bbs_Context* cpA,
114                                                          struct bim_APhImage* ptrA, 
115                                                          const uint16* memPtrA,
116                                                      struct bbs_MemSeg* mspA );
117
118 /* ---- \ghd{ exec functions } --------------------------------------------- */
119
120 /** sets all pixels to one value */
121 void bim_APhImage_setAllPixels( struct bbs_Context* cpA,
122                                                             struct bim_APhImage* ptrA, 
123                                                                 struct bbs_APh valueA );
124                                                         
125 /** copies a section of given image */
126 void bim_APhImage_copySection( struct bbs_Context* cpA,
127                                                            struct bim_APhImage* ptrA, 
128                                                                  const struct bim_APhImage* srcPtrA, 
129                                                                  const struct bts_Int16Rect* sectionPtrA );
130
131 /** import complex image */
132 void bim_APhImage_importComplex( struct bbs_Context* cpA,
133                                                                  struct bim_APhImage* dstPtrA, 
134                                                          const struct bim_ComplexImage* srcPtrA );
135
136 #endif /* bim_APH_IMAGE_EM_H */
137