Home | History | Annotate | Download | only in b_ImageEm
      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_FLT16_IMAGE_EM_H
     18 #define bim_FLT16_IMAGE_EM_H
     19 
     20 /* ---- includes ----------------------------------------------------------- */
     21 
     22 #include "b_BasicEm/Context.h"
     23 #include "b_BasicEm/Int16Arr.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_FLT16_IMAGE_VERSION 100
     37 
     38 /* ---- object definition -------------------------------------------------- */
     39 
     40 /** image of int16 with floating point */
     41 struct bim_Flt16Image
     42 {
     43 
     44 	/* ---- private data --------------------------------------------------- */
     45 
     46 	/** allocated array of bytes */
     47 	struct bbs_Int16Arr allocArrE;
     48 
     49 	/* ---- public data ---------------------------------------------------- */
     50 
     51 	/** width of image */
     52 	uint32 widthE;
     53 
     54 	/** height of image */
     55 	uint32 heightE;
     56 
     57 	/** point position */
     58 	int32 bbpE;
     59 
     60 	/** array of bytes */
     61 	struct bbs_Int16Arr arrE;
     62 };
     63 
     64 /* ---- associated objects ------------------------------------------------- */
     65 
     66 /* ---- external functions ------------------------------------------------- */
     67 
     68 /* ---- \ghd{ constructor/destructor } ------------------------------------- */
     69 
     70 /** initializes bim_Flt16Image  */
     71 void bim_Flt16Image_init( struct bbs_Context* cpA,
     72 						  struct bim_Flt16Image* ptrA );
     73 
     74 /** destroys bim_Flt16Image  */
     75 void bim_Flt16Image_exit( struct bbs_Context* cpA,
     76 						  struct bim_Flt16Image* ptrA );
     77 
     78 /* ---- \ghd{ operators } -------------------------------------------------- */
     79 
     80 /** copy operator */
     81 void bim_Flt16Image_copy( struct bbs_Context* cpA,
     82 						  struct bim_Flt16Image* ptrA,
     83 						  const struct bim_Flt16Image* srcPtrA );
     84 
     85 /** equal operator */
     86 flag bim_Flt16Image_equal( struct bbs_Context* cpA,
     87 						   const struct bim_Flt16Image* ptrA,
     88 						   const struct bim_Flt16Image* srcPtrA );
     89 
     90 /* ---- \ghd{ query functions } -------------------------------------------- */
     91 
     92 /* ---- \ghd{ modify functions } ------------------------------------------- */
     93 
     94 /** allocates memory for bim_Flt16Image */
     95 void bim_Flt16Image_create( struct bbs_Context* cpA,
     96 						    struct bim_Flt16Image* ptrA,
     97 						    uint32 widthA,
     98 							uint32 heightA,
     99  					        struct bbs_MemSeg* mspA );
    100 
    101 /** assigns external image to array (no allocation, deallocation or copying of data) */
    102 /*void bim_Flt16Image_assignExternalImage( struct bbs_Context* cpA,
    103 										 struct bim_Flt16Image* ptrA,
    104 										 struct bim_Flt16Image* srcPtrA );
    105 */
    106 /** sets image size */
    107 void bim_Flt16Image_size( struct bbs_Context* cpA,
    108 						  struct bim_Flt16Image* ptrA,
    109 						  uint32 widthA,
    110 						  uint32 heightA );
    111 
    112 /* ---- \ghd{ memory I/O } ------------------------------------------------- */
    113 
    114 /** word size (16-bit) needs when written to memory */
    115 uint32 bim_Flt16Image_memSize( struct bbs_Context* cpA,
    116 							   const struct bim_Flt16Image* ptrA );
    117 
    118 /** writes object to memory; returns number of words (16-bit) written */
    119 uint32 bim_Flt16Image_memWrite( struct bbs_Context* cpA,
    120 							    const struct bim_Flt16Image* ptrA,
    121 							    uint16* memPtrA );
    122 
    123 /** reads object from memory; returns number of words (16-bit) read */
    124 uint32 bim_Flt16Image_memRead( struct bbs_Context* cpA,
    125 							   struct bim_Flt16Image* ptrA,
    126 							   const uint16* memPtrA,
    127  					           struct bbs_MemSeg* mspA );
    128 
    129 /* ---- \ghd{ exec functions } --------------------------------------------- */
    130 
    131 /** sets all pixels to one value */
    132 void bim_Flt16Image_setAllPixels( struct bbs_Context* cpA,
    133 								  struct bim_Flt16Image* ptrA,
    134 								  int16 valueA, int32 bbpA );
    135 
    136 /** copies a section of given image */
    137 void bim_Flt16Image_copySection( struct bbs_Context* cpA,
    138 								 struct bim_Flt16Image* ptrA,
    139 								 const struct bim_Flt16Image* srcPtrA,
    140 								 const struct bts_Int16Rect* sectionPtrA );
    141 
    142 /** imports real values from complex image */
    143 void bim_Flt16Image_importReal( struct bbs_Context* cpA,
    144 							    struct bim_Flt16Image* dstPtrA,
    145 						        const struct bim_ComplexImage* srcPtrA );
    146 
    147 /** imports imaginary values from complex image */
    148 void bim_Flt16Image_importImag( struct bbs_Context* cpA,
    149 							    struct bim_Flt16Image* dstPtrA,
    150 						        const struct bim_ComplexImage* srcPtrA );
    151 
    152 /** imports magnitudes from complex image */
    153 void bim_Flt16Image_importAbs( struct bbs_Context* cpA,
    154 							   struct bim_Flt16Image* dstPtrA,
    155 						       const struct bim_ComplexImage* srcPtrA );
    156 
    157 /** imports phases from complex image */
    158 void bim_Flt16Image_importPhase( struct bbs_Context* cpA,
    159 								 struct bim_Flt16Image* dstPtrA,
    160 						         const struct bim_ComplexImage* srcPtrA );
    161 
    162 
    163 #endif /* bim_FLT16_IMAGE_EM_H */
    164 
    165