Home | History | Annotate | Download | only in mosaic
      1 /*
      2  * Copyright (C) 2011 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 // Pyramid.h
     18 
     19 #ifndef PYRAMID_H
     20 #define PYRAMID_H
     21 
     22 #include "ImageUtils.h"
     23 
     24 typedef unsigned short int real;
     25 
     26 //  Structure containing a packed pyramid of type ImageTypeShort.  Used for pyramid
     27 //  blending, among other things.
     28 
     29 class PyramidShort
     30 {
     31 
     32 public:
     33 
     34   ImageTypeShort *ptr;              // Pointer containing the image
     35   real width, height;               // Width and height of input images
     36   real numChannels;                 // Number of channels in input images
     37   real border;                      // border size
     38   real pitch;                       // Pitch.  Used for moving through image efficiently.
     39 
     40   static PyramidShort *allocatePyramidPacked(real width, real height, real levels, real border = 0);
     41   static PyramidShort *allocateImage(real width, real height, real border);
     42   static void createPyramid(ImageType image, PyramidShort *pyramid, int last = 3 );
     43   static void freeImage(PyramidShort *image);
     44 
     45   static unsigned int calcStorage(real width, real height, real border2, int levels, int *lines);
     46 
     47   static void BorderSpread(PyramidShort *pyr, int left, int right, int top, int bot);
     48   static void BorderExpandOdd(PyramidShort *in, PyramidShort *out, PyramidShort *scr, int mode);
     49   static int BorderExpand(PyramidShort *pyr, int nlev, int mode);
     50   static int BorderReduce(PyramidShort *pyr, int nlev);
     51   static void BorderReduceOdd(PyramidShort *in, PyramidShort *out, PyramidShort *scr);
     52 };
     53 
     54 #endif
     55