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_FUNCTIONS_EM_H
     18 #define bim_FUNCTIONS_EM_H
     19 
     20 /**
     21  * This files contains gerenral purpose functions.
     22  */
     23 
     24 /* ---- includes ----------------------------------------------------------- */
     25 
     26 #include "b_BasicEm/UInt8Arr.h"
     27 #include "b_TensorEm/Functions.h"
     28 #include "b_TensorEm/Flt16Alt2D.h"
     29 
     30 /* ---- related objects  --------------------------------------------------- */
     31 
     32 /* ---- typedefs ----------------------------------------------------------- */
     33 
     34 /** pyramidal image type */
     35 enum bim_PyramidalImageType
     36 {
     37 	bim_UINT8_PYRAMIDAL_IMG,	/* byte representation of pyramical image */
     38 	bim_UINT16_PYRAMIDAL_IMG	/* 16-bit representation of pyramical image */
     39 };
     40 
     41 /* ---- constants ---------------------------------------------------------- */
     42 
     43 /* ---- external functions ------------------------------------------------- */
     44 
     45 /** Warps an image with intermediate pyramidal downscaling if possible in order to minimize aliasing
     46  *  The actual warping happens using pixel interpolation
     47  *  *bufPtrA is an intermediate byte array that holds downscaled data (only needed when pyramidal downscaling happens; can be NULL otherwise)
     48  *  scaleThresholdA (16.16):
     49  *		specifies the minimum scale ratio (inImage/outImage) required to initiate prior filtering
     50  *      A value range of 2.0...4.0 is recommended (<= 0.0: disabled)
     51  *
     52  *  offsPtrA specifies the pixel position (0,0) in the input image (format 16.0)
     53  */
     54 void bim_filterWarpInterpolation( struct bbs_Context* cpA,
     55 								  uint8* dstImagePtrA,
     56 								  const uint8* srcImagePtrA,
     57 								  uint32 srcImageWidthA,
     58 								  uint32 srcImageHeightA,
     59 								  const struct bts_Int16Vec2D* offsPtrA,
     60 								  const struct bts_Flt16Alt2D* altPtrA,
     61 								  uint32 dstWidthA,
     62 								  uint32 dstHeightA,
     63 								  struct bbs_UInt8Arr* bufPtrA,
     64 								  uint32 scaleThresholdA );
     65 
     66 /** Warps an image with intermediate pyramidal downscaling if possible in order to minimize aliasing
     67  *  The actual warping happens using pixel replication (fast but prone to artefacts)
     68  *  *bufPtrA is an intermediate byte array that holds downscaled data (only needed when pyramidal downscaling happens; can be NULL otherwise)
     69  *  scaleThresholdA (16.16):
     70  *		specifies the minimum scale ratio (inImage/outImage) required to initiate prior filtering
     71  *      A value range of 2.0...4.0 is recommended (0.0: disabled)
     72  *  offsPtrA specifies the pixel position (0,0) in the input image (format 16.0)
     73  */
     74 void bim_filterWarpPixelReplication( struct bbs_Context* cpA,
     75 									 uint8* dstImagePtrA,
     76 									 const uint8* srcImagePtrA,
     77 									 uint32 srcImageWidthA,
     78 									 uint32 srcImageHeightA,
     79 								     const struct bts_Int16Vec2D* offsPtrA,
     80 									 const struct bts_Flt16Alt2D* altPtrA,
     81 									 uint32 dstWidthA,
     82 									 uint32 dstHeightA,
     83 									 struct bbs_UInt8Arr* bufPtrA,
     84 									 uint32 scaleThresholdA );
     85 
     86 /** Selects proper warp function above
     87  *  offsPtrA specifies the pixel position (0,0) in the input image (format 16.0)
     88  */
     89 void bim_filterWarp( struct bbs_Context* cpA,
     90 					 uint8* dstImagePtrA,
     91 					 const uint8* srcImagePtrA,
     92 					 uint32 srcImageWidthA,
     93 					 uint32 srcImageHeightA,
     94   				     const struct bts_Int16Vec2D* offsPtrA,
     95 					 const struct bts_Flt16Alt2D* altPtrA,
     96 					 uint32 dstWidthA,
     97 					 uint32 dstHeightA,
     98 					 struct bbs_UInt8Arr* bufPtrA,
     99 					 uint32 scaleThresholdA,
    100 					 flag interpolateA );
    101 
    102 #endif /* bim_FUNCTIONS_EM_H */
    103 
    104